SysTems - Okay, here are my not yet very mature toughts on OO Yesterday I was reading Peter Chen paper (was writen in the 70th) about the ERD or ERM or ERDM how ever you want to call it
ERD -> Entity Relationship Diagram; ERM -> Entity Relationship Model; ERDM -> Entity Relationship Diagram Model
He was talking about a unify view for data model from which you can derive data model that support the three other data models at that time:
1-The network model; 2-The relational model; 3-the sets (or entity sets) models
I know a little about the first two models, but really have no clue about the third
Anyway, what Interested me in the paper is how he separeted an Entities (object) from entity sets (class) from attributes, from values and value set
The concept is still blury in my head, but, I like how he tought of attributes he define attributes as functions that map an entity to a value from a value set
So it's like a hash table, in which you can register a value (that belongs to a certain value set) to an entity, so it's more like an index, a relation, between entities and a value of a certain type, the attribute is the guard that knows which entity own which value within the values of this value set, the entities don't have to come from the same entity set, they just share this one attribute in common (think polymorphism), so this way, all entities who have a value within a value set, can all store it in the same place (don't think database, no don't) under the same name, of course this isn't new, you can have this under inheritence (so that the value set have excatly the same name)
A pop up question, can you define a value set in Tcl? (my first tought was yea, regexp specially since everything was a string)
Anyway, another interesting thing to note is thinking of objects this way: an object is just a grouping of values with special semantics, meaning, you can define two objects, Dog and Cat, both have a name attribute and an age attribute (within possibly the same set of values, ie, less then a certain age (which is itself a special kind of numbers, or itself a grouping of 3 value a value for years (age years more then 0 less then x) a value for months (more then 0 less then 12) etc)
What breaks my head is this recursive nature, a value is itself a grouping of other values each belong to a certain set of values themselve a grouping of values etc....
But anyway, we can say we need to be able to define
1-A grouping or a structure; 2-A constrainted set of value for the structure
Ocaml already does that, I think
A popup question if a funtion operates on a set of values (for an object), do we need to know if this value is the whole object or a piece of it
For example, if a function (or object that respond to messages) operates on FirstName set of Value, should we always send it the Firstname piece explicitly, or should we send it the object the object and let it investigate, honeslty I think this depends on how you code you application, and not necessarely a language feature.
I feel, I am running in circles now ... but I wanted to express my toughts on the issue anyway :)
Some languages defines, sets of value, that I might call em atomic, you can not decompose them, break em into piece, but you can produce a limited set of them
A popup question, in Tcl everything is a string, what kind of string (unicode string, or ascii or what, unicodes represent a larger set)? - RS: Everything is a Unicode string, up to 3.0 standards - i.e. max. 16 bits.
The point is, the character is our atomic unit here in Tcl, you can not decompose a character, but via regexp you limit its possible set of value, and via encoding and structures you can define groupings. - RS: You can well decompose a character, as it is just a view on an unsigned integer (16 bits in current Tcl), into each single bit of it - see Data structures: from the bit to the Web :)
Encoding (Conceptual Structures): (for example a list is a structure define by encoding, the space value is a seprator, a list is a particular type of grouping, in which the piece have an order or a rank not a name, so it's a structure define by it's encoding), the cool thing about conceptual structures, is a list is a list, I mean you just deveoped an algorithm to define it, a piece doesnt have a name, but an order, Tree are the same thing, a piece have a place a position not a name, a status, those types are more dynamic
Structures (Named Structures): (Namespace, ensembles, itcl classes, xotcl classes, etc...), here a piece must have a name, if you can not name a piece you can not use it, those structures are less dynamic by nature
Inheritance and such, I think are just a conveniant way to extend the structures, and possible extend their semantics
I almost forget to mention this, A cat and Dog can be define as indentical structures, yet on the semantic level they are different, but then it's because the word cat and dog means a lot of different things to us human, those different things were not defined in the structure, but in the structure name
Another Example, FirstName, NickName ... can possible register values for their objects within the same set of value (character values) yet, they mean totally different things to us
This semantic, usually will reflect into where in the program flow those two attributes will be required from an object
So, what is the best way to group sets of values and sets of attributes under semantically different names, using Tcl? and what conveniant features such as inheritence (also possibly a semantic feature) would you like to have?