what is a class?
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: what is a class?
Think of classes and types like this: classes are a "template" for an object, whereas types are a "template" for a piece of data. So "vehicle" might be the class of an object "car", but "integer" might be the type of an attribute "number_of_doors". (Note that, as aforedescribed, types can also be subdivided into base types and user-defined types which are built from those base types. Some languages, such as Java, may also blur the lines between classes and types at times, but they are still different concepts.)
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: what is a class?
In a pure object-oriented language (such as SmallTalk) everything is an instance of a class, even classes. The distinction between classes and types is an arbitrary one made by hybrid monsters such as C++.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: what is a class?
The real problem is that there are several models of how to map a conceptual category to a concrete datum, and the terminology varies depending on the model - there are several competing or at least contradictory definitions of what words like 'class', 'type', 'domain', 'value', 'object', 'reference' and so forth mean. Most books or papers approaching this from a formal position - such as Data Structures + Algorithms = Programs by Wirth, A Discipline of Programming by Dijkstra, Elements of Programming by Stepanov and McJones (I am currently reading this, and it's... well, I'm reserving judgement), or The Science of Programming by Gries - define the meanings used in them, but informal works by their nature generally don't.
Most of the confusion we're having in this thread seems to come from contradictory definitions of common but loosely used terms.
Most of the confusion we're having in this thread seems to come from contradictory definitions of common but loosely used terms.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Re: what is a class?
Yes, well slightly different in my language. ive gone for; A 'class' is an object (you can send it messages, add method etc and all constructors). But I didn't like the metaclass idea so have it as a primitive object defined by the language and provided by the environment.iansjack wrote:In a pure object-oriented language (such as SmallTalk) everything is an instance of a class, even classes. The distinction between classes and types is an arbitrary one made by hybrid monsters such as C++.
Re: what is a class?
I currently think a 'type' is a label thats meaning is the interfaces and invariants of some concept.
I'm happy with my current dynamic typing and 'standardisation' (to keep the types label meaning the same) and want to stay away from typing for the time being
having said that I also wanted to avoid inheritance and look where that got me!
I'm happy with my current dynamic typing and 'standardisation' (to keep the types label meaning the same) and want to stay away from typing for the time being
having said that I also wanted to avoid inheritance and look where that got me!
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: what is a class?
Shall we define some terms, then, so we're all saying the same things when we are using a given term? I'll start by proposing something, and then let others either propose their own definitions or indicate that they agree with one someone else proposed, and we'll see if we can come to a consensus. My first four are basically rewordings of Stepanov and McJones's terms:
- entity - any thing or concept that can be treated as a unit. A abstract entity are a sort of Platonic ideal of a given entity, and does not change; a concrete entity is one which has a creation point in time and space, can be altered over time, and eventually ceases to exist in some point in time and space.
- attribute - a property of an entity. An abstract attribute is one which is describes an abstract entity; a concrete attribute is a correspondence between the actual state of a concrete entity and the abstract attributes of it's matching abstract entity. While abstract entities can only exist as concepts, concrete entities can exist either as physical objects, organizational units (e.g., a government, a legal contract, an intellectual property when considered independent of the specific medium it is stored in) or structural units (e.g., a city, an island, a building, a disk driver).
- Identity - the general concept of the 'sameness' of a concrete entity as it changes over time. This is a problematic concept, as it can't really even proven to mean much of anything, so several other indicators have to be used when working with concrete entities. Generally speaking, the identity of an abstract entity is its definition or description, which is somewhat tautological.
- snapshot - a description of all the defined attributes of a concrete entity at a given instantaneous point in time (I'll leave the definition of 'instantaneous' to whatever future philosopher who manages to do so without self-contradiction).
- value - an abstract entity representing some concept.
- species - an identity naming a group of entities with the same set of abstract attributes, such that they can be substituted for each other under given circumstances (e.g., human beings, laws, integers).
- genus - an identity naming a set of related species that have one or more subsets of their attributes in common.
- datum - a concrete entity consisting of some unit of information.
- signal - a concrete entity carrying a datum representing a value.
- value type - an interpretation of a datum as a representation of a value.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Re: what is a class?
Then you'll be unable to separate your classes. Usually a class hierarchy is extended during a long period of time and it means every new class you write will always trigger recompilation of all base classes, even if your project is working somewhere on a server that serves user requests. So, the server needs a compiler and an infrastructure that helps it to survive the recompilation process. Isn't it too limiting requirement?cxzuk wrote:What i think i want is to extend the superclass with each subclass definition (like a partial class with a label), this would mean an instance of NUMBER would contain all the code from class INTEGER.
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability