HOME

TheInfoList




In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software. It has sci ...

computing
, an attribute is a specification that defines a
property Property is a system of rights that gives people legal control of valuable things, and also refers to the valuable things themselves. Depending on the nature of the property, an owner of property may have the right to consume, alter, share, r ...
of an
object Object may refer to: General meanings * Object (philosophy) An object is a philosophy, philosophical term often used in contrast to the term ''Subject (philosophy), subject''. A subject is an observer and an object is a thing observed. For mo ...
, element, or file. It may also refer to or set the specific
value Value or values may refer to: * Value (ethics) In ethics Ethics or moral philosophy is a branch of philosophy Philosophy (from , ) is the study of general and fundamental questions, such as those about Metaphysics, existence, reason, E ...
for a given instance of such. For clarity, attributes should more correctly be considered
metadata Metadata is "data Data (; ) are individual facts, statistics, or items of information, often numeric. In a more technical sense, data are a set of values of qualitative property, qualitative or quantity, quantitative variable (research), v ...

metadata
. An attribute is frequently and generally a property of a property. However, in actual usage, the term attribute can and is often treated as equivalent to a
property Property is a system of rights that gives people legal control of valuable things, and also refers to the valuable things themselves. Depending on the nature of the property, an owner of property may have the right to consume, alter, share, r ...
depending on the technology being discussed. An attribute of an object usually consists of a name and a value; of an element, a type or class name; of a file, a name and extension. * Each named attribute has an associated set of rules called operations: one doesn't sum characters or manipulate and process an
integer An integer (from the Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', meaning "to share" or "to ...
array ARRAY, also known as ARRAY Now, is an independent distribution company launched by film maker and former publicist Ava DuVernay Ava Marie DuVernay (; born August 24, 1972) is an American filmmaker. She won the directing award in the U.S. dram ...
as an image object—one doesn't process text as type floating point ( decimal numbers). * It follows that an object definition can be extended by imposing data typing: a representation format, a default value, and legal operations (rules) and restrictions ("Division by zero is not to be tolerated!") are all potentially involved in defining an attribute, or conversely, may be spoken of as attributes of that object's type. A JPEG file is not decoded by the same operations (however similar they may be—these are all graphics data formats) as a PNG or BMP file, nor is a floating point typed number operated upon by the rules applied to typed long integers. For example, in computer graphics, line objects can have attributes such as thickness (with real values), color (with descriptive values such as brown or green or values defined in a certain color model, such as RGB), dashing attributes, etc. A circle object can be defined in similar attributes plus an origin and radius. In reference to computer systems, attributes are defined particularly for read or write attributes for specific read or write.


Attribute usage

If the element in question could be considered a property (CUSTOMER_NAME) of another entity (let's say CUSTOMER), the element can have zero or more attributes (properties) of its own (CUSTOMER_NAME is of TYPE = "KINDOFTEXT").


C#

In the C# programming language, attributes are
metadata Metadata is "data Data (; ) are individual facts, statistics, or items of information, often numeric. In a more technical sense, data are a set of values of qualitative property, qualitative or quantity, quantitative variable (research), v ...

metadata
attached to a field or a block of code like assemblies,
members Member may refer to: * Military jury A United States military "jury" (or "Members", in military parlance Military parlance is the vernacular used within the military and embraces all aspects of service life; it can be described as both a "code" a ...
and
types Type may refer to: Science and technology Computing * Typing Typing is the process of writing or inputting text by pressing keys on a typewriter, computer keyboard, cell phone, or calculator. It can be distinguished from other means of text inpu ...
, and are equivalent to annotations in Java. Attributes are accessible to both the compiler and programmatically through
reflectionReflection or reflexion may refer to: Philosophy * Self-reflection Science * Reflection (physics), a common wave phenomenon ** Specular reflection, reflection from a smooth surface *** Mirror image, a reflection in a mirror or in water ** Signal r ...
. Users of the language see many examples where attributes are used to address cross-cutting concerns and other mechanistic or platform uses. This creates the false impression that this is their sole intended purpose. Their specific use as metadata is left to the developer and can cover a wide range of types of information about any given application, classes and members that is not instance-specific. The decision to expose any given attribute as a property is also left to the developer as is the decision to use them as part of a larger application framework. Attributes are implemented as classes that are derived from . They are often used by the
CLR
CLR
services, like
COM Com or COM may refer to: Computing * COM (hardware interface) COM port ( DE-9 connector). COM (communication port) is the original, yet still common, name of the serial port In computing Computing is any goal-oriented activity requirin ...
interoperability,
remoting In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (Subroutine#:~:text=In%20computer%20programming%2C%20a%20subroutine,particular%20task%20should%20be%20performed., subroutine) to execute in a diffe ...
,
serialisation In computing, serialization (US spelling) or serialisation (UK spelling) is the process of translating a data structure Image:Hash table 3 1 1 0 1 0 0 SP.svg, 315px, A data structure known as a hash table. In computer science, a data structure ...
and can be queried at runtime. The example shows how attributes are defined in C#: bsolete("Use class C1 instead", IsError = true) // causes compiler message saying public class C // that C is obsolete public class ObsoleteAttribute: Attribute bsolete bsolete("This is obsolete") bsolete("This is obsolete", false) bsolete("This is obsolete", IsError = false) Positional parameters like first parameter of type string above are parameters of the attribute's constructor. Name parameters like the Boolean parameter in the example are a property of the attribute and should be a constant value. Attributes should be contrasted against XML documentation that also defines metadata, but is not included in the compiled assembly and therefore cannot be accessed programmatically.


HTML & JavaScript

Display the checked attribute and property of a checkbox as it changes. attr demo


before click

.attr( 'checked' ): checked .prop( 'checked' ): false .is( ':checked' ): false


after click

.attr( 'checked' ): checked .prop( 'checked' ): true .is( ':checked' ): true


Multi-valued databases

On many post-relational or multi-valued databases systems, relative to SQL, tables are files, rows are items, and columns are attributes. Both in the database and code, attribute is synonymous with property and variable although attributes can be further defined to contain values and subvalues. The first of these databases was the
Pick operating system The Pick operating system (often called just "the Pick system" or simply "Pick") is a demand-paged, multiuser, virtual memory In computing, virtual memory, or virtual storage is a Memory management (operating systems), memory management techn ...
. Two current platforms include Rocket U2's Universe and InterSystems’ Caché.


XML

In
XML Extensible Markup Language (XML) is a markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntactically distinguishable fro ...

XML
, an attribute is a markup construct consisting of a name/value pair that exists within a start-tag or empty-element tag. Markup languages, such as
HTML The HyperText Markup Language, or HTML is the standard markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntacticall ...

HTML
and
XML Extensible Markup Language (XML) is a markup language #REDIRECT Markup language In computer text processing, a markup language is a system for annotation, annotating a document in a way that is Syntax (logic), syntactically distinguishable fro ...

XML
, use attributes to describe data and the formatting of data. A good example is the process of XML assigning values to properties (elements). Note that the element's value is found before the (separate) end tag, not in the element itself. The element itself may have a number of attributes set (NAME = "IAMAPROPERTY"). If the element in question could be considered a property (CUSTOMER_NAME) of another entity (let's say CUSTOMER), the element can have zero or more attributes (properties) of its own (CUSTOMER_NAME is of TYPE = "KINDOFTEXT").


See also

*
Attribute–value pair An attribute–value pair, also called a name–value pair, key–value pair, or field–value pair, is a fundamental data representation Data (treated as singular, plural, or as a mass noun) is any sequence of one or more symbol A symbol ...
*
File attribute File attributes are a type of meta-data Metadata is "data Data are units of information Information can be thought of as the resolution of uncertainty; it answers the question of "What an entity is" and thus defines both its essence ...
*
Extended file attributes Extended file attributes are file system features that enable users to associate computer files with metadata not interpreted by the filesystem, whereas regular attributes have a purpose strictly defined by the filesystem (such as file system permis ...
*
Field (computer science) In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , ...
*
Property (programming) A property, in some object-oriented programming, object-oriented programming languages, is a special sort of Class (computer science), class member, intermediate in functionality between a field (computer science), field (or data member) and a meth ...
*
Java annotation In the Java computer programming language, an annotation is a form of syntactic metadata Metadata is " data" that provides information about other data". In other words, it is "data about data". Many distinct types of metadata exist, including ...
*
Metadata Metadata is "data Data (; ) are individual facts, statistics, or items of information, often numeric. In a more technical sense, data are a set of values of qualitative property, qualitative or quantity, quantitative variable (research), v ...

Metadata


References

{{DEFAULTSORT:Attribute (Computing) Computer data sl:Atribut alt sv:Objektorienterad programmering#Attribut