]> ocean-lang.org Git - ocean-D/blob - ooooo.tex
updates
[ocean-D] / ooooo.tex
1
2 Obervation on Object Oriented Opinion
3
4 @section{Introduction}
5
6 @section{Definitions}
7
8 @subsection{Object}
9
10 An Object can operationally be defined as simply a record.
11 That is, it contains a number of values, each accessable through a
12 name. These values may be anything with the language can describe, but
13 can usually be at least references to other objects and procedures.
14
15 The various attributes may be fixed or changeable (constant or
16 variable).
17 The visibility of the attributes may also be restricted in various ways,
18 with some attributes being visible to all procedured, and others being
19 visible only to selected procedures.
20
21 We will use the term @samp{operation} to refer to procedures which are
22 fixed attributes of objects, and to which all attributes of the
23 associated object are visible.  An operation is really more than the
24 procedure, it is the combination of the procedure and the object which
25 it is an attribute of.
26 Many different objects could have the same procedure as an attribute,
27 and each pairing would make a different operation.
28
29 @subsection{Class}
30
31 A class is a special kind of object.
32 @itemize
33 @item
34 It has an operation called @samp{new} which returns a new object.
35 All objects returned by the @samp{new} operation of a specific class
36 will have the same set of attributes with the same mutability and
37 visibility properties.
38 The initial values will normally be the same from object to object,
39 though arguments to the @samp{new} operation or state within the class
40 may vary these initial values.
41
42 @item
43 Classes are "created" by the program text and so exist from the very
44 commencement of program execution. As such they can and do have unique
45 names in the global namespace of the program.
46 @end itemize
47
48 To help provide confusion, the term "class" is often used to mean the
49 collection of all object that are or could be returned by the @samp{new}
50 operation of some class object.
51
52 The term "The class of" an object refers to the class which created
53 the object.
54
55 @subsection{Extension}
56
57 Object extension is the process of adding attributes to an object.
58 ......
59
60 @subsection{Types and polymorphism}
61
62 We can say that a procedure @samp{expects} an object passed as an
63 argument to behave in a certain way.
64 The expectation may be explicit, or implicit. An implicit expectation
65 might be that a procedure attempts to access a particular attribute of
66 the object. This implies an that the procedure expects the object to
67 have a value for that attribute.
68
69 The collection of expectations that a procedure places on an argument
70 object is termed the @def{type} of the argument.
71 A type may place expectations on the attributes which are visible, and
72 on the types of the values of those attributes.
73
74 An object can be said to @def{conform} to a type when it meets all the
75 expectations of that type.
76 A class can be said to @def{support} a type when all of the objects that
77 its @code{new} operation creates will always conform to that type.
78
79 @def{Polymorphism} is the exploitation of the observation that objects
80 of several different classes may well conform to a particular type, and
81 so a procedure may be written which will work with any of a number of
82 differently shaped object (from different classes) providing that they
83 all conform to a partcular type.
84
85 The view of types as "expectations of behaviour" allows for a very broad
86 understanding of types as it puts them very much in the realm of the
87 programmers mind.  Some languages (those referred to as dynammically
88 types) are happy to leave them soley in that realm.
89 Others try to encode part of the expectation so that conformance may be
90 automatically checked by the compiler, or at least communicated to
91 other programmers.
92
93
94
95 @subsection{Inheritance}
96
97 Inheritance is a notational convenience for describing classes.
98 Rather than giving a complete description of a new class, the new
99 classes is described as being a blend of some number of other classes
100 together with some new information.
101 That is clearly an workable vague description.
102
103 To be more precise, we will consider a class to involve primarily the
104 @code{new} operation which in turn is primarily concerned with declaring
105 the name and nature of the attributes in a created object.
106 In that context, inheritance involves saying that the attributes for new
107 object of this class are the union of the attributes of new objects of
108 some other classes, with some modification.
109 The modification could involve adding further attributes, deleting
110 attributes, or changing the intitial value of some attributes.
111
112 @subsection{Virtual Classes}
113
114 @section{Interpretation}
115
116 class variables
117 ...
118
119 @section{Theory}
120 @subsection{types}
121