First Class Things
-wikipediaIn computing, a first-class object (also -value, -entity, -citizen), in the context of a particular programming language, is an entity which can be used in programs without restriction (when compared to other kinds of objects in the same language). Depending on the language, this can imply:
- being expressible as an anonymous literal value
- being storable in variables
- being storable in data structures
- having an intrinsic identity (independent of any given name)
- being comparable for equality with other entities
- being passable as a parameter to a procedure/function
- being returnable as the result of a procedure/function
- being constructable at runtime
First class objects are very useful because of the properties 2, 6+7, and 8. The benefit of first class stuff would be that you can store it for later use, even if what you are storing is very complicated.
- For example, you can create a user-interface layout, and store that as a file. That means that different configurations of user interface are merely files which describe what the user interface is.
- Another example of using first class things is when we turn information resource locators into first class objects. This allows us manipulation of our query independent from manipulation of the information that the query points to.
- A third example would be file logs - that is, our information system would keep a log of all functions that have been invoked to reach a file. This type of object would be able to be used for file history purposes, such as bibliographies, sourcing data, finding sources of good/bad data, direct file modification via modifying the log, the ability to undo any operation applied to a file.
However, our objects are often more than data - they have functional purposes. For example, the user interface, resource locators and file logs have a functional purpose. As we have described, when we modify these files, we are modifying the very functionality of the computer. Changing a resource locator would allow us to see different information, changing the interface information would change how our interface is laid out on the computer. This can be solved by basing the system on a set of many reflectors - that is, all programs are dividied into a component of core logic which is separated from presentation, description, and other information.
Such a separation is good because, as mentioned, it allows us to do higher order operations on our information, but more than that, it allows us to reuse the same functions and techniques that we have used for plain information on higher order data, since they are also first class stuff.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home