Вы находитесь на странице: 1из 359

-

++

Rational - ,
. .

I.
1.
1.1. ,
1.2.
1.3.
1.4.


:
2.
2.1.
2.2.
2.3.


:
3.
3.1.
3.2.
3.3.
3.4.
3.5.
3.6.


:
4.
4.1.
4.2.
4.3.


:
II.
5.
5.1.
5.2.
5.3.
5.4.
5.5.
5.6.
5.7.
5.8.

.
6.1.
6.2.
6.3.


7.
7.1.
7.2.
7.3.
7.4.
7.5.
7.6.
7.7.
7.8.
7.9. -


III.
8. :
8.1.
8.2.
8.3.
8.4.

:
9. :
9.1.
9.2.
9.3.
9.4.

:
10. -:
10.1.
10.2.
10.3.
10.4.

:
11. :
11.1.
11.2.
11.3.
11.4.

:
12. :
12.1.
12.2.

12.3.
12.4.

:

: -
.1.
.2. Smalltalk 455
.3. Object Pascal
.4. C++
A.5. Common Lisp Object System (CLOS)
A.6.Ada
A.7. Eiffel
.8. -

.
. -
. -
D. -
. -
F. -
G. -
.
I.
J.
.


(Grady Booch), Rational Software,
- .
, Object Magazine C++ Report , - .
-
(Object-oriented Software Engineering Series), AddisonWesley Longman.
, , , ,
, ,
.
, ; ,
.
, .
(Harlan Mills) DPMA (DPMA and Human
Productivity)


-
. -
. .
, .
.


"-
" ("Object-Oriented Design with Applications")
-
. ,
,
, ,
.
, , ,
- - .
-
,
.

, .1
, ,
, .

, ,
, , .
,
(Jacobson), (Rumbaugh), (Goad and Yourdon),
(Constantine), (Shiaer and Mellor), -
(Martin and Odell), (Wasserman), (Goldberg and Rubin),
(Embley), - (Wirfs-Brock), (Goldstein and Alger),
- (Henderson-Sellers), (Firesmith) .
, ,
. ,
, , ,
, .
- ,
( )
, , ,
.
.
-
, , .
1

. , . ,
: "
?".

, ,
, ,
. ,
, (public
domain).
, , .
, .
-, 5 ,
. ,
. ,

.
-, 6 7,
- .
, ,
.
-,
, C++.
, ,
, "" , ""
C++. , - , Smalltalk, CLOS, Ada
Eiffel- . - ,
,
. ,
.
-, .

. ,
"/"
.
, . ,
- ,
.


- . :
;
-
;
-
.
,

.

, :

- , .
,
, .
"" - ""
.
, - .
,
,
.

- CASE (computer-aided software
engineering, ).
, ,
.
,
.
,

- .

- "", "" "


" - .

, ,
, .
.
: , , , ,
, , .
" ?" " ?".
- - ,
. ,
: ,
,
.

,
. ,
. ,
.

,
: ,
, /,
. ,
, .
,
,
, .
,

(,
).
,

.


.
(),
, ,
- .
, - ,
- ,
. ,
,
. ( )
. ,
- .
, " ",
, ,
. " " ("Instructor's Guide with Exercises", ISBN 0-80535341-0) (Mary Beth Rosson) .
(Thomas J. Watson) IBM. ,
,
Addison-Wesley Longman (aw.cse@aw.com)
.
: rosson@watson.ibm.com.

(Booch) .
Rational: booch-card@rational.com. , Addison-Wesley Longman
,
.

?
, -.
, 1 .
, 5 6;
, , 7.
-
, 8-12.


.

- . :
(Sam Adams), (Mike Akroid), (Glenn Andert),
(Sid Bailin), (Kent Beck), (Daniel Bobrow),
(Dick Bolz), (Dave Bulman), (Dave Bernstein),
(Kayvan Carun), (Dave Collins), (Steve Cook),
(Damian Conway), (Jim Coplien), (Brad ),
(Ward Cunningham), - (Torn DeMarco), (Mike
Delvin), (Richard Gabriel), (William Cenemeras),
(Adele Goldberg), - (lan Graham), ( ),
(Jon Hopkins), (Michael Jackson), (Ralph
Johnson), (James Kempf). (Norm Kerth),
(Jordan Kreindler), ( Doug Lea), (Phil Levy), ( Barbara
Liskov), (Cliff Longman), (James MacFarlane),
- (Masoud Milani), (Harlan Mills), (Robert
Murray), (Steve Neis), (Gene Ouye), (Dave Parnas),
(Bill Riddel), (Mary Beth Rosson), (
Rubin), (Jim Rumbaugh), (Kurt Schmucker), -
(Ed Seidewitz), (Dan Shiftman), (Dave Stevenson),
(Bjarne Stroustrup), (Dave Thomson), (Mike Vilot),
(Tony Wasserman), (Peter Wegner), (Iseult
White), (John Williams), (Lloyd Williams),
(Mario Wolczko), (Niklaus Wirth) (Ed Yourdon).

:
Apple, Alcatel, Andersen Consulting, AT&T, Autotrol, Bell Northern Research, Boeing,
Borland, Computer Sciences Corporation, Contel, Ericsson, Ferranti, General Electric, GTE,
Holland Signaal, Hughes Aircraft Company, IBM, Lockheed, Martin Marietta, Motorola,
NTT, Philips, Rockwell International, Shell Oil, Symantec, Taligent TRW.
,
.
- Rational .
(DanJoraanstad)
(Tony Hall), ,
. , ,
(), (Annie) (Shadow),
.

, ,
, , .

(Lily Tomlin)

(The Search for Signs of Intelligent Life in the Universe)

, , . : ,
. ,
, . :
, . ,
, . , , .
. :
- ?

1.1. ,

; , ; ,
, .
,
. : ,
, .
: , ,
[I].
, . ,
, ,
. , .
, , ,
. , ,
. ,
, . ,
, .
,
. , , ,
,
;
- ;
(,
).
,
.
, , ,
.
:
. ,
. ,
, , -, .
, , : ,
.
, ,
- ,
.

, , ,
. , : ,
, [2]. ,
,
, .
. ,
, :
?

?
,
[]. :
, ;
; -
;
.
. ,
, ,
, .
,
. ,
, .
( ), , , , ! ' ,
.
-
: ,
, . ,
, .
- ;
, .
, .
, , ,
. ,
. ,
,
, .

. -
, .
, , ,
,
, .

, .
,
.
:
, ,
. , :
;

;

. ,
,
.
.
,
.


,
, ,
.
,
, - . 20
.
,
.
. ,
, .
, .
, ,
. ,
, ,
. ,
.
.
, ; ,

. .
,
, . .

, .
,
,
. .
.
, , ,
. , ,
, ,
.2
.

. ,
,
.
, . ,
, , , . . [4] :
, , ,
.
. ,
,
. ,
, .
. ,
, , ,
, .
- ,
.
, .
, , 38J,
.
,
. , ,
; ,
, .
,
,
.


, [5].
100- . :
. ,
, , . ,
, .
2

.
, .
, ,
,
. , ,
, . ,
, -, ,
.

,

. , ,
, , , . ,

.
, .
, , ,
.

, , .
?
,
. ,
. ,
: Space Shuttle, -,
Microsoft General Electric. ,
.

1.2.
. ()
. :
, , - (
).
. , , ,
() , .
: ,
: , . .
.
.
. , , ,
. ,
.
, .
, , ,
,
() .
, ,
, . ,
,
,
, .
.
, , .
.
, .
: , .
. , , , ,
. . , ,
. , , .

, , . . ,
, ,
.
.
, , -
. ,
. ,
, .
.
, ,

. , .
, .

. . ,
; ,
. ,
. ,
, , ,
.
,
, , .
,
. ,
,
.
.
. ,
[].
. , ,
: , ,
(, ) .
:
. , .
, ,
. , , , ,
. .

, . ,
.
, .
. ,
, .
. ,
, , .
.
, ; , -,
, ,
, .
.
, : ,
, . ,
, , .

.
. ,
. ,
. ,
.
, , .
. .
, , .

, . ,
,
. , ,
, .
.
, , , .


,
. ,
[7]:
1. "
, , . .,
."
: ,
, , ,
[8]. , ,
, .
, ,
. : ,
...
, [9].
?
:
2. , ,
.

.
,
, ,
.
:
3. , .

[10].


.
,
. :
4. , -
[11].

, .
, ,
, , , .
, .
, ,
[12]. [13] :
5.
... , ,
. .
, ,
, . ,
: ,
, .


.
. , ,
,
, , .
, (, ,
), .
, ,
.
,
.
. , , : ,
. . .
. ,
, a Pratt and Whitney TF30
. , ,
;
, , , .
is-a. ,
,
. , 2,
.3

, ,
() , . 1-1.
: .
,
. ,
. , .
. , :

. . 1-1, , .
, .
, 3

.
,
, ,
.

.
.
, ,

, .
: ,
,
, , .
.
. ,
,
? 2, ,
( ) .
, , , -, :
.

, ,
, ,
. .
,

. ,
,
, , .
,
. ,
. , ,
, ,
,
- [14]. ,
. ,
:
5 [15].
, .
, .
?

1.3.

,
divide et impera ( ) [16].
,
.
:
( ).
, , ,
[17].
.
,
, . . 1-2
:
, .
,
.
, [18].
- . , . . 1-3 ,

. Get formatted update (
) Add check sum ( ),
Master File ( ) Check Sum (
), .
, .
,
, ,
. Get formatted update ( )
;

. 1-2.
File of Updates ( ). Update to Card
( ). , ,
.
, .
- , , , - . , ,
- .
: -? ?
, : .
,
, , .
, ,
4. ,
, , ,
.
, .
.
, ,
, . ( 2 7),

. -

, . : . X.
, .
, , .
.
, [34].

. 1-3. -

, . ,
. ,
,
, . ,
,
.
- 8-12
, .
- .


, ,
72 . , , . :
,
, .
,
... [35].
.
:
. .
, , ,
, [36]. ,
,
, . . -
,

. , -
,
.
2 .


, , .
,
.
,
.
. -,
, . -,
.
.
,
. ,
( )
, . 60-70-
, ,
. ,
.
.
,
.
60-70- ,
.
.
FORTRAN COBOL.
, ,
.
:
.
, . , ,
, ,
100 000 [19]. ,
.
[20], [21], TeledyneBrown Engineering [22].
. [23]:
;
;
- .
[24],
[25] - [26]. [27, 28], ,
[29]; ,
[30].
. , , , .
;
.
, , ,
- .
[31, 32],
[33].

. , ,
, ,
,
.
- (object-oriented design, OOD) ,
. OOD ,

, ,
. -
, Smalltalk, Object Pascal, C++, CLOS Ada.


, ,
. ,
,
. :
. , ,
, , ,
.
, ,
.
(, ),
,
[37].
,
,
. , ,
, . 3
, 4
.

1.4.

, , , ,
, , .
: ,
: ,
. , -,

- , [38]. ,
,
,
[39].
,
. .
, ,
, ,
, .
, , ,
,
, ,


. , , ,
,
.
( ) .
, - -
, , ,
.
, -
, , .



, ,
.
,
(, )
;
, ;

;
;
, , ,
,
[40].
:
, ...
[41].
. ,
, .
.
, - ,
, [42].
, ,
. .
,
, - .
, ,
. , ,
-
(), .
.
, ,
.
, .
. , - ,
, ,

.
, .
. , , [43], -
.
.
.
. ,
. , - . ,
, :
;
;
, ,
.
.

.
- . ?
. :
" ?" ,
. :
? ,
, ,
, , - .
- ,
- . , ,
.
. ,
.
,
- ,
. 1-4. -
, .
, ,
,
.
5 . 6
- ,
. 7
- .
-
,
. , ,
.
, ,
: , , , , ,
.

. 1-4. -

,
.
.
; :
, .
.
;
, , .
,
, ;
- ,
,
.
- ,
; -

,
.


, , (Brooks) [ 1975] [ 1987]. (Glass) [ 1982],
Defense Science Board [ 1987], Joint Service Task Force [ 1982]
.
(van Genuchten) [ 1991],
(Guindon) . [ 1987], (Jones) [H1992].
(Simon) [A 1962,1982]
. (Courtois) [A 1985]
. (Alexander) [11979]

. (Peter) [I 1986] (Petroski) [11985]


. (Alien and Starr) [A 1982]
. (Flood and Carson) [A 1988]
.
(Waldrop) [A 1992]
, .
(Miller) [A 1956]
.
. ,
(Ross, Goodenough, and Irvine) [ 1980], (Zeikowitz) [ 1978]
, .
: (Jensen and Tonies) [ 1979],
(Sommerville) [ 1985], (Vick and Ramamourthy) [ 1984],
(Wegner) [ 1980], (Pressman) [ 1992], (Oman and Lewis) [A 1990],
(Berzins and Luqi) [ 1991] H e(NgandYen) [ 1990]. ,
, (Yourdon) [
1979] ( Freeman and Wasserman)[H 1993]. , (Graham) [F
1991] (Berard) [ 1993], -
.
(Gleik) [I 1987] .

- .
: , , , , ,
. ,
.
-
: - ,
,
. ,
, - , , -
. : 1980- -
, 1970-.
. .
, -. . ,
5
[1]. 1990- .
, - ,
.

2.1.

. ,
, :

;
.

, .
, ,
, .
.
, , ( ), ,
( ).

, :
(1954-1958)
FORTRAN I
ALGOL-58

Flowmatic

IPL V

(1959-1961)
FORTRAN II
ALGOL-60
COBOL
Lisp
5

Wegner, P. [J 1981].

,
,
,
, ,

(1962-1970)
PL/I
FORTRAN+ALGOL+COBOL
ALGOL-68
ALGOL-60
Pascal
ALGOL-60
Simula
,
(1970-1980)
, 6 [2].
.
- ,
. , FORTRAN I,
,
. ,
.
.
, ,
. , :
, .
. 60- ,
, ,
. ,
. ALGOL-68 Pascal
. .
.
70- :
.
, , .
( Fred, Chaos,
Tranquil), .
, Smalltalk ( Simula), Ada (
ALGOL-68 Pascal Simula, Alphard CLU), CLOS ( Lisp, LOOPS Flavors),
C++ ( Simula) Eiffel ( Simula Ada).
, , -
.
.
, . . 2-1 ,
. ,
. ,
, FORTRAN COBOL, (
COBOL). , , ,
.
. ,
. -
,
.
- .

, , ... , (. 22:14).
. .

. 2-1.
- ,
, ,
.

. 60-

[]. : , ,
...
1950 , ... ,
... ,
[4].
.
-, , .
-, ,

. -, ,
, .
(. 2-2), ,
. - ,
, ,
.

. FORTRAN II ,
.
, ,
, . ,
(. 2-3). , , ,

. 2-2.
, .
, , ,
. ,
, , , , : ,
, . -
, ,
: , . ,
, ,
, . ,

, .
- .
-: ,
, ,
. ,
, ,
[5]. . -,
,
, . -, ,
, Pascal.
, Simula
1970-1980- , ,
Smalltalk, Object Pascal, C++, CLOS, Ada Eiffel. , ,
-. . 2-4
.
, ,
, .

. 2-3.
: , ,
, - [].
-
, , . ,
.
, ,
.

. ,
, . ,
.
.

, .

(. 2-5). , 1.



. , ,
- ,
.
. ,
,
, ,
-

. 2-4. -

. ,
.
- ,
; ,
. ,

. ,
.
, -
. , , C++ Ada,
, ,
, Pascal.
, ,
. ,
.

OOP, OOD

, , ,
. Smalltalk , C++
, CLOS .

. 2-5.
-
Object Pascal , Ada
. , , , .
.
-, , ,
"", " " " " [7]. ,
, - .
1 , . , ,
[8].
- ,
. :
,
... ,
, , . ,
, . ,
, , . ,
, ,
... ,
[32].

: ""
, , 70- ,
, . ,
,
[9]. , - :


, Simula, Smalltalk, CLU, Ada
,
[10].
, :



.
20
descriptor-based capability-based [ 11 ].

[12]. ,
, : ,
, , , .
- : Burroughs 5000, Plessey 250, Cambridge
CAP [13], SWARD [14], Intel 432 [15], Caltech's [16], IBM System/38 [17], Rational R1000, BiiN 40 60.
- -
(). , THE,
[18]. : Plessey/System 250 ( Plessey 250), Hydra (
CMU C.mmp), CALTSS ( CDC 6400), CAP ( Cambridge CAP), UCLA Secure UNIX (
PDP 11/45 11/70), StarOS ( CMU Cm*), Medusa ( CMU Cm*) iMAX ( Intel 432) [19].
, , Microsoft Cairo Taligent Pink, ,
, -.
-
. Simula 67. Flex
Smalltalk-72, -74, -76 , , -80, Simula,
, . 1970- ,
: Alphard, CLU, Euclid, Gypsy, Mesa Modula. ,
Simula Smalltalk, .
- C++ Objective .
Pascal Object Pascal, Eiffel Ada. LISP, , Flavors,
LOOPS CLOS (Common LISP Object System), Simula Smalltalk.
.
, ,
. [20], 70- ,
[21], [22], [23], .
[24].

[25], - (ER,
entity-relationship) [26]. ER, [27],
, .

- . 1975 .
[28].
.
. ,
, . XVII , [29]. XX
- [30]. ,
[31]. ,
.

- . - (object-oriented programming, OOP)?


:

- ,
,
, .
: 1) OOP
, ( ,
1); 2) - ; 3)
(. is ). . ,
, , OOP,
.
. : -
- , ,
- ...
, . OOP
,
OOP [33]. -
, , Pascal COBOL , .
, : -
, :
, ,
, .
().
() () [34].

is-a (, , ), , ,
. , , -.
, -.
- Smalltalk, Object
Pascal, C++ CLOS, a Ada . ,
, , .
- .
. , ,
. -
:
- ,

, .
: -
1) - ; 2)
, ( )
( ) ,
.
- -
;
, .
OOD, object-oriented design, , .
- .
.
, [35], [36], [37],

[38] [39],
. - ( 00A, object-oriented analysis)
-
.
- ,
, .
, OOD OOP? ,
OOD; OOD
OOP.

2.2.

,
. ,
.
, , ,
[40]. - :
, ,
, , [41].
,
:
-

-

-
,


-

-
. , ,
, -.
-
; ,
, .
.
. .
:



.
,
-. , :


.
, , ,
.
Smalltalk,
Object Pascal, C++, CLOS, Eiffel Ada, -
FORTRAN, Pascal . -
, . ,
.


. ,
. ,
,
, ,
[42]. : ,
, .
, , ,
, [43]. , -
, ,
, ,
[44]. ,
:
,
, ,
.

.
[45],
,
[46].
, ,
, ,
, .

- .
4.
, ,
, ,
[47]. ,
:




,
,


,

,
.
,
( ). ,
, , .
,
[48]:
,
( ).
, - -.
, ,
[49].
, ,
. ,

, ,
, . ,
,
.
.
, ( )

. (
) (, ).
, . ,
,
. , ,
. -
. ,
: ,
,
.
, , -
(Ada, Smalltalk C++ ).
.
, . ,
,
. .
:
, .
, ,
. .
, , ,
,
, . . -
( Smalltalk ). ,
. ,
,
.

. .

( 4),
.
, ,
, .
,
, . : ,
, , ( ) .
,
. ,
,
.
.
. , , ,
, , ,
. ,
, . ?
, ,
, . ?
, ;
, , .
, ,
. ,
? ,
. ?
,
.
C++. ,
,
- , ,
. , ,
C++.
//
typedef float Temperature;
// , typedef unsigned
int Location;
class TemperatureSensor {
public:
TemperatureSensor (Location);
-TemperatureSensor() ;
void calibrate(Temperature actualTemperature);
Temperature currentTemperature() const;
private:

};

Temperature Location
,
.7 Temperature

, typedef
. , C++:
typedef int Count;

. Location ,
.
TemperatureSensor ;
(private) . TemperatureSensor .
, , .
, :
Temperature temperature;
TemperatureSensor greenhouselSensor(l);
TemperatureSensor greenhouse2Sensor(2) ;
temperature = greenhouselSensor.currentTemperature();

, currentTemperature.
, ,
.
: - ,
. , .
,
. :
. ?
.
( ), , .
- :
class ActiveTemperatureSensor {
public:
ActiveTemperatureSensor (Location,
void (*f)(Location, Temperature));
~ActiveTemperatureSensor() ;
void calibrate(Temperature actualTemperature);
void establishSetpoint(Temperature setpoint,
Temperature delta);
Temperature currentTemperature() const;
private:

};

ActiveTemperatureSensor ,
. ,
, ,
. establishSetpoint
,
, ,
actualTemperature setpoint delta.
, ,
.
, -
. , ,
? , : ,
.
ActiveTemperatureSensor ,
.
-.
int. , ,
Ada Eiffel, .

.
, ,
, , .
,
.
,
. ,
. ,
15- 16
78F, 14 , 65F
. , ,
.
, ,
. ,
, .

.
-,
, . ,
- . ,
, . ,
- , .
, , .
, -
.
C++ .
, (, , ,
, ):
// ,
typedef unsigned int Day;
// ,
typedef unsigned int Hour;
//
enum Lights {OFF, ON};
// , 1 14
typedef float pH;
// , : 0 100
typedef float Concentration;

, , :
// ,
struct Condition {
Temperature temperature;
Lights lighting;
pH acidity;
Concentration concentration;
};

, , Condition
, - ,
.

, :
class GrowingPlan (
public:
GrowingPlan (char *name);
virtual
~GrowingPlan();
void clear();
virtual void establish(Day, Hour, const Condition&);
const char* name() const;
const Condition& desiredConditions(Day, Hour) const;
protected:

};

, : ,
. , establish
virtual , .
(public)
( ),
( clear establish) -
( name desiredCondition).
, , ,
.

? GrowingPlan
,
. , ,
, , . ,
. , ,
, .
:
- [50]. , ,
, [51].
:
, .
,
, .
.
, ,
. :
, ,
.
, ;
, [52].
.
, [53]. :
. ,
.
.
: ,
;
, .
[54].


, :
,
; ,
.
. .
,
.
, : ,
. ,
, ,
. ,
, - ,
( ),
, .
, .
, .
//
enum Boolean {FALSE, TRUE};

, -
( ).
, ,
, TemperatureSensor. ,
Heater , C++:
class Heater {
public:
Heater(Location);
~Heater();
void turnOn();
void tum0ff();
Boolean is0n() const;
private:
};

, Heater.
. ,
( ),
. ,
,
, . ,
, ,
.
, .
class SerialPort {
public:
SerialPort();
~SerialPort();
void write(char*);
void write(int);
static SerialPort ports[10];
private:
};

,
.
Heater.
class Heater {
public:

protected:
const Location repLocation;
Boolean repIsOn;
SerialPort* repPort;
};
repLocation, repIsOn, repPort

. C++ , ,
, .
.
Heater::Heater(Location 1)
:
repLocation(1),
repIsOn(FALSE),
repPort(&SerialPort::ports[l]) {}
Heater::Heater() {}
void Heater::turnOn()
{
if (!repls0n) {
repPort->write("*");
repPort->write(repLocation);
repPort->write(1);
repIsOn = TRUE;
}
}
void Heater::turn0ff()
{
if (repIsOn) {
repPort->write("*");
repPort->write(repLocation);
repPort->write(0);

repIsOn = FALSE;
}
}
Boolean Heater::is0n() const
{
return repIsOn;
}

: ,
.
, -

.
. C++,
, ,
(
).
GrowingPlan. , , ,
. , -. ,
,
.
: ,
-, , .
, .
,
. , -
, , - ,
. ,
,
.
.
, ,
.
. , Smalltalk
,
. Object Pascal
,
. CLOS ,
. :reader, :writer : accessor, ,
( , ).
. , ,
, ,
CLOS , ,
, , , [55].
C++ .
, . ;
;
. , C++
(friends), .
: ,
, . ; ,
, - ,
- . ; ,

, , [56]. ,
;
, .
, , ,
.

.
... ,

.
[57]. , Smalltalk, ,
. , Object
Pascal, C++, Ada, CLOS, .
, ,
. ,
.
,
, .
:
[58]. ,
, . ,
.
-. , C++
. C/C++
.h ( -). ,
, . ( C++
., . .).
#include. . Object Pascal .
(unit).
Ada : ( package)
. , Object Pascal,
. , , , .
,
. -, :
,
. (, )
, ( ) [59].
,
.
.
, -, -,
(), , 7400, 7402 7404.
.
( )
,
, .
, . , , ,

. , 12,


.
.
,
.
. ,
[60].
, .

, ,
. -
: ,
.
,
.
,
.
;
;
, [61].
.
: , .
, , .

, , , , , .
(
), .
,
( ).
, , .
,
.
,
:
. ,
: , ,
; ,

. ;
.
[62]. ,
,
. ,
:
, ,
.
, ,
. ,
.
. -,
,
,
. -,
. .

.
, .
.
, ,
.
,
.
. ,
, .
,
, .
, , ,
.
, , ,
( ).
: ,
; ().
, :

.
, . ,
,
, . .
. ,
. , ,

GUI (Graphical User Interface).
, .
, , ,
. C++ -
( gplan.h).
// gplan.h
#ifndef _GPLAN_H
#define _GPLAN_H 1
#include "gtypes.h"
#include "except.h"

#include "actions.h"
class GrowingPlan ...
class FruitGrowingPlan ...
class GrainGrowingPlan ...
#endif


, : gtypes.h, except .h act ions. h.
, gplan.cpp.
, ,
. ,
gplan.h, - GUI.
, ,
.
. -
, ,
,
. , - , ,
, . , ...
[63].

? , ,
, .
- ,
. ,
. .

. :
, .

( is-a) ( part of).
: . - is-a
. (
/),
(, ).
, ,
.
.
, is-a. ,
, .
, -,
.
; , ,
.
, .
.
. ,
.
, .
C++ ,
.

//
typedef unsigned int Yield;
class FruitGrowingPlan : public GrowingPlan {
public:
FruitGrowingPlan(char* name);
virtual ~FruitGrowingPlan();
virtual void establish(Day, Hour, Condition&);
void scheduleHarvest(Day, Hour);
Boolean isHarvested() const;
unsigned daysUntilHarvest() const;
Yield estimatedYield() const;
protected:
Boolean repHarvested;
Yield repYield;
};



, FruitGrowingPlan
Growingplan. repHarvested
repYield, establish.
,
AppleGrowingPlan.

. , . ,
, ,
.
, . :
"
". , -.
.

,
- [64].
,
. :
, ;
, [65].
: ,
, -. ,
:
, , ,
[66].
- ;
C++.
: (private), ; (protected),
; (public), .
: . , FruitGrowingPlan
Growingplan.
. , ,
.
class Plant {
public:
Plant(char* name, char* species);
virtual ~Plant();
void setDatePlanted(Day);
virtual establishGrowingConditions(const Condition&);
const char* name() const;
const char* species() const;
Day datePlantedt) const;
protected:
char* repName;
char* repSpecies;
Day repPlanted;
private:

};
plant , . ,

.
, ,
C++. ,
, ( ).
, ,
, , ,
. ,
. ,
. (Flower) - (FruitVegetable);
Plant. !
, FlowerFruitVegetable,
Flower FruitVegetablePlant.
,
. -.
class FlowerMixin {
public:
PlowerMixin(Day timeToFlower, Day timeToSeed);
virtual ~`````FlowerMixin() ;
Day timeToFlower() const;

Day timeToSeed() const;


protected:

};
class FruitVegetableMixin {
public:
FruitVegetableMixin(Day timeToHarvest) ;
virtual ~FruitVegetableMixin() ;
Day timeToHarvest() const;
protected:

};

.
, ( Mixin)
. , :
class Rose : public Plant, public FlowerMixin...

:
class Carrot : public Plant, public FruiteVegetableMixin {};

: Rose
Plant, FlowerMixin.
, , :
class Cherry : public Plant,
public FlowerMixin,
FruitVegetableMixin...

,
.
. ,
. C++
, Smalltalk , .
, ,
. ,
?
, ,
C++ .
,
.
. ,
, . : B
, .

.
: . is /, part of () . .
class Garden {
public:
Garden();
virtual ~Garden();
protected:
Plant* repPlants[100];
GrowingPlan repPlan;
};

, .
, ,
[67].
, . , Flower
, Plant. part of

,
. Garden , Plant.
, ,
. -
: ,
.
, .
,
. ,
( ). ,
; ,
Plant, . , , GrowingPlan
Garden .
.
.

? .
, , ,
[68]. ,
.8 , ,
. , ,
:

, .
, ,
, .
, [70].
. ,
[71]. ,
, . ,
. ,
.
.
, ,
-. , Eiffel
, ,
.
. ,
Smalltalk : ,
( ) ,
.
. C++ ,
.
,
. , ;
, ,
, . .
// , 0 100
8

; . ,
Trellis/Owl , . Smalltalk SmallInteger,
LargeNegativeInteger, LargePositiveInteger Integer,
[69]. . ,
.

typedef float Level;

typedef C++ . , Level Concentration


float, .
C++ : , , int float
. , Ada Object Pascal
. Ada
.


:
class StorageTank {
public:
StorageTank();
virtual ~StorageTank();
virtual void fill();
virtual void startDraining() ;
virtual void stopDraining();
Boolean isEmpty() const;
Level level() const;
protected:

};
class WaterTank : public StorageTank {
public:
WaterTank();
virtual ~WaterTank() ;
virtual void fill();
virtual void startDraining();
virtual void stopDraining();
void startHeating();
void stopHeating();
Temperature currentTemperature() const;
protected:

};

class NutrientTank : public StorageTank (


public:
NutrientTank() ;
virtual ~NutrientTank() ;
virtual void startDrainingt();
virtual void stopDraining();
protected:

};

StorageTank .
: . WaterTank (
) NutrientTank ( ) StorageTank,
- : , WaterTank ,
.
, :
StorageTank si, s2;
WaterTank w;
NutrientTank n;

, s1, s2, w n
. , ,
: s1 StorageTank,
s1. .
, C++ . ,
, ,
. , :
Level 1 = s1.level ();
w.startDrainingt();
n.stopDraining();

, ,
. , :
sl.startHeating(); //
n.stopHeating(); //

, .
n.fill();

: fill NutrientTank,
.
, ,
, . . ,
.
, , 3 9,
, . ,
, , . C++: -,
void, .
class Inventory {
public:
Inventory();
~Inventory();
void add(void*) ;
void remove(void*);
void* mostRecent() const;
void apply(Boolean (*)(void*));
private:

};

apply , . . .
Inventory,
.
(), ( ),
. ,
WaterTank TemperatureSensor,
mostRecent WaterTank StorageTank.
, . -,
, .
void, ,
TangibleAsset ( ),
, , ,
WaterTank, GrowingPlan. ,
. -,
, , , .
, Smalltalk . C++
, , ,
, ( ).
,
. ,
, .
,
. , . :
s1 = s2;
s1 = w;

, ,
.
( C++ ),
w, WaterTank, , s1, StorageTank.
:
w = s1; //
w = n; //

, ,
.
. , :
void checkLevel(const StorageTank& s);


, WaterTank.
:
if (((WaterTank&)s).currentTemperature() < 32.0) ...

, .
, s NutrientTank,
. ,
, .
:

.
-- ,
.
.
,
[72].
, , ,
, : ,
[73]. ,

,
.
: .
. ,
( ) ,
. ,
;
( ) ,
.
, : ,
(Ada), , (C++, Object
Pascal), , (Smalltalk). CLOS
C++ Smalltalk: , ,
, .
C++. ,
- , :9
void balanceLevels(StorageTank& s1, StorageTank& s2);

StorageTank
,
StorageTank.
- :
if (s1.level() > s2.level ()) s2.fill();

level?
StorageTank, , ,
, .
, .
fill. StorageTank WaterTank,
. s2
WaterTank, , NutrientTank, StorageTank.
C++ ; fill
, , WaterTank::fill StorageTank::fill.10
:
, , , ,
[74]. ;
(Ada).
,
. -
( ),
. , ,
- .

? ,
.
.

. ( )
. ,
: ,
.

, . -
, Smalltalk, , - .

10

C++ .

,
.
,
.
,
. .
, .
, .

,
- . , UNIX
fork, . Windows NT OS/2
;
.
, ,
OOP . OOP ,
[75]. ,
, ,
, , . .
, : OOP
, -
[76]. . :
, (1)
(2) [77].
, - ,
,
[78]. , :
( )
( ). . ,
OOD, ,
,
. :


, .
. ActiveTemperatureSensor,

,
. , .
, , ,
. - .
-, . , Ada .
Smalltalk process, .

Actors, Orient 84/K, ABCL/1,
. ,
.
-, , -
. , AT&T C++
Shed, Timer, Task . . , , ,
.
(, , ),
.
, -, .
- . ,
ActiveTemperatureSensor ,
, , ,
.
, ,
, ,
. , ,
- , , , ,
.
, . , , ,
.

. .
, :
, ,
, , .
:
.
.
( ALGOL-60),
.
, .
, .
, [79].
, ,
. :

,
[80].

. , -,
-
(OODB, object-oriented databases).
, , ,
, -
,

, .
10, ,
, , ,
, .
, , -;
Smalltalk,
. ,
- , . ,
() OODB [81].
- ; ,
, , .
10.
. OODB
, , .
, ,
.
.
,
.
, ,
.
12.
:
,
, () ,
.

2.3.

, ,
,
. ,
. ,
, .
, . ,
,
. , ,
.
-,
- .
: , ,
C++.
C++ "


C'' .
. OOD
C++ [82]. ,
, Smalltalk, Object Pascal, C++, CLOS Ada ,
, .
-,
,
, [83]. -
, -
. ,
, .
-,
, .

.
-, 7 ,
, ,
, .
,
.
, , ,
, , , ,
- [84].



. . 2-6 , .
.
-
, , .
, , OOD ,
, - .
7.


,
:
?
?
- ?
- ?
OOD?
.

, ,
.
, ,
, , .
,
, ,
.
;
,
.




. 2-6.
,
.

.

, .
, .
() .


(Jones) [F 1979] (Williams) [F 1986]. () [F 1969]
- .
(Shaw) [J 1984] .
(Liskov and Guttag) [H 1986], (Guttag) [J 1980] Hilfinger [J 1982].
(Parnas) [F 1979] .
(Pattee) [J 1973].
- .
(Cardelli and Wegner) [J 1985] (Wegner) [J 1987]
- .
(Stefik and Bobrow) [G 1986], (Stroustrup) [G 1988], H(Nygaard)[G 1986]
(Grogono) [G 1991] . () [G 1986],()[F
1988],(Schmucker) [G 1986] (Kim and Lochovsky) [F 1989]
.
- (Booch) [F 1981,
1982, 1986, 1987, 1989]. -
(Shiaer and Mellor) [ 1988] (Bailin) [ 1988].
- ;
, (Rumbaugh) [F 1991], (Coad
and Yourdon) [ 1991], (Constantine) [F 1989], (Shlaer and Mellor)
[ 1992], (Martin and Odell) [ 1992], (Wasserman) [ 1991],
(Jacobson) [F 1992], (Rubin and Goldberg) [ 1992], (Embly)
[ 1992], - (Wirfs-Brock) [F 1990], (Goldstein and Adler) [ 1992],
- (Henderson-Sellers) [F 1992], (Firesmith) [F 1992]
(Fusion) [F 1992].
(Taylor) [H 1990,
1992], (Berard) [H 1993], (Love) [ 1993] (Pinson and Weiner)
[ 1990].
-
(Peterson) [G 1987], (Schriver and
Wegner) [G 1987] (Khoshafian and Abnous) [I 1990].
-
. OOPSLA, , TOOLS, Object Word
ObjectExpo.
, : Object Management
Group (OMG) ANSI X3J7.
C++ (Ellis and Stroustrup)
[G 1990]. : (Stroustrup) [G 1991], (Lippman) I [G
1991] (Coplien) [1992].


, ,
. -
.
.
, ,
.

3.1.
?

.
, , , , ,
: ,
.
: ,
. :
, .

, [1].

, .
:
() ;
, ;
, .
,
:
.
Simula
[2].
,
.
,

[]. , :
" ,
( ),
" [4].
,
[5].
,
, ,
. : , ,
. . ,
: , , .

,
. -

. .
,
;
.
,
,
. ,
, ,


.
CAD/CAM. , , ,
.
,
.
,
:
, .1 ,
-

,

,
. , ,
, . ,
, , , , (, ). ,
- , . ,
, , ()
( ), ( ) - .
, - ,
, ,
1

. ,
, " " " ". ,
: -
.

.
:
, ;
;
" " "" .

. , .
,
. ,
, ?
,
.
, ( ),
, . ,

" , "
.
.
,
:
.
, .
, , ,
. -
.

:
(
) (
) .

. () , , . ,
,
.
, .
(,
),
" ".

, , ,
. , ,
, .
, , ,
. " ",
.
.
,
, , .

.
.
,
. 3,
, .

, ,
. - ,
( , ,
).
,
: (, 3)
", ",
" , , ,
, " [].
, , ,
(
).
. , C++
.
:
struct PersonnelRecord {
char name[100];
int
socialSecurityNurober;
char department[10];
float salary;
};


.
, , - .2
,
:
PersonnelRecord deb, dave, karen, jim, torn, denise,
kaitlyn, krista, elyse;

,
.
( ),
.
,
, . ,
:
class PersonnelRecord {
public:
char* employeeName() const;
int employeeSocialSecurityNumberf) const;
char* employeeDepartment() const;
protected:
char name[100];
int socialSecurityNumber;
char department[10];
float salary;
};

,
.3 ,
2

, C++,
, . , -
.
3
: , ,
PersonnelRecord - .
. ,
char*, ,
: ,

.
, ,
( ).
,
,
. , ,
, (
, )
.
.
.
,
, .
,
, .
, - ,
, ,
. ,
.

. ,
.
- , ;
.
, -
.

. ,
append pop , ( ). length,
,
. - , Smalltalk,
.
C++, , ,
- .
,
.
.
- ,
,
. C++ -.
.
- ,
. ,
. .
, .
, .
, (
). ,
, .
,
, , 9.
: - C++;
4,
.

,
: .
:

.
, :
.
. C++ Queue ():
class Queue {
public:
Queue();
Queue(const Queue&);
virtual ~Queue();
virtual Queue& operator=(const Queue&);
virtual int operator== (const Queue&) const;
int operator!=(const Queue&) const;
virtual void clear();
virtual void append(const void*);
virtual void pop();
virtual void remove(int at);
virtual int length() const;
virtual int isEmpty() const;
virtual const void* front() const;
virtual int location(const void*);
protected:

};


void*,
. -
, ( ) .
, void* "" ,
. ~Queue () ,
. ,
.
Queue , ,
, :
Queue , b, , d;

:
.append(&deb);
.append(&karen);
a. append (&denise);
b = a;
.pop();

( karen),
b - ( deb). ,
, - ,
(pop) , - .
. - ,
.

.4
:

, .

, ,
.

,
.
,
,
. Queue
(- const - clear, append, pop,
remove), ( const - length,
isEmpty, front location). 9, ,
, ,
.
;
,
:

/
.

,
/ .
C++
, Smalltalk CLOS
( ).
- , Smalltalk,
,
. , Object
Pascal, C++, CLOS Ada
. C++ -;
.
- ,

. ,
.
. , Queue
:
void copyUntilFound(Queue& from. Queue& to, void* item)
{
while ((!from.isEmpty()) && (from.front() != item))
{
to.append(from.front()) ;
from.pop();
}
}

,
, .
; -
Queue.
C++ ( Smalltalk)
,
. .
4

: ,
, ( )
( ) [7].

, , - ,
- :
. , ,
, ,


, .
.
, ,
. , , ,
.

, . ,
- , [8];
.
, . "
- , , ,
.
.
" [9]. ,
, ,
, .

, [10]:
(
), ,
.
- ,
,
.
, ,
.

. ,
, .
.
4 6,
, .
, ,
- .
.
, .

[II]. ,
,
. 5
,
.
, ,
.
, - . ,

. , ,
. ,
- .

,
.
, , ,
.
: ,
. (
) ,
.

.
:
" - ,
" [12].
, "
,
.
,
".
-
.
. .
struct Point {
int x;
int ;
Point() : x(0), (0) {}
Point(int xValue, int yValue) : x(xValue), y(yValue) {)
};
point , .

, , .
-
, . ,
,
, .
point - (,).
: ,
- .
(Displayltem).
(GUI) -
, .
- , . ,
, ,
.
C++:
class Displayltem {
public:
Displayltem();
Displayltem(const Point& location);
virtual ~Displayltem();
virtual void draw();
virtual void erase();
virtual void select();
virtual void unselect();
virtual void move(const Point& location);
int isSelected() const;
Point location() const;
int isUnder(const Point& location) const;

protected:

};

,
, .
.
, ,
.
draw. ,
. , , isUnder,
, ,
- .
:
DisplayItem item1;
Displayltem* item2 = new DisplayItem(Point(75, 75));
Displayltem* item3 = new Displayltem(Point(100, 100));
Displayltem* item4 = 0;

. 3-1 ,
. ,
item1, item2, item3, item4. iteml
Displayltem, .
, item2 item3
Displayltem. , item2 item3,
, ""
: , *item2. , item2
Displayltem,

. 3-1.

*item2.
( )
, .
:
, ?
(. 3-1 ):
item1.move(item2->location());
item4 = item3;
item4->move(Point(38, 100));
iteml , item2,
. item4
, item3. ,
" item2" ", item2".

,
.
item1 , item2,
, . ,
*item3,
item4. , ,
,
.
- .

" ",
, , , . ,
item3,
item4 ; .
. 3-1 :
item2 = &item1;
item4->move(item2->location());
: item2
, iteml. iteml

. , , - ,
item2,
, , . Smalltalk CLOS ,
, .
C++ ,
, .
, , ,
.5
, .
, .
-
. , :
void highLight(DisplayItem& i);
void drag(DisplayItem i); //

iteml,
:
i ,
iteml i
. iteml
, iteml: i
, , iteml. C++
.
, ,
.6 ,
C++ .
,
, , ,
, (
, ).
, ,
. C++
. ,
, ,
Displayitem:
Displayltem(const Displayltem&);

C++ (
) ( ).
,
5


.
. ,
, , .

.
6
Smalltalk
C++.

, . ,
,
,
. :
,
,
.
,
"" "" . ,
Smalltalk shallowCopy ( ,
) deepCopy (
, - ).
, ""
, "" .
- , , . C++
. ,
DisplayItem :
virtual DisplayItem& operator=(const Displayltem&);

, ,
.
, "" "".
,
.
.
, . -,
. -,
. . 3-1
iteml item2.
item2 item3 .
C++ ,
,
:
virtual int operator=(const Displayltem&) const;
int operator!=(const Displayltem&) const;

(
, ),
( ,
:
).

>= <=.
.
( ),
- .
. .
-, ( item1):
. -, item3,
, "". C++
,
. Smalltalk
, .
. ,
C++ . ,
-:
, .

C++
, . C++
new,
"" .
Smalltalk
. ,
C++, , , ,
, , ""
new, :
delete. "", ,
, , .
(, ),

.
C++
. ,
, , , .7

. ,
-; ,
.
,

- .

" ". ,
, .

3.2.

:
.
: " ,
, ,
" [13]. , ,
" ,
,
" [14].
.
,
: ,
, .
:

.

"/" [15].

, new,
.

. ,
"
" [16]. ,
. , -
, -
.
. 3-2 .
.
( ) .
aController Displayltem
( ). , , , aView,
.
.

( ; ).
5,
.8 ,
(
aController), . ,
aController move ,
,
isUnder b, .
,
:
9 ,
;

. 3-2.

,
,
; , -
- - .
. 3-2 aController , -
aView - .
8

, . 3-2,
, . Smalltalk
MVC, model/view/controller
(//). ,
.
9
Actor - , . , . ..

.
.
, .
;
, .
,
. ,
.
//
typedef unsigned int Minute;
TemperatureRamp,

:
class TemperatureRamp {
public:
TemperatureRamp() ;
virtual ~TenperatureRamp() ;
virtual void clear();
virtual void bind (Temperature, Minute);
Temperature TemperatureAt(Minute);
protected:

};

,
, , .
,
. , , ,
60- 250F, 180- - 150F.
, 120- ?
,
.
, ,
, .
,
: TemperatureRamp, .
TemperatureController :
class TemperatureController {
public:
TemperatureController(Location);
~TemperatureController();
void process(const TemperatureRamp&) ;
Minute schedule(const TemperatureRamp&) const;
private:

};
Location 2. ,


.
process ;
- ,
. , :
TemperatureRamp growingRamp;
TemperatureController rampController(7) ;
:
growingRamp. bind (250, 60);
growingRamp.bind(150, 180);
rampController.process(growingRamp) ;

rampController - ,
, growingRamp
. , rampController
growingRamp .
.
, - ,
.
schedule , .
TemperatureController ,
,
.
(, ) ,
,
. schedule,
TemperatureController,
.
. .
, , - .
,
, .
rampController
growingRamp,
, growingRamp rampController
.
.
.
( )
.
.
.
-
.
.
, , , , .

(. ).
,
, .
,
.
, :
-
.
-
,
.
-
;
.
, , .
9 .

. ,
"-" ,
,
, , (),
(). -
. . 3-3 rampController

. 3-3.
growingRamp h Heater
(). rampController - , a h- .
, h - rampController.
rampController, . h
( ),
h.

, . , ,
. , -
, .
, . ,
, , ,
.
- -
. ,
. ,
. , .
, (),
.
.
. TemperatureController
:
Heater h;

TemperatureController
. Heater

,
.
TemperatureController :
TemperatureController::TemperatureController(Location 1) :
h(1) {}

3.3.
?
,
.

,

. ,
,
. ,
"", ,
.
" - " " - ".

: ",
, , ,
" [17]. -
:
- ,
.
.
? ,
, . ,
, ,
, , .
, ,
, ,
. ,
. ,
,

, , .10
- ()
. [18]. ,
, 5,
.


[19] [20]
:

. ,
.
, -
.
,
.

, , ,
. - ,
. ,
, , ,
. , ,
, .
, .
:
(public) - ;
(protected) - ,
(friends);
(private) - .

.
, .
, C++
. ,

.
, , , .
Ada . Smalltalk
- , - . Object Pascal
, . CLOS
, ,
.

, .
, .
,
, .
: .
, , :
10

,
.
- ,
. ,
, ,
. , .

Displayltem item1;

, .
,
, , . ,
.
, ,
. Smalltalk
, Object Pascal - , C++ - , CLOS - .
.


,
. (
DisplayItem
TemperatureController)
, . ,
,
, ,
,
. 5,
, .

3.4.

: ,
, , , .
:
- .
- () .
- .
.
,
.
, , ,
.
,
[21].
. -,
- . , , -
: , ,
. -, -
. , ,
. ,
. -
:
, , , .
[22]. , "/" ( ),
"is-a". , :
,
"". , "/ ", "part of". ,
. -, ,
, . , -

, , . : - ,
.

. ,
:





.
,
,
. , [23].

. 6,
, ,
- .
, ,
. . ,
, ,
. ,
.
,
. Ada, Eiffel C++,
, , ,
. "" ,
Smalltalk

. 3-4.
CLOS. - ,
.

. ,
- . . 3-4
, . Product - ,
, Sale - ,
. , :
, , ,
, , .
C++ ,
[24].
:
class Product;
class Sale;
class Product {
public:


protected:
Sale* lastSale;
};
class Sale {
public:

protected:
Product** productSold;
};

"--":
,
Sale .
. ,
- . , (
, , ,
) ,
( , ,
).
. , , (
) .
. "
". ( , ,
).
:
"--"
"--"
"--".
"--" .
,
Sale CreditCardTransaction:
.
"--" . ,
Customer ()
Saleperson ( ),
.
5, .

.

(, )
( , -, ,
. .).
. ,
, (
)
.
,
:
class Time...
struct ElectricalData {
Time timeStamp;
int id;

float fuelCelllVoltage, fuelCell2Voltage;


float fuelCelllAmperes, fuelCell2Amperes;
float currentPower;
};

. -,
ElectricalData ,
, timeStamp currentPower
(, ,
). -,
, (
) .
, , . ,
, ,
. ,
.
( ,
. .),
. , ,
-


,
. ,

- , -
.

,
.
.
,
;
, :

class TelemetryData {
public:
TelemetryData() ;
virtual ~TelemetryData();
virtual void transmit() ;
Time currentTime() const;
protected:
int id;
Time timeStamp;
};

, ,
( ) transmit
currentTime, . id
timeStamp -
. , currentTlrne ,
timeStamp ( ).
ElectricalData:
class ElectricalData : public TelemetryData {
public:
ElectricalData(float vl, float v2, float al, float a2);
virtual ~ElectricalData();
virtual void. transmit();
float currentPower () const;
protected:
float fuelCelllVoltage, fuelCell2Voltage;
float fuelCelllAmperes, fuelCell2Amperes;
};
- TelemetryData,

( ), -
( transmit). ,
currentPower.
. , -
,
( )
( ) . ,
, . , TelemetryData.
ElectricalData.
. ,
.
ElectricalData
TelemetryData. ,
.
- .

. ,
GuardedQueue Queue ,

. :
UnselectableDisplayltem
Displayitem, .
, .
TelemetryData
. 3-5. .
, Cameradata - SensorData,
TelemetryData.
,

[25]. 4 ,
- .
, . 3-5
, - .
-

. 3-5.
ElectricalData SpectrometerData (
,
). ,
(SensorData TelemetryData), .
, , .
,
, . Smalltalk
,
SubclassResponsibility.
,
. , C++
. ,
.
.
,
. ,
C++, -
,
.
,
. Smalltalk object.
[26]:

.
[27]. ,
-,
. ,
C++: ,
, .
Smalltalk :
, , (
, ).

.

. , , -
, .
,
. ElectricalData
(id timeStamp)
(fuelCelllVoltage, fuelCell2Voltage,
fuelCelllAmperes, fuelCell2Amperes).11
.
ElectricalData
currentTime ( ), currentPower (
) transmit ( ).
,
. Smalltalk
.
C++ . ,
( transmit ),
, (currentTime) - .
. transmit
TelemetryData :
void TelemetryData::transmit()
{
// id
// timeStamp
};
ElectricalData :
void ElectricalData::transmit()
{
TelemetryData::transmit();
//
//
};


TelemetryData:: transmit ().
(id timeStamp),
.
:
TelemetryData telemetry;
ElectricalData electrical(5., -5.0, 3.0, 7.0);

:
void transmitFreshData (TelemetryData& d, const Time& t)
{
if (d.currentTime() >= t)
d.transmit() ;
);

, ?
transmitFreshData(telemetry, Time(60));
transmitFreshData(electrical, Time(120));

.
,
, .
? transmitFreshData
, d,transmit ()!
. d .
11

- ,
, .

, ,
, .
, "
Pascal , ,
, .
,
.

" [28]. ad hoc
[29], -, ,
"+", .
. , C++
,
.
; Ada
.
, .

case switch. , Pascal
;
,
. ,
. Pascal TransmitFreshData
:
const
Electrical = 1;
Propulsion =2;
Spectrometer = 3;
Procedure Transmit_Presh_Data(TheData : Data; The_Tiime :
Time);
begin
if (The_Data.Current_Time >= The_Time)
then
case TheData.Kind of
Electrical:
Transmit_Electrical_Data(The_Data);
Propulsion:
Transmit_Propulsion_Data(The_Data);
end
end;

,
,
case. ,
.
,
. ,
" ,
" [30].
, .
, .
Ada, , -
.
.

. C++
.

, , ,
. ,
. .
.
transmit:
void ElectricalData::transmit()
{
TelemetryData:: transmit ();
//
//
};

-

- . ,
,
. Smalltalk
super,
self. C++
,
, (
TelemetryData:: transmit () ).
this.

.
.12
. 3-5
. , ElectricalData TelemetryData.
, ,
--


(. 3-6),
circle, Triangle Rectangle. Rectangle
- SolidRectangle. ,
DisplayItem theCenter (
), :
draw -
move -
location - .
location
. ,
, , draw move
.

12

CLOS
: before,: after : around.
,
. Before- , after- -
, around-- ,
call-next-method.

. 3-6. Display Item

Circle theRadius
(set) .
draw
theCenter. Rectangle theHeight
theWidth .
draw
theCenter.
SolidRectangle Rectangle, draw
. draw
, .
:
Displayltem* items[10] ;
for (unsigned index = 0; index < 10; index++) items[index]->draw() ;
draw .
,
DisplayItem. ,
. -
draw. ,
,
,
. , .
Smalltalk ,
. draw
, :

;
, ;
, .
,
object, "" .
, doesNotUnderstand,
, .

. ,
, . Smalltalk
1.5 , .

Smalltalk 20-30%
[31].
draw solidRectangle
. ,
Rectangle. Smalltalk
super. super draw
.
,
85% ,
[32]. ,
,
[33]. ,
.
, C++,
.
,
.
C++
(virtual),
. draw - , a location . ,
.
(inline), ,
.
C++
vtable ( ),
( ).
. ,
Rectangle
draw,
draw. DisplayItem
rotate, Rectangle ,
rotate
DisplayItem.


[34].
draw SolidRectangle
C++. draw ,
, .
:
Rectangle::Draw();
,
[35].

-
;
.

CLOS, : : before, : after, :
around.
. CLOS, ,
:
.
.


.
: before.

.
: after.
[36].
CLOS ,
. , ,
. : ",
CLOS, ,
,
, " [37].
, C++. Smalltalk,
, .
,

. C++:
TelenetryData telemetry;
ElectrycalData electrical (5.0, -5.0, 3.0, 7.0);

:
telemetry = electrical; //electrical -
telemetry

, :

. , ,
electrical, ,
telemetry acca TelemetryData.
:
electrical= telemetry; //: telemetry-
electrical

,
-, y
.

,
,
/. C++ ,
. ,
,
.
,
.
.
,
()
.13
,
. ,
, set bag,
. (
, void*, ,
Queue). ,
13

C++,
, .

, .
,
- , , ,
,
.
, -
.

,
. , C++,
, .
. -
. :
"
- ,
,
, , " [38].
.
, ,
- .
, : "
, ,
, .

. :
,
" [39]. Smalltalk CLOS
. C++ . ,
public ( ElectricalData ).
,
,

.
private, ,
, ,
-.14 ,
,
. , ,
, ,
( ) .
:
class InternalElectricalData : private ElectricalData {
public:
InternalElectricalData(float vl, float v2, float al,
float a2);
virtual "InternalElectricalData() ;
ElectricalData::currentPower;
};
ElectricalData .
, , , , transmit,
. InternalElectricalData
ElectricalData,

,
14

, ,
,
.

. , currentPower
. .
, C++
" ", . , timeStamp,
TelemetryData ,
(
currentpower).
Ada
.
, .
,
, .
,

.
. ,
, ,
. , : "

.

. ,
,
; -
" [40].
C++
CLOS, , , Smalltalk.
OOP .
, - : ,
, , , ,
.
,
- ,
, .
. ,
,
- .

. - ,
( , ,
). - ;
.
,
, 15.
. 3-7. Security (
) InterestBearingltem
( ) Asset (). ,
15

, - " " .
, ()
(
,
) ,
,
- .
, ,
, .

BankAccount ( ) :
Insurableltem () Asset
InterestBearingltem.

C++. :
class Asset ...
class Insurableltem ...
class InterestBearingltem ...

;
:
class BankAccount :

class RealEstate :
class Security :

public
public
public
public
public
public
public

Asset,
Insurableltem ,
InterestBearingltem ...
Asset,
Insurableltem ...
Asset,
InterestBearingltem ...

,:
class SavingsAccount : public BankAccount . . .
class CheckingAccount : public BankAccount ...
class Stock : public Security ...
class Bond : public Security ...

. 3-7.
, .
-

.
,
( ) .
, Asset, Insurableltem
presentValue, .
RealEstate ,
? , ,
:
.

. -,
(
Smalltalk Eiffel, Eiffel , ).
-, ,
( CLOS). ,
, ,
. C++.16
, ,
: "
,
. ,
- D, ,
, , .
, " [41].
:
class MutualFund :

public Stock,
public Bond ...
security.

. , , .
Smalltalk Eiffel ( Eiffel, -
). -,
,
- ( , C++). -,
,
. C++,
.
, -
,
, - (shared) . , CLOS
"" ,
.
,
:
;

.
,
,
[43].
. ,
.
,
- .
(, ), .

(mixin). Flavors:
() ,
. : "
, .
" [44]. . 3-7
Insurableltem interestBearingltem - .
16

C++
. -
.

,
.17 , - ,
, - ,
.
. ,
, .

. DisplayIem:
virtual void draw();

.
, ,
. - ,
, , , (. ).
,
, , , .
draw
, .
,
, - .
, , drawGraphic drawText,
, . , ,
,
Displayltem.
CLOS . ,
(,
). C++ ,
.
,
DisplayDevice,
Displayltem :
virtual void draw(DisplayDevice&);

,

Displayltem, : draw
,
Displayltem ,
,
DisplayDevice .
.

.
.
TemperatureController:
class TemperatureController {
public:
TemperatureController(Location) ;
~TemratureController();
void process(const TemperatureRamp&);
Minute schedule(const TemperatureRamp&) const;
17

CLOS
, : before- : after.

private:
Heater h;
};

. 3-8.
. 3-8, TemperatureController ,
, , Heater - .

. 3-3.
. TemperatureController
;
, Heater
TemperatureController.
.
TemperatureController :18
Heater* h;

TemperatureController -
, , Heater, .
:
.
-
,
. , - .
,
"/". Heater TemperatureController,
. "",
- (
).19
, ,
, , . ,
, . ,
,

.
. , Shareholder ()
.
. " "
: ( )
18

h
(Heater& C++),
.
19

. ,
,
,
.

. 3-9.
"/" ,
.
.
, C++ ( )
.
, - -
. , (is
), - .

. rampController
growingRamp ,

TemperatureController TemperatureRamp.
class TemperatureController {
public:
TemperatureController(Location) ;
~TemperatureController();
void process(const TemperatureRamp&);
Minute schedule(const TemperatureRamp&) const;
private:
Heater h;
};
TemperatureRamp -

process;
, TemperatureController
TemperatureRamp.
.
. ,
, , ()
(). -
. 3-9.
, -.
.
, TemperatureController
schedule , , Predictor
(). ,
TemperatureController, .
,
-
.
,
.

,
, , "" C++.

. Queue
() ,
.
, ,
C++ Eiffel.
Template<class Item>
class Queue {
public:
Queue() ;
Queue(const Queue<Item>&);
virtual ~Queue();
virtual Queue<Item>& operator=(const Queue<Item>&);
virtual int operator==(const Queue<Item>&) const;
int operator!=(const Queue<Item>&) const;
virtual void clear();
virtual void append(const Item&);
virtual void pop();
virtual void remove(int at);
virtual int length() const;
virtual int isEmpty() const;
virtual const Item& front() const;
virtual int location(const void*);
protected:

};
void*,
item,

.
,
-. -
:
Queue<int> intQueue;
Queue<DisplayItem*> itemQueue;
intQueue itemQueue -

, .
, Queue.
, 9,
. ,
DisplayItem, , "",
.

. 3-10.
.
C++
- , , DisplayItem.
Queue,
DisplayItem itemQueue
. 3-10.
.
, Queue. -,
. C++,
, , "
" [45], ,
,
. -,
, Smalltalk [46].
,
;
.
Object Pascal,
, ,
.
, Smalltalk, ,
. ,
, CLU.
-
; ,
.
. C++ Eiffel.
. 3-10,
Queue ,
, DisplayItem.
.
, - ,

, [47]. ,
, , .

. ,
[48].

. ,
. ,
,

. C++
,
. ,
, .
( Item),
(
). - Item ,
. ,
, ,
.

, -
. ,
? , ?
- . , - ,
.
- . , Smalltalk
CLOS, C++.
: "
. ,
, , ,
, " [49].
Smalltalk -
(
),
[50]. , Smalltalk
. , .
3-11, nextId
TelemetryData,
TelemetryData. ,
,
, ,
.
C++ ,
, ,
. C++ ,
. , C++
(static), :
. C++
Smalltalk. -
Smalltalk.
, CLOS
Smalltalk. :
, . -
,
.

. 3-11.
CLOS standard-class,
,
defclass. makeinstance, . ,
. .
CLOS
. ,
, ,
, .
standard-method,
standard-generic-function.
,
.

3.5.

- , .
, - ;
.
,
. ,
. ,
, .

.
- , ,
.
.
, , ,
, ,
.
, , .
.
, . ,
, .

,
.
, ,
.

( ), -
( ).

.
: .
, ,
,
.
: ,
.

3.6.

"
;

" [51]. -
,
,
.
,
, .
. 4
7 , ,
. ,
,
. , ,
,
.
, ,
:




.
,
-
. ,
" .

.
" [52].
-,
,
[53].
-
, .
.

, ;
, ,
, .

. -
( OOD ),
.
,
. ,
.
,
.
, , Dog ,
, , , .

, .

. ,
.
set ().
, , ,
.
, ,
.
.
,
. ,
.
, ,
,
. .
,
. , set Add
( ) ,
,
. ,
. ,
, . ,
,
,
.20

?
. . ,
, , ,
, .

.

, .
. ,
. .
:
20


( ). - . .

,
;
, .
"
( ) (
)" [54].
-
,
. ,
, , .
0'
:

?


?


, ?


?
, ,
. Object Pascal, C++,
CLOS Ada
( ). , C++, -
, .
,
.
,
.
. ,
,
.
,
, - .
,
, -
. ,
, .
,
,
. ,
.
, ,21
, ,

. , ,
, .

, ,
.
:
21

Ada Smalltalk . C++


,
( ):
AT&T C++.



;


, , ,
, ,
, , ,



.
,
, .


.
. , X Y
M, Y,
.

. ,

(, ).
, .
,
, "
, ( ) .

" [56].
, .

.
,
, ,
.
.
[57].
, [58].
. ,
, , , ,
.
"" ,
.
.
,
. , Car ()
, Engine () wheel
()? .
, "
,
" [59]. ,
- , ,
.
.
. ,
. , ()
. ,

.
, , ?
,
. ,
, .

.
( ):
, .

. ,
X () Y ():
;
;
;
.
. Y
. Smalltalk
.
,
:
.


()
.
:
.
.
().
(, )
.
: "
.
" [60]. ,
, , .
-
/ ? ,
, , .
,
,
.


. , , Cone ()
volume (). .

.
volume [60]?
,
. ,
.
.
.
.
. Smalltalk

, .
Object Pascal, C++, CLOS Ada
.

.
.
, , ,
, . -
, .
, : "
.
( ),
.
,
" [61].

, .

.

.

( )
.
- .

.

.
: ,
, , ,
.
, ,
.
,
, .
, ,
, .


(MacLennan) [G 1982]
. () 1987]
.
,
. (Albano) [G 1983],
(Allen) [A 1982], (Brachman) (J 1983],
(Hailpern and Nguyen) [G 1987], (Wegner and Zdonik) [J
1988]
. (Cook and Palsberg) U 1989]
(Touretzky) [G 1986] .
(Wirth) [] 1987]

Oberon. (Ingalls) [G 1986]


. (Grogono) [G
1989] ,
(Ponder and Buch) [G 1992]
.
() [G 1988] '
(Halberd and O'Brien) [G 1988]. (LaLonde and Pugh) U 1985]

.

- (Rubin and Goldberg) [ 1992], , (Wirfs-Brock, Wilkerson and Wiener) [F 1990].
(Coad)[F1991].
() [G 1986]
Eiffel. (Stroustrup) [G
1988] C++.
CLOS ,
(Kiczales, Rivieres, and Bobrow) [G 1991].
, ,
, .
(Stein) [G 1987].

- . -

, .
, ,
. , "
", " ".
, .
: "
?" ,
C++, : " . ". ,
CLOS, : " , .
" [1]. , ,
- .
()
. .

4.1.
-

-
- . ,

.
,
.
, ,
. -
.
. ,
, .

, , - .
: "

.
" [2].
.
, -, "
, , ,
, ,
"
[].
,
- .
, .
, ,
.
.
,
; - .

.
, .


. 3
, . .
. , .
, .
, ,
- . ,
. - ?
, , , ?
, , ?
, ?
, - ,
.
- ,
: .
XVIII
.
, ,
. XVIII
:
. ,

- .
. ,
" , ,
, .
? ,

- " [4].
"" "

" [5]. , , : (), ,

(), , , , . ,

.
,
, ,
, . ,
, ,
. ,
[].
, ,

. . : "
,
: , 2 . ,
5 50 ." [7]. ,

. , " ,
. ,
, ,
, " [8]. ,

.
[9].
, , , .
-
. XVII .
,
. , 1789 .,
, 23 , ,
.
, . , 1869 .
,

.
. XX .
, .
. : " -
, , " [10].
, , ,
.
.
, "" ,
,
, .
, -
- , .
,
,
. ,
" - .
ad hoc, -,
.
, , ,
. ,
. ,

, ,
.
,
, , ad hoc,
" [11].


.
- ,
.

-
,
,
. ,
(),
(), , ,
(). ,
, ,
() [12].
?
. -, "" , ,
, . ,
, "
, " [13].
.
: " ...
, - ,
- , -
, - ,
, , - "
[14]. -,
. , , , "
, - , ,
" [15]. : "
?.. , , " [16].
,
.

4.2.


, , , .
.
:


[17].
. " ,
,
.
, " [18]. ,
- : , ,
,
. , ,
, , ,
.
.

, 20
( , ?
? ? ?) [20].
, : ,
, . -: "
,
" [21].

. ,

, , ,
, [22]. ,
(), , (,
, ) [23].
,
. ,

. , "
,
.
, , . ,
- , , ,
" [24]. ,
, .
, , ,
.


. 4-1 10 , J
.
, 10

, - . ,
:
, - , - , .

[19]. , ""
. 93
.
: : ,
. -
. (
).
,
.
(
). :
, (A, , F,
H I), - . , ,
.
, .
, ,
- ,
. ,
.

, . ,
.
?
. ,
, ,
. ,
,
. : "
,
.
. ,
, ,
" [25].

, ,
, . ,
" .
, . ,
,
.
, ,
" [26]. , ,
, .
.

. 4-1.
.
.
. : "
( ),
" [27].
, " ". ,
, -
. , ,
- , .

() ,
.

, .
.
- ,
. ,
.
, ,
[28].

,
, . : "
- (Wittgenstein),
(, ), ,
, ...
... ,
.
,
" [29]. :
-,
, .

. , "
, ,
,
, ...
,
, - ,
, . , (
), "
[30].
-
.
.
.
. ,

,
.
,
- .

, ,
.
" , , " [31].
,
.
,
. ,
.

- ,
,

.

-
,
.
, ,
. -

,
, .22

- .
.
, .
,
.
,
[32]:

, ,

, ,

, ,

, ,

- ,
[33]:


, , ,

,
, /
,

-

[34]:

"-" ""


, ,

22

, ,
( ),
6.
"- ".


, ,


,
, .
.
,
-
.23
, :
, ,
.
- ,
" . -
.
,
" [36]. , ,
,
, ,
.
,
: "
.
,
... , ,
" [37].
1979
. ,
" - " [38],
: /, , . ,
. ,
. , -

.
.
.

, ,
, , ,
.
, -
, ,
.
,
,
.

23

,
. ,
.

.
" , ,
" [39].
:
"
.

.

.

" [40].

()
(). ,
,
, , ,
, , .
.
,
,
.
,
: .
.
, ?
, , .
,
.

.
,

. .

. ,
.
.
- ,
. .
. ,
, ,
.

,
.
- ,
, .
, , "
, , ,

" [41].
,
. ,

, (
). ,
,
[42]. , ,

.
. ,
(-
[43]).
. ,
6, , .
CRC-. CRC Class-Responsibilities-Collaborators
(//).
. CRC
- ,

.
, 35
( , 57; ,
, - ).
( ) - ,
- , - .
,
. ,
, " " ,
,
, , ,
.
,
. ,
,
.
.
.
,
[45]. , .
,
Fujitsu [46].
,
.
- . ,
. ,

.
.
-
- .
,
CASE-,
.
-

,
.

,
.
. ,
.


. :
" , ,
. , ,
?
" [47].
, ,
, , .

. - (
[48]), :



.
:

.
,

,
.
,
.
,
. , "
,
.
.
, ,
,
" [49].

,
, , .

-
[50].
, ,
, , ,
- .
,
-
,
. ,
,

, .
- ,
.
-
-
.
.
- 24
, ,
,
. , , ,
, , .
, ,
,
.
- , , ,
.
.
.

4.3.

. -
, .
,
: ,
, .
. , "

" [51].
,
: . ,
: ,
[52]. ,
,
, .
, ", , ";
- .
, , , , ,
, .
, .
-
.
6,
,
.
.
, ,
. "
: ? /
?
? , , ,
24

,
" [53].
,
.
. ' , "
, ,
.
,
. ,
" [54]. - ,
, ,
- -

:

.
: " -

" [55].

. , ,
,
. [56]. ,
, , :
[57].

.

,
.
, ,
, [58].
: , ,

. ,
, .
:
: theSensor shape.
: Sensors,
Shapes.
- : Draw,
moveLeft.
-
"to be": extentOf, isOpen.
- ,
.


?
,
, .
,
.
, .
, :
,
- . ,
. ,
, - .
, :
(
).
,
, (
).
.
.
.
( ).
,
, , , . .
,
,
, ,
. , ,
, .
,
.
, ,
.
.
,
.
, ,
, .
, - -

.
, ,
, -

,

. ,
.
,
. ,
. ,
,
.25 , CLOS
, Ada
[59]. , ,
. , ,
.
, " "
" C++

, " [60].
.
- ,
. , ,
.
,
- . , Apple MacApp
Bedrock - , C++

Macintosh. Windows Microsoft Foundation
Classes ObjectWindows Borland.

25

,
:
, , , .

. ,
. ,
- ,
: , , , , , , ,
, , , .
.
,
.
, .
, :
,
. Smalltalk ,
Model-View-Controller, -- (MVC) [61].
, ,
, ,
. MVC, ,
Smalltalk.
,
Smalltalk ( object)
Smalltalk.
.
, ,
,
. ( MS-DOS),
(UNIX) (
THE) [62].
.
,
.
,

[63].
- ,
,
[64].
, .
,
- .
,
,
.

- ;
.
() .
- ;
,
.
:
( ),

( )
( ).
- -
, :
, .
;
, .


.


. ""
,
. ""
.
"Summa Theologica" " "
.
(Rand) [I 1979].

(Lakoff) [I 1990] (Goldstein and Alger) [
1992].
- .

(Piaget) (Maier) [A 1969]. (Lefrancois)
[A 1977]
.
.
(Newell and Simon) [A 1972]
.
(Simon) [A
1982], (Hofstadter) [I 1979], (Siegler and
Richards) [A 1982] . (Stillings et al.) [A 1987].
(Lakoff) [A 1988] ,

. (Minsky) [A 1986]
, .

CTenn(Michalski and
Stepp) [ 1983, 1986], (Peckham and Maryanski) [] 1988]
Coya (Sowa) [A 1984]. ,

-- (PrietoDiaz and Arango) [A 1991]. (Iscoe) [ 1988]
.
, (Iscoe, Browne and Weth) [
1989], - (Moore and Bailin) [ 1988] (Arango) [
1989].
,
, .
(Von Oech) [I 1990]
. (Coad) [A 1993] Object Game,
.

,

. , , .
: (Coplien) [G 1992], (Coad) [ 1992],
(Johnson) [ 1992], (Shaw) [ 1989,1990, 1991], -
(Wirfs-Brock) [ 1991]. (Alexander) [I 1979]
.

, , .
(Stevens) [A 1946] , (Coombs, Raiffa and Thrall)
[A 1954] .

,
.

,
.
- , , ,
,
.
,

, , ,
, .

(Henry Petroski)

( Engineer is Human)

- .
( )
( ). (,
, , ), ,
. , ,
,
, ,
[1].
,
. -,

. . ,
, -,
- , ,
, . -,
, "
,
" [2]. -,
.
:
" ...

, ...
- ,
" [].

5.1.


. : "
, .
,
,
. -
,
,
.
, " [4].
. 5-1 (
1), - .
,
.
,

,
. , ,
.
, ,
.

;
" Booch Lite" (
).
.
, ?
, ;
CASE.
.
: " (,
),
, ,
, "
[5]. , -
, .
,
, . ,
, .
,
, ,

. 5-1.
.
(,
: ,
).
-
, ,

. ,
,

. , ,
.

. .
, ,
.
. , Smalltalk ,
, .
, C++ , ,
.
. , CLOS
,

:before, :after :around. ,


C++
.
-
- .
,
2. , ,
, :
6. 7 ,
8-12
.


3 , ,
. . 5-1,

: / /.

.
,
. ,
, ,
.
,
, , , .
,
; . ,

.
, .

; - ,
. "" (
),
. ,
( ), A
M B, M
B.
A B, , A
M.


.
, .
, ,
.
, ; ,
, .



,
.
- , .
:

?

?
,
.

. ,
.

:
?
?
?

,
?
,
:



.



. :
, ,
, .
, ,
, , ,
. -

:

.
,
,
. , ,
,
.


, ,

. ,
.
, ,
.
,
, , . ,
, ,
,
,
; .
, , : "

", ,
; . ,
, -
( ). ,

;
. , ,
,
. , ,
, , , , -
, , -,
.
. ,
, .

5.2.
:
,
.
.
,
, .
,
, .
-
.
. . 5-2
. ,
..1
1

- .
,
- , .
Intel, iAPX432 [].
, .
,
, .
, [7]:

, ,
, , .
, ,
-
(
).
, , ,
,
.

.

; ,
.
. ,
-

. 5-2.
C++ Smalltalk, , ,
.

. " ",
.
,
.
, ;
- .
3,
, .
.2
,
, , , , :
A
;
;
:C
A:C ;
, .
A:C=E
.
3 , - , .
.
, .
:
N()
;
(R),
RN()

( ).

.
: , ,
,
. , C++
,
;3 CLOS
:around.
, . 3,
,
.
2
, ,
, .
3
C++ , , ',
;
, .

- , .
,

, (. 5-3). :

.
.
. ;
, 3, .
. 5-4: , ,
(has) .
,
. ,
.

.
, Employment ( ),
. (
).
.
(. 3), :
1

(0 )
N
0..N
1..N

. 5-3.

. 5-4.
0..1
3..7
1..3, 7



. ,
, .

. ,
.
, ,
,
, .

, "/",
,
. ,
.
( ), (
) .
. ,
.
.
"/" ( "has")
,
.
- -.
.
.
"/"
,
. , ,
- -
,
.
.
.
, ,
.
. 5-5 ,
.
.
GardeningPlan ( ), ,
crop (), -

. 5-5.
execute () - canHarvest (

?).
EnvironmentalController ( ):
,
.
,
EnvironmentalController :

Heater () Cooler
( ), Light
(). Heater Cooler
Actuator,
startUp shutDown ( ),
Temperature.

:
3, - ,
. ,
, ,
. .
-
. ,
,
.4

. 5-6.

.
,
.
.
. - ,
, , , .
""
. ,
,
.
. 5-6 , .
, ,
.

. "", ,
, ,
. , ,

. ,
.
.

. C++,

4

Smalltalk .
.
, Smalltalk :
. C++
(),
,
[8]. ( . . .)

. , A B,
A::B. , ,

.
,
.
, ,
.
,
, ,
, , , .
,
. ,
.
.
.
, .
- ,
(. . 5-4). , A
B, , A
, , -
B.

. 5-7.
,
- , Object
Smalltalk, .
,
. ,
global , ,
.
,
, .
.
.
, ,
- . ,
.
(- ) .
,
- .

. . 5-7
. .
, (
), ,
, , - .
- ,
.
: GardeningPlan ( ) . 5-5
PlanAnalyst ( ).
, ,
.

. 5-8.



.5 ,
, .
: ,
, .
. , , C++, Eiffel Ada
. 3,

. ,
(
). .

, .
. 5-8,

, .
(
) .

, .

(GardeningPlan ).

.
,
.

Booch Lite.

. , Smalltalk CLOS,
. (. 3) - . Smalltalk, ,
-
( C++),
( ),

. 5-9.
. CLOS
[9].
, ,
, ,
. 5-9. ()
, .
GardeningPlan - new() default (),
GardeningPlan.
,
.
.
,
. ,
"/ ". :
( ) .
. ,
, C++, Object Pascal CLOS,
, -
. Smalltalk,
.
--, .

-
.
. -,
,
-. -, ,
( ) ( C++
6). ,
.
.

Smalltalk ,
.

. 5-10.
. 5-10,
.
PlanMetrics ( ) :
expectedYield ( ) timeToHarvest (
). ,
- GardeningPlan ()
CropDatabase ( ). ,
PlanMetrics CropDatabase:
. , PlanAnalyst
PlanHetrics.
. 5-10 :
,
. ,
, PlanAnalyst,

PlanAnalyst. ,
,
.
,
. ,

, .
,
.
, (. . 5-8).
,
,
.
.

, - . .
, .
.
; . 5-11
- Nutritionist::NutrientProfile.

. 5-11.
,
.
.

, -
.
- .
.
. , 3,

.
, C++ (
), ( ,
) ( ).
,
.7 Ada
. Smalltalk
, - .
: .
:
< >
( )

||

|||
"" . ,
. 5-12 , GrainCrop
Crop () ( ) FoodItem () (
).

, , .-, , .

. 5-12.
FoodItem
VitaminContent ( )
CaloricEquivalent ().
, CaloricEquivalent
FoodItem, ,
1:1. , , GrainCrop ( )
GrainYieldPredictor ( )
. ,
GrainCrop ,
GrainYieldPredictor.
,
. (
- )
.

. ,
,
. , . 5-12 , Crop
scientificName ( ),
- yield (), - nutrientValue
( ).
.
,
.

.
, ,
. C++, ,
:
( ) ;
static

virtual

;
friend
,
.


, , S,V F
.
. 5-13,
, . ,
OrganicItem ( )
ItemDictionary ( )
, (
). static
.
GrainCrop, ,
( ,
, ). , C++
, -
, . Grainrop

OrganicItem, ,
.
.
,
, ,
. , . 5-13 PlanAnalyst
Crop, , ,
, yield scientificName.
. 3,
.
"/" ,
. "/"
: , , .
,

. 5-14.
, ,
, .
;
,
. , , -,
,
, , -,
.

, ; ,
.
:



.
- , Smalltalk,
.
,

- .
,
.
, . 5-14. ,
CropHistory ( )
NutrientSchedule (
) limateEvent ( ).
,
.
, ,
. ,
CropHistory
Crop. ,
, .
- CropEncyclopedia
( ) CropHistory.
. ,
"/",
CropEncyclopedia
CropHistory, .
, . ,

CropEncyclopedia ,
CropHistory.
.
, ;
,
.
, - ,
.
, .
, , ,
, . 5-15.
PlanAnalyst ( ) Nutritionist ()

CropEncyclopedia ( ),
PlanAnalyst (
). ,
, .
PlanAnalyst:
,
,
, , CropEncyclopedia.

. 5-15.

CropEncyclopedia Crop, ,

( ).
- , .
CropEncyclopedia
scientificName, . ,
, ,
-.
, .

. 5-16.

. 3, -
, .
, - ,
, . -
, ,

,
.
.
, ,
:

, .
, .
. 5-16 , EnviromentalController
, ,
7 .
.
, ,
( ),
,
( ).
Heater () .
:
,
. Heater, ,
.
:
.
EnvironmentalController Light ,

. ,
EnvironmentalController Heater Cooler, ,
.
, Heater
Cooler,
.

,
. , Cooler::
-.
,
(, ) ( ) ,

.

, .8 , Adult
() Child (),
Person (). Person dateofbirth
( ) , age (), ,
.
8

:
. ,
, ;

, .

, age - :
dateofbirth. , ,
, .
, , ,
.
, Adult
Child, Parent (),
, Caretaker (),
(,
). Caretaker :
Parent;
, Caretaker.
.

; ,
.
. 5-17. -- Crop Nutrient. ,
N ( ) ,
N ( ) . NutrientSchedule
--:
.
,
Crop/Nutrient ( ) -
NutrientSchedule ( ).

-.
:
;
,
, - .
,

. 5-17.

. . 5-17 .
, NutrientSchedule,
(
); ( )
Nutrient
.
, ,
, , .
: ,

(
).
, ,
.9

- ,
: , ,
. ,
;
:
, .
, -
.
. ,
, ,
,
. ,

, .

, .
, -
,
.
( ,
).
, ,
.
: ,
;
, , .
.

:
:
:

. ,

, ,
.
- ,

( ).
. ,

. ,
, ,
, ,
,
9

, ,
windows-, Macintosh.
, ,
-[10].

. ,
.
.
, :
:
:
:
:

, -
. ,
,
.
- , , -
.
, ,
.

. , ,
, C++
Ada.
3,
,
:
:


:
:
:

.

:
:

;
, :
:
:
:

|
| |
|


:
- ,
, ,
.


(. 2). , .
"" .
, -
,
.
. , .

.
.
. -

:
:
:

.
:
:

C++, , ,
, ,
.

:
:

| | |

.
Object Pascal , Ada
, C++
.


:

Smalltalk:
,
, , initialize-release
(-) model access ( ).

:
:

:

:

| |

| |

| |


. ,
.

:
:

:
:

.
-
.

5.3.
:
:
; ,
; , .
, [11]:
, ,
.10

-

. 5-18.
. ,
( ) .

.
, ,
-
.
- ,
, .
.
. ,
: ,
, . ,
; , ,
. -
10

-
, [12] . [13].

, (
), ,
, .

( ) ( )
. ""
. ,
, ,
"" .
, (
) . . 5-18
, .
;
, .
. ,
, , ,
( ) .
.

. . 5-18, ,
. ,
, ,
, .11
.

. 5-19.
. ,
.
.
, . 5-19. .
;
,
,
.
,
:


-

.
, ,
,

.
, ,
- ,
,
11

, .
- :
( , , ),
, , /
, ,
.
, ,
, . ,
- . ,
, .
, .
, - ,
, ,
, .
, , ,
, .

, .
, ,
.
(
), . ,
CoolerFailure ( )
, .
,
, , ,
.
- (model-view-controller), Smalltalk.

, . ,
DeviceFailure (
) , CoolerFailure
( ) HeaterFailure (
).
- (, CoolerFailure)
(DeviceFailure).
CoolerFailure, ,
.
, DeviceFailure,
,
. , ,

. , ,
GardeningPlan:: execute (). ,
,
.
,
, .
,
.
, ,
:
heater.startUp()

DeviceFailure

start Heating

stop Heating
.

; , ,
.
,
(, Actuator::shutDown ())
( ).
, , harvest crop ( ),
.

;
,
. (
, ,
;
, ).
,
, .

. 5-20.
(EnvironmentalController)
. ,
.
,
,
. ,

,
,
.
. 5-20
. .
EnvironmentalController,
. 5-5.

. ,
Idle ();
Define climate,
(, , ,
).
- Daytime Nighttime (
); Sunrise Sunset ( )
;

.
(
adjustTemperature(), ).
Idle, Terminate
climate, .


,
, .
, ,
.

. 5-21. ,
, .
. 5-18, .
,
, :
entry start Alarm


exit shutDown()
.
,
entry exit( ).
,
:
do Cooling

.
:
" ".
. 5-21 .
Heating ()
Heater::startUp(), - Heater::shutDown(),
.
Failure (),
(Alarm).
Idle Heating.
, , ,
,
. ( ) ;
.
, ,
. " ".

,
, ,
. , ,
.
.
S, T
C . T
:
.
C.
C , T .
, C ,
,
C .
, ,
. , , , C
, , S,
, C : T
.
:
in Cooling
.
(
). ,
. ,
,
.
,
:
timeout (Heat ing, 30) .
, 30
Heating .
" ",
.

.
, ,
,
, .12
, ,
,
, ?
:
. ,
, .
.
;

, .
. 5-21 Cooling,
; ,
.
12

" "
, ,
.

, , Cooling,
, , , Running, - .
,
.
Cooling .
xor ( )
: Cooling
(), Startup
(), Ready () Running ().

-
. ,
.
,
Ready .13

. :
(, Failure
Idle Ready Running) - ;
.
(
Idle Startup), (
Running Idle), , .
( Cooling Failure
Failure) ,
.
.
,
.

(, Failure)
(
).
. , ,
, .
( H (History) ,
- ). , .
5-22 Failure.
, ,
Create log ( );
;
(log) , Log ready. ,
, -

13

, Too hot ok Cooling


. 5-21 ,
.

. 5-22.
. Failure ,
, Log
ready, Failure,
.
"" ,
.
, , .
,
.

,
. ,

, .

5.4.
:

. ,

. ,
: ,
,
,
. ,
.
,
.

.
- .

. 5-23.

. . 5-23 ,
. ,
,
: .
,
:
A


:C
A:C
.
, ,
.
( ),
.
.14
, ,
.

. : ,
, ;
,
, , ,
.
,
( C++), ,
.
- ,
, , , -
,
, ,
. ,
.
.
,
( ) ,
, . , ,
.

. 5-24.
.
"" - -
.
,
. ,
, .
.

14


, , ,
.
.

,
: ,
, .
. 3,
,
. 5-24. , ,
.
(
) ,
.
, ,
, .
,
( ) ,
.
, ,
.
A B L . A
, B A.
A, B. , ,
-, , , -. ,
.

. M
B, L,
B, .
. 5-24,
.
:
,
D

M
.
S
,
-.
,
.
, .
.
- .
, , ,
, :
N()

,
RN(arguments)
.

.
,
,
, , ,
. ,
,
, .

.
, , ,
, .
,
- .
, .
,
,
. ,
.
.
.

;
.
.
. . 5-25
Planning
(; . 5-7). ,
, .

. PlanAnalyst
( ) timeToHarvest() ( )
PlanMetrics ( ).
. PlanMetrics
status() ()
GardeningPlan ( ). :
" , ". ,
GardeningPlan maturationTime() (
) GrainCrop ( ),
. ,

. 5-25.
PlanAnalyst,
C.yield(), ( Crop::yield()).
PlanAnalyst,
, netCost ().

PlanAnalyst
GardeningPlan. ,
.


, ,
.
.
:
.
, . ,

, .

. ,
.
. 5-26
. , PlanAnalyst
(Crop)
CropEncyclopedia ( ) ,
.
, ,
, .
. 3,
.

. ,
-

. 5-26.
. . 5-26 : ,
insert () succeeded
(). , .
.
, .
,
, .
,
.
, , ,
.
. 5-27 . 5-25 ,
.

.
.
, PlanAnalyst
PlanMetrics G; , .
- PlanAnalyst :
GardeningPlan: GrainCrop
( );
,
( F (field)).
,
:

G


F
.
L
,
(
) (
). ,
, .

.
"/" () ;
-

. 5-27.
,
.
. 3,
,
.
. , ,
.
:
, ,
.
, ,
, : , ,
. ,

;
, .
,
sequential, guarded,
synchronous active. , . 5-28 , H, C
EnvironmentalController - .
, L, .
, (
), .
,
. . 5-28, ,
, ,
. turnON()
() - ;
.
.
.
,
.

. 5-28.
, startUp() - ,
, .

Ada (rendezvous). isReady()
, .
restart() ,
.
,
, ,
. failure
. ,
, ,
, .
.
. , ,
.
( ) .
, . 5-29 startUp()
5 , 6.5
ready() , 7 , turnOn().


,
.
, . ,
- .
, .
:
Context: | | |

,
, ,
(, , ).

. 5-29.

5.5.
:
,
, .15

. , . 5-30
,
, . 5-25.
, ,
,

: , , , - .
,
.16

. ,
. . 5-30,
. (
, )
. .
(
) ,
, . ,
,
. ,
15


[15].
16
,

.

. .,
.

5-30

,
.
,
, ,

. 5-31.
. ,
, .


,
,
.
. ,
, .
(. 5-31),

, ,
.
. ,
. ,
, X Y ,
, X Y

Z. . 5-31,
, ,
. ,

GardeningPlan, ,
, , ,
, , , ,
.

5.6.
:

.

. ,
.
, Smalltalk,
, ;
.

.
. . 5-32 .
- , .
, .
C++, ,
., -,
main. .
, , ,
. C++, ,
.h, -
..

. 5-32.
.
;
. , ,
. , ,
, , .
.
,
, ,
.
,
, . , ""
, .

. 5-33.
. ,
, - -
, . C++, ,
#include. , Ada
with.
.
,
.
. . 5-33 ,
.
. , climatedefs cropdefs,
.
, :
, .
,
, . , ,
,
(. .h).

. , climate
heater, , ,
climatedefs.
:
2,
, , .

.

.
.
,
.
.
. - ,
.
.

. 5-32 . ,
.
, ,
.
, ,
, .

. ,
,
.
,
.
;
.
. ,
.

.
. . 5-34
.
, .

. 5-34.

, (. 5-7)
. ,
. ,
,
,
. ,
, .

. , Ada,
, , . 5-32.
, Ada ,
.
,
.

. ,
,
, .

, ,
.

, ,
,
.
, ,
.
,
,
. ""

.
5.7.
: ,
,
.
.
,
,
.
- ,
.
. . 5-35 .
- , .
;
, "", .
.
( main
) ( ).
. . 5-35 .
- ,
( ,

. 5-35.
). , ,
.
.
.
.

, , RS232, Ethernet,
, ,
, "-".
,
, .
.
. . 5-36
, .
, ,
.
, ,
, .

, ,
.

. . 5-35 ,
,
. ,
(),
, (),
. ,
,
,
, , ,
.
.
.
,
, ,
.
-

. 5-36.
.
.
.
.

- . .
.
,
, , :

,
.

, ,
, . ,
, .
5.8.
-
(
), (
)
( ).
, ,
, , , ,
.
,
. ,
, .
,
. ,
, , ,
.
, ,
, .
, .

. , ,
,
, - . ,
, ,
. , ,
, ,
,
.
,
.

,
, ,
. ,
.
, ,
, .
,
- .
-
, .
.
.


- ;
.
/ , /
.
-
(, , , )
( , ).
,
. -
.
,
. .

. -
.

. -
.
: (1)
; (2) , ; (3)
, .

.


, ,
(Rumbaugh) (Jacobson), ,
. ,
. - .

; (Martin and McClure) [H 1988]
. (Graham) [F 1991]
, - .

(Booch) [F 1981].
: ( . (Stillings et al.) [A
1987] (Barrand Feigenbaum) [J 1981]), "-"
( (Chen) [ 1976]), ( (Ross) [F 1987]), (Petri) (-
(Peterson) [J 1977], (Sahraoui) [F 1987] (Bruon and Balsamo) [F 1986]),
( (Rumbaugh) [F 1991]) ( (Harel) [F 1987]).
, , ,
, .
iAPX 432 [D 1981].
(Seidewitz) [F 1985].
(Buhr) [F1988,1989].
(Chang) [G 1990] .


- - ,
. - ,
. " ";
, . "
" .
, ,
, , . ,
, .
- ,
, .
, ,
, , .

6.1.

, ( ,
) , ,
. , ,
, ,
, , :
;
.

. -
. , "
" [1]. 1 5,
-
, .
. , ,
" " ,
, , [2].
,
, ,
, .

.
, , ,
. ?
, .
, - ,
- . ,
1 2, -
,
.
:
.
,

.
.
, .

, .
, :
.
.
.
, ,
, , ,
, -
. ,

. , ,
- .

.
.
,
.
.

. -
,
. ;
( )
- ,
. ,
, , ,
. - .17
, , ,
, ,

, ,
.
-
, . ,
-
. ,
, ,
. - ,
( ),
,
.
""
- -.
,
[3, 4]. , ,
.
, , ,
, . -
-, ( )
[5]. ,
,
.
.
17

, ,
.

, -
- -. ,
"
" (round-trip gestalt design).

, , ,
. ,
.

. :
,
; , ,
, . ,

. , ,
[]. ,
.
:

. ,
, , ,
, ,
.18
.


, ,
.
, , ,
.
,
.
[7]:


.

.

,
, .
.

18

.
,
(,
, . .) .
, "
,
... ,
...
" [8].

,
.

,
;
, .


,
;

.
-

.



.


,
.


,
,
,
.

, : "
,
",
. , , " , ,
... ()
, ,
, , .
,
... ,
" [9].
: "
?".
- .
,
, [10].
""
. ,


.

, , ,
,
.
,
,
; ,
,
, .
,
, ,
- .
,
, -
.

6.2.

-
,
. ,
, -
.

. ,

,
. ,

.

, " ".
-, " ,
, ...
, , ,
, " [II].
. 6-1,
:



.
.


. ,
. ,
-
.
, ,
,
, , - .
, ,

. ,
, ,
,
, .
.
.
,
, , [12].
, ,
, -

. 6-1.
.19

,
- .
, -
.
:
, - , - , -
.
,
.

. -,
,
. -, -

. ,
, . -,
,
,
.
. 4,
:
.
19

, -
.

.
, ,
,
.
,
.
.

, 4.
:
(. 4.2,
"- "),
.

. ,
:
, ,
/ .
(. )
,
.
, ,

. ,
,
.
, ,
(. ).

.
,
.
CRC-
" " ,
.20

, .
, ,
-
. , , ,
, ,
( ),
,
.
.
, .
, ,
.
,
.
, , ,
,
. ,
20

,
.

, - .

,
.


. -
, .
,
.
,
.
,
.

,
, - .
. .
,
.
(
5), . ,
, . C++
.h-, Ada - , CLOS , Smalltalk - ,
. ,
-,
.
, ,
,
, .
- , ,
.

.

, ,
,
, .
,

.

,
. -
.
. :
, .

, .
. ,
,
. :

( ),
;
.
,
, ,
. - ,
,
.
,
. ,
.

;
.
CRC-.

.
, , , ,
, .
, ,

, - .
-

.

,
. ; ,
.
,
, ,
, . ,
:
, -
. ,
,21
,
.
,
. , , ,
, ,
.
,
.
-
.
, 3
, .
, ,
. :
21

3, ,
.
;
, .

.
,
. , ,

.
: .
( - ,
)
( ).

.
, [13].
,
,
.
: ,
, ""
,
. , ,
.

- .

. , ,
.
, ,
, . ,
,
, , ,
. ,
, -.
- -
. ,
, -
. :
,
.
.
, ,
.

,
, .
.
,
.
- ,
.
,
.
,
- .


, .
, .
-;

,
. , , ,
, .
.
, ,
/ .
,
.
,
3. ,
.
-
,
, .22
.

.
.


. -

, .
,
.

(
).


. ,
,
.
:
, . .
.
, .
, ,
, ,
, ,
.
,
, ,
(
), , .
,
22

,
;
.

, , -
.
,
,
. " ",
, ""
,
, .
,
,
, .
.
,
, . ,

,
.
.
,
.
- , .

.
.
.

.
,
,
.
. :
,
.
.
3, :
,
, , .
,
,
.
:

;
,
.

, .


.
, ,
.
"/"
.

,

.
,
,

.
- , .

, 4, . ,
, .
,
:
,

,
.
.
, - ,
.

.
,
"/". 3,
"" , .
,
-;
.
,
3. ,
:
, . ,
,
,
( ).
,

. - .
,
,
. .
,
, ,
.
,

.
.

,
. (
)
.


. 5,


,
.
,

.
.
-
- - , .
,
, -
. ,
, - .
, ,
- ,
, , , . .
:
, ,
,
"/".

.
, ,
- ,
, .
,
,

.

.
,
.
: , ,
, . .
:
, .
.
,
, .
- , .
, ,
.
,

, .
,
, ,
.


. ,
,
;

.


().
,

.
,
, (,
),
.
.
.

. ,
, ,
(
), (
). , ,
.

, ,
,
.
,
, .
,
,
.
.
. :
,
.
,
, .

: ,
,
. ,
,
.
:
.
-,
, ,
, .

.

, .
-
( , )
.

, .

/
.

, ,
.
, ,
-
. ,
.
-,
,
,
.
.


. ,
,
-.
. ,
,
,
, .
,

.
.
,
.

6.3.


.
, ,

. -
.

,
-, . , ,
.
-
.
- ( ) ,

- .

,
.

, .23 ,
,
;
, ,
.
- ,
, .

. .
6-2, :

().
().
().
().

().

. 6-2.

.
, ,
.
.
, "
, ,
, " [14].
-
.
: "
, " [15].
.
, ,
, , ,
.
23

, , , . ,
, .

. , .


.
.
,
, ,
.
,
, ,
. ,
, ,
.
.
. ,
, "
".
. ,
(, , ) ,

.
,
, .
, (
),
.
, , -
, , ,
.
.
: , .
,
.
: ,
, .
. , , ,
. , ,
.24
: , ,
, , , . .
,
,
.
, :
,
, .
.
(
24

,
, , .
. ,
.

). , ,
- .


.

, .
.
. , ,
, .
(,
Smalltalk), (, C++).
. ,
.
( ,
), . ,

.

. ,
, , .
-
. , ,
, ,
. ,
, .

.

. , " - .
, ,
, " [1].
, - .
, ,
. ,
.
, , , . ,
( ) "",
,
.
.
, ( ,
),
. ,
, . , ,
, .
,
. ,
,
[17]. ,


.25 ( )

, . ,
. ,
- : ,
.
.
.
,
,
.
, ,
.
,
, .

, .
,
, .
.
,
,
.
,
.
. ,
,
[19].
. .

.
, CRC ,
.
,
,
, .
,
(
) (
).

, ,
,
, , ,
[20].
:
, .

.
25

,
-
[18].

.
: .
4,
. ,
, .
,
.
, ,

.
.
, , ,
, (Rubin adn Goldberg),
(Adams), - (Wirfs-Brock), (Coad)
(Jacobson). :
,
,
. ,
.

,
, 4.26
CRC. ,
, ,
,
,
. ,
,
. ,
,
[21].
, ,
.

( ).


,
.
;
, ,
.
,

.
, .

.
,
.

26

[22]
[23].

.
,
. ,
, ,
, ;
, ,
. , ,-
.
, ,
. ,
, .
,
. ,
,
,
.
,
.

. -
,
.

.
. ,
, ,
.27
. :
.

.
, -
,
,
.
( )
( ).
, ,
,
.

.
, (
) .
, ,
. ,
.
- ,
.
, ,
, , .
,
27


.

.
. :
,
.

.
, ,
,
. :
(
) .

; ,

,
.
,

, .
.
,
.
,
,
.

. ,

. ,
.
:
,
. ,
, ,
, . .

, ,

.
,
. ,
.

, .

.
,
, ,
, .
:

.

, ,
.
,
- .
,
,
, .
,
, .

, ,
.
.
, ,
- . ,

.
.
(.
1).
-
,
.

. - ,
,
.

,
. . - . ,
( ),
. ,
, ,
. ,
; , .

, ,
.
- .
,
.
, ,
- ,
.
, - .
, " ,
, ,
. -
" [24].
-
:
" ,
, .


.
, ,
.

.
.

, .
,
".
.
,
.
,
.
,
. , 12-18
, :
. ,
, .
,

.
?

, ,
, ,
.
, .
( )
. "" ,

, .
,

.
.
,
.
, ,
,
.
. :
.
, ,
: .
,
,
. :
, ,
, ,
.


. ,
,

.
,
.

. ,
.

.

. ,
.

.
, ,
,
.

:

.
.
.
.
.
.
,
.
.
, ,
.
, ,
,
.
.
- ,
( -).
,
.
(
) .
, ,
.

, , .
(
C++ - ). ,
( )
. ,
Smalltalk, C++, CLOS Ada,
-

(, ,
). ,
, ,
,
. :
.
, :
,
, . .

, , .
, "
,
" [26].
,

.
, ,
,
.
,
.
.

(, ,
. .).
,
, - .
, ,

, ,
, -.
,
3 ( ,
), .
.
, .
, ;
, .
,
. ,
,
. , ,
, .
, ,
, .

, .

,
.
?
: .
.

. ,
.

, ,
? ,
,
, .
- ,
[27].
-
;
.
, ,
:
,
.
, [28].
.
, .
, , ,
,
, ,
.
-

.
, - ,
[29].
,
-,

.
.
, ,
,
.
.


[30]. ,

,
,
.

. -
.
, ,
. ,
.
,
"" :
" ;

( ).

,
, ,
( )" [].

.
;
, .

(
, , ). ,
:
, ,
- .
.
, ,
. ,
. ,
- , ,
,
,
. ,
,
,
.28
,
.
.
. ,

.
,
, .
:

, ,
.

.
,
, .

.
.

.
, ,
; ,
, ,
, .

28




.
,
, - .
-

();
.

;
.

;
,
.
-
;
, .

; -
.
-
,
.
- ,
;
, ,
,
.
- . -
.
.
- .

;
,
.
- ,
.
- .
- ,
;
,
.


, ,
(Booch) [F 1982]. (Berard)
[F 1986]. GOOD

(General Object-Oriented Design) (Seidewitz and Stark) [F


1985,1986,1987], SOOD (Structured Object-oriented Design)
(Lockheed) [ 1988], MOOD (Multipleview Object-oriented Design) (Kerth)
[F 1988], HOOD (Hierarchical Object-oriented Design), CISI
Ingenierie Matra [F 1987].
: (Stroustrup) [G 1991] Microsoft [G 1992],
.
,
2,
- .
. :
(Alabios) [F 1988], (Boyd) [F 1987], (Buhr) [F 1984], (Cherry) [F
1987,1990], (deChampeaux) [F 1992], (Felsinger) [F 1987],
(Firesmith) [F 1986,1993], (Hines and Unger) [G
1986], - (Jacobson) [F 1985], (Jamsa) [F 1984], (Kadie)
[F 1986], (Masiero and Germano) [F 1988],
(Nielsen) [F 1988], (Nies) [F 1986], (Railich and Silva) [F
1987], (Graham) [F 1987].
-
(Arnold) [F 1991], -
(Boehm-Davis and Ross) [H 1984], (deChampeaux) [ 1991], ,
(Cribbs, Moon, and Roe) [F 1992], (Fowler) [F 1992],
(Kelly) [F 1986], (Mannino) [F 1987], (Song) [F 1992],
(Webster) [F 1988]. (Brookman) [F 1991] (Fichman) [F 1992]
- .

(Curtis) [H 1992],
Software Process Workshop [H 1988].
(Guindon) [H 1987], ,
. (Rechtin) [H 1992]
,
.
""
- (Hamphrey) [H 1989]. ,
, - (Parnas) [H 1986].


,
- ,
[1]. . ,
"
- " [2].
, -
. , ,
- . -: "
,
.
:
" [].
,

. ,
, , .
, ,
, . ,
-
.

7.1.

, ,
. ,
- .


,
- , .
-
, ,

.
.
,

,
.
,
, . ,
,
. ,
, ,
, .
,

,
.

, , ,
- .
-
, .


, ,

.
,
. ,
. ,
,
.
.
,

.
,
:
, ,
.
- ,
. ,
.

.
, ,1
, ,
,
, ,
.
-
[4]. , "
", ;
, , ,
,
.

,
. ,
.
,
, - "" .
.
,

.
,
1

: " ,
" [5].

. , :
.
,
. , ,
:
( ),
( ,

,
). , ,
,
" " ,
. ,
, ,
,
.
, - ,
.
-
.
,

, .

,

. :

,
.

(walkthroughs) - ,
. ,
. .
.
,
. ,

, .

.
,
- .
.
,

.
,
,
- , .
, ,

.2

.

.
,
. ,
( )
.
, , ,
.

.
,
.
.

. - ; -
.

7.2.

- ,

. "
". , -
, , , ,
.
,
, ,
.
. ,
- ,

,
. , ,
,
,
.
,
. ,

, .
,
, ,
, . ,
, .
, , ,
- ,
2


, , , .

, ,
.


,
. - ,

.
, -

.
- :


.
- ,
;
.
, .

. - ,
,
(
). ,
,

. -
, . ,
,
,
.
,

.
- , ,
, ,
, -,
.

, .

. ,

,
.
- .
.

,
,
,
.

- .
,

.
.
() -
. .

.
,
,
. ,
,
. ,
,
.

, ; , ,
,
.
.

,
.
,
:
.
,
. :
, .
.
(, )
- ,
(, ,
):


, , .

;
, .

() ; ,
; ,
.

; ( )
.

;
.

,
() .
,
, , ,
.
; , .
; ,
.

7.4.

( , , )
. 3, -

: , . , 4
,
, .

( ).
, [9].
, ,
70% (
), . ,
;
, , ,
, .
, , ,
, .

;
,
, .
C++,
.

.

,
:


,
:
, .
,
(
, ).
,
, ,
, .
,
: , ,
.
,
(), ( ),
,
( ).
, :

(
).
.
.

, ;
.

;
.

,
, - .

,
.

,
,
.

,
.
"/".

( - )
, ;
.

(
), ;

.
4,
.
- ,
.
,
:
( ), - (
). (, )
,
. ,

.

. ,
, (
19). ,
,
, , AVL- 20.

; .
,
,
. .
:
/
.

, .








,
.
,
. , ,
( , . .)
(, , . .).
, .


,
;
-
. -: "

... ,
".
,
: -
.
,
, :



.

.21
, , ,
,
, , .
,
.
.
?
? ?
, ?
, ,
.
, ,
, ,
.

, .

:
,
, ,
.

;

, , ,
.
,
.

, , ,
.
:
,
,
. ,
,
, ,
. ,
, ,
, . - ,
.
:
,
,
.

9.2.

"
,
". :
.
,
,
,
.
3, -

: , .
- ,
.
,
.
-
C++:
class NetworkEvent... //
class EventQueue {//
public:
EventQueue();
virtual ~EventQueue();
virtual void clear(); //
virtual void add(const NetworkEvent&); //
virtual void pop(); //
virtual const NetworkEvent& front() const; //

...
};

, : ,

. C++
( clear ,
add, pop front ).
,
, ,
.
:
class PriorityEventQueue : public EventQueue {
public:
PriorityEventQueue();
virtual ~PriorityEventQueue();
virtual void add(const NetworkEvent&);

};

( add)
.

.
, : . -,
:
template<class Item>

class Queue {
public:
Queue ();
virtual ~Queue() ;
virtual void clear();
virtual void add(const Item&);
virtual void pop();
virtual const Item& front() const;

};


: ,
, , ,
.
.
PriorityQueue , , :
template<class Item>
class PriorityQueue : public Queue<Item> {
public:
PriorityQueue();
virtual ~PriorityQueue();
virtual void add(const Item&);

};

-
.
:
Queue<char> characterQueue;
typedef Queue<MetworkEvent> EventQueue;
typedef PriorityQueue<NetworkEvent> PriorityEventQueue;

. 9-1.

, - .
. 9-1
(Queue), (PriorityQueue),
(PriorityEventQueue) (mailQueue).

:
.
.


, ,
.
. ,
- , -
.
(. 9-2).
.
,
.
Support ()
,
.

: .
, , ,
: .
, , ,
. ,
, ,
. , ,
. Support
- , .
,
. ,
, Support.

. 9-2.

Support
.
. 9-2, ,
; ,
Smalltalk.
,
Graphs, Lists Trees
. ,
.
:
, .

, ( )
. , , ,
, .

, .
"",
- "", ,
.



, .
,
(
Queue), ,

"/".
.
,
. ,
.

, ,
, , ,
, - ,
(, , -
).
, ,
,
.
,
,
.
,
.
- ,
. O(n)
O(1) - . , ,

,
.

. ,
,
. -,
.
:
. :
:

, ,
( ).


.

,

.
.
.
2, .
,
. (
)
.
, -
, . ,

,
. , , ,

Queue. , ,
, ,
.

. 9-3.
3,
,
,
:


.

.
,
, ,
. 9-3. ,
,
. - , :
.

.
"
- ".
.



:
template<...>
class Name : public Superclass {
public:
// //
//
//
//
protected:
//
//
private:
//
};

Queue
:
template<class Item> class Queue {
template

. , C++
, (
) ,
.
:
Queue();
Queue(const Queue<Item>&);
virtual -Queue() ;

, ,
.
:
virtual Queue<Item>& operator=(const Queue<ltem>&) ;
virtual int operator==(const Queue<Item>&) const;
int operator!=(const Queue<Item>&) const;
(operator==)
(operator==) ,

.
. ,
.
,
.
(,
), ,
,
. :
, ,
.
,
,
.
,
:
virtual void clear() = 0;
virtual void append(const Item&) = 0;
virtual void pop() =0;

virtual void remove (unsigned int at) = 0;

, ,
.
Queue .
const ( )
-, ,
,
:
virtual
virtual
virtual
virtual

unsigned int length() const = 0;


int isEmpty() const = 0;
const Item& front() const =0;
int location(const Item&) const = 0;

,
Queue .

,
.22 Queue, .
(. ), .

,
. Queue
:
virtual
virtual
virtual
virtual
virtual
virtual

void purge () =0;


void add(const Item&) = 0;
unsigned int cardinality() const = 0;
const Item& itemAt (unsigned int) const =0;
void lock();
void unlock();

, ,
.
, , ,
- ,
. Queue
:
friend class QueueActiveIterator<Item>;
friend class Queuepassivelterator<ltem>;

,
.


,
, ,
-
.
,
. ,
,
.
, , ,
, ,
,
(, , "").

.

,
,
, (
, ).23
,
. ,
.
,
;
, Unbounded ()
Bounded (). unbounded
,
, "". ,
, , ,
.
Bounded ,
,
, , ,
( )
.
. 9-4,
. ,
,
, ,
.
unbounded
Bounded .

. 9-4.
,
,
: BoundedQueue, , ,
Bounded.
,
. -
Size, .
- StorageManager,
.
.
, ,
,
, ,
.
Unbounded Bounded

.
, , ; ,
.
.
;
,
, .
, , Bounded:
template<class Item, unsigned int Size>
class Bounded {
public:
Bounded();
Bounded(const Bounded<Item, Size>&);
~Bounded();
Bounded< Item, Size>& operator=(const Bounded<Item,
Size>&);
int operator==(const Bounded<Item, Size>&) const;
int operator!=(const Bounded<Item, Size>&) const;
const Item& operator[](unsigned int index) const;
Item& operator[](unsigned int index);
void clear();
void insert(const
Item&);
void insert(const
Item&, unsigned int before);
void append(const
Item&);
void append(const
Item&, unsigned int after);
void remove(unsigned int at);
void replace(unsigned int at, const Item&);
unsigned int available() const;
unsigned int length() const;
const Item& first() const;
const Item& last() const;
const Item& itemAt(unsigned int) const;
Item& itemAt(unsigned int);
int location(const Item&) const;
static void* operator new(size_t);
static void operator delete(void*, size_t);
protected:
Item rep[Size] ;
unsigned int start;
unsigned int stop;
unsigned int expandLeft(unsigned int from);
unsigned int expandRight(unsigned int from);
void shrinkLeft(unsigned int from);
void shrinkRight(unsigned int from);
};

, .
? , 80%
, 6.

.

,
.
rep
Size. :
Bounded<char, 100U> charSequence;


100 . start

stop ( )
. .

,
.

,
( 3).
, ,
, ,

.
C++ ,
.
.

-. , , Bounded,
Bounded Item.
, ,
(, - itemAt) -
. , C++

.
, ,
, ,
.
,

.
,
,
. , ,
,
.
-,
. ,
, ,
[12].
-, , ,
, ,
.
(
),
. ""
.
-,
- .
,

.
, BoundedQueue :
class Event ... typedef Event* EventPtr;
BoundedQueue<int, 10U> intQueue;
BoundedQueue<Event, 50U> eventQueuel;
BoundedQueue<EventPtr, 100U> eventQueue2;
eventQueuel

Event "",
. , eventQueue2
Event, ""
.
, ,
,
. , ,
, , ,
, . ,

. , ,
( ) .
, Bounded
BoundedQueue. ,
BoundedQueue rep Bounded.
template<class Item, unsigned int Size>
class BoundedQueue : public Queue<Item> {
public:
BoundedQueue();
BoundedQueue(const BoundedQueue< Item, Size>&);
virtual ~BoundedQueue() ;
virtual Queue<Item>& operator=(const Queue<Item>&);
virtual Queue<Item>& operator=(const BoundedQueue<Item,
Size>&) ;
virtual int operator==(const Queue<Item>&) const;
virtual int operator" (const BoundedQueue<Item, Size>&)
const;
int operator!=(const BoundedQueue< Item, Size>&) const;
virtual void clear();
virtual void append(const Item&);
virtual void pop();
virtual void remove(unsigned int at);
virtual unsigned int available() const;
virtual unsigned int length() const;
virtual int isEmpty() const;
virtual const Item& front() const;
virtual int location(const Item&) const;
protected:
Bounded< Item, Size> rep;
virtual void purge();
virtual void add(const Item&);
virtual unsigned int cardinality() const;
virtual const Item& itemAt(unsigned int) const;
static void* operator new(size_t);
static void operator delete(void*, size_t);
};

- ,
. ,
Bounded,
:
template<class Item, unsigned int Size>
unsigned int BoundedQueue<Item, Size>::length() const
{
return rep.length() ;
}

, BoundedQueue
, .

available,
( Size - length()).
- ,
.
.
,
, ,
. new delete
,
BoundedQueue (
).
Unbounded , , ,
Bounded, .
template<class Item, class StorageManager>
class Unbounded {
public:

protected:
Node<Item, StorageManager>* rep;
Node<Item, StorageManager>* last;
unsigned int size;
Node<Item, StorageManager>* cache;
unsigned int cacheIndex;
};
Unbounded ,
(Node) :
template<class Item, class StorageManager>
class Node {
public:
Node(const Item& i,
Node<ltem, StorageManager>* previous, Node<Item,
StorageManager>* next);
Item item;
Node<Item, StorageManager>* previous;
Node<ltem, StorageManager>* next;
static void* operator new(size_t);
static void operator delete(void*, size_t);
};

-
.
,
,
,
.
, Bounded Unbounded
, , ,
, , .

- .
, , ,
O(n).
,
, , ,
. , ,
( O(n/2)
) ,
( O(1) ).



.

.
new delete,
. ,
(,

)
, .
.
. 9-5
.24 ,
:
(aClient) (append)
UnboundedQueue ( , ,
UnboundedQueue).
UnboundedQueue, ,
rep, unbounded.
Unbounded, new,

Node.
Node, ,
StorageManager, ,
- UnboundedQueue (, ,
Unbounded Node), . StorageManager

.

. 9-5.
StorageManager
,

,
. ,
,
.
,
StorageManager,

. , -
allocate deallocate,
.
:
class Unmanaged {
public:
static void* allocate(size_t s)
{return ::operator new(s);} static void deallocate(void*
p, size_t) {::operator delete(p);}
private:
Unmanaged() {}
Unmanaged(Unmanaged&) {}
void operator=(Unmanaged&) {}
void operator==(Unmanaged&) {}
void operator!=(Unmanaged&) {}
};

, ,
,
.
Unmanaged
new delete.
Unmanaged, ,
,
. ,
.
.
, .
, .
,
. ,
:
, .25
, ,
, , .
, ,
, ,
. ,
, ,
, .
,
:
class Pool {
public:
Pool(size_t chunkSize);
~Pool();
void* allocate(size_t);
void deallocate(void*, size_t);
void preallocate(unsigned int numberOfChunks);
void reclaimUnusedChunks();
void purgeUnusedChunks();
size_t chunkSize() const;
unsigned int totalChunks() const;
unsigned int numberOfDirtyChunks() const;
unsigned int numberOfUnusedChunks() const;
protected:
struct Element ... struct Chunk ...
Chunk* head;
Chunk* unusedChunks;

size_t repChunkSize;
size_t usableChunkSize;
Chunk* getChunk(size_t s);
};

Element chunk ().


Pool chunk,
"" ,
Element ( ,
pool).

.
:
class Managed {
public:
static Pool& pool;
static void* allocate(size_t s)
{return pool.allocate(s); } static void deallocate(void*
p, size_t s)
{pool.deallocate(p, s);}
private:
Managed() {}
Managed(Managed&) {}
void operator=(Managed&) {}
void operator==(Managed&) {}
void operator!=(Managed&) {} };
, Unmanaged. -

, C++ ,

UnboundedQueue, ,

StorageManager.
Pool, Managed,
. (
) . ,
, , ,
,
.

. 9-6.
. 9-6 ,
, .

Managed
Unbounded UnboundedQueue;
- .

. . 9-7 .
, , , , .

. 9-7.

, C++
(
), (,

)
.
, C++ [14].
, ,
.
Exception (),
:
class Exception {
public:
Exception(const char* name, const char* who, const char*
what);
void display() const;
const char* name() const;
const char* who() const;
const char* what() const;
protected:

};


. ,

.

,
Exception:

ContainerError
Duplicate
IllegalPattern
IsNull
LexicalError
MathError
NotFound
NotNull
NotRoot
Overflow
RangeError
StorageError
Underflow
overflow ()

:
class Overflow : public Exception {
public:
Overflow(const char* who, const char* what)
: Exception("Overflow", who, what) {}
};

,
.
-
; ,
, ,
.
,
. ,
.
, ,
:
inline void _assert(int expression,const Exception&
exception)
{
if (!expression)
throw(exception);
}

.
,
( C++ throw ). ,
, ,
(-D C++)
throw --,
:
void _catch(const Exception& e)
{
cerr << "EXCEPTION: ";
e.display();
exit(l);
}

insert Bounded:
template<class Item, unsigned int Size>
void Bounded<ltem, Size>::insert(const Item& item)
{
unsigned int count = length();
_assert((count < Size), Overflow("Bounded::Insert",
"structure is full"));

if (!count)
start = stop = 1;
else
{
start--;
if (!start)
start = Size;
}
rep[start - 1] = item;
}

, ,
. ,
Overflow.
,
, , (
,
). , ,
, .
insert, , , ,
(
),
.

, .
. 9-8 ,
.

. 9-8.

- .
3 , ,
.
, ,
, , .
:
,
.
:

.

;


.
.

. ,
, , ,
.1 ,
.
Queue:
template <class Item> class QueueActiveIterator {
public:
QueueActiveIterator(const Queue<Item>&);
~QueueActiveIterator();

"" .
.
void reset();
int next() ;
int isDone() const;
const Item* currentltem() const;
protected:
const Queue<Item>& queue;
int index;
};


. "" ,
.
currentItem
;
, .

next ( , ,
, - , ). isDone
: 0,
. reset
.
, :
BoundedQueue<NetworkEvent> eventQueue;

,
, :
QueueActiveIterator<NetworkEvent> iter(eventQueue);
while (!iter.isDone()) {
iter.currentItem()->dispatch();
iter.next();
}

, . 9-9,
, ,
. .
QueueActiveIterator
.
cardinality,
. ,
:
template<class Item>
QueueActiveIterator<ltem>::QueueActiveIterator(const
Queue<Item>& q)
:queue(q), index(q.cardinality() ? : -1) {}

QueueActiveIterator
cardinality Queue, .
isDone
,
:
template<class Item>

. 9-9.
int
{

QueueActiveIterator<Item>::isDone() const
return ((index < 0) II (index >= queue.cardinality()));

currentItem ,
.

:
template<class Item>
const Item* QueueActiveIterator<Item>::currentItem () const
{
return isDone() ? 0 : &queue.itemAt(index);
}


, itemAt. , currentItem
,
. itemAt
.
itemAt . ,
, Unbounded ,
,
( )
.
next ,
,
:
template<class Item>
int QueueActiveIterator<Item>::next()
{
index++;
return !isDone();
}

, ,
Queue: cardinality itemAt.
,
, Queue.
,
, ,

, .

,
. , Queue
:
template<class Item>
Queue<Item>& Queue<Item>::operator=(const Queue<Item>& q)
{
if (this == &q)
return *this;
((Queue<Item>&)q).lock();
purge();
QueueActiveIterator<Itea> iter(q);
while (!iter.isDone()) {
add(*iter.currentltem());
iter.next();
} ((Queue<Item>&)q).unlock();
return *this;
}

,
.

, q.
purge ,
add
. ,
, ,
, ,
.
, ,
,
. Queue
:
template <class Item>
class QueuePassiveIterator {
Public:
QueuePassiveIterator(const Queue<Item>&);
~QueuePassiveIterator();
int apply(int (*)(const Item&));
Protected:
const Queue<Item>& queue;
};


() . , apply
,

( apply
, ).


,
. UNIX, OS/2 Windows NT
"" 26.

: ,
, .

, ;

.

:
, ,

Semaphore () . ,
,

( , ).

.
Semaphore,
:
class Semaphore {
public:
Semaphore ();
Semaphore (const Semaphore&);
Semaphore (unsigned int count);
~Semaphore ();
void seize(); // void release(); //
unsigned int nonePending() const;
protected:
};

, ,
.
Guard (),
Semaphore
.
Monitor,
Semaphore, , ,
.
. 9-3,

Guard.
- seize () release (),
.
GuardedUnboundedQueue,
UnboundedQueue:
template<class Item, class StorageManager, class Guard>
class GuardedUnboundedQueue : public UnboundedQueue<Item,
StorageManager> {
public:
GuardedUnboundedQueue ();
virtual ~GuardedUnboundedQueue ();
virtual void seize();
virtual void release();
protected:
Guard guard;
};


: semaphore.

.
. 9-10
; , ,

:
, ,
( ,

. 9-10.
).
,
. , ,
,
; ,
,
.
, ,
.
- .
, ,

.
,
, , ,
.
,
,
.
.
Semaphore,
, .
,
.

.
-, ,
semaphore ( ).
;
.
,
,
,
. ,
- :
.
,
,
,
.
, ,
.

, -
,
-,
:
class Monitor {
public:
Monitor();
Monitor(const Monitor&);
virtual ~Monitor();
virtual void seizeForReading() = 0;
virtual void seizeForWriting() = 0;
virtual void releaseFromBeadingt() = 0;
virtual void releaseFromWritingt() = 0;
protected:

};

:


,
.


,
.
;
-. ;
-. ,
.

Monitor.
Semaphore.
,
-
:
. , ,
. ,

,
,
.
,
. 9-11.
ReadLock WriteLock
-.
, ,
,
.
ReadLock:
class ReadLock {
public:
ReadLock (const Monitor& m)
: monitor(m) {monitor.seizeForReadingt);} ~ReadLock ()
(monitor.releaseFromReading();}
private:
Monitor& monitor;
};

. 9-11.
,
.
WriteLock , ,
.
-
"" ,
. length
:
template<class Item, class StorageManager, class Monitor>
unsigned int SynchronizedUnboundedQueue<Item, StorageManager,
Monitor>::length() const
{
ReadLock lock(monitor);
return UnboundedQueue<Item, StorageManager>::length();
}

, .
9-11. , ReadLock
, WriteLock -
.
,
,
, -
/.
, ,
,
,
. .
, ,
,
;
-.

" ". ,

,
,
. , ,
-
.
operator= ,
:

template<class Item>
Queue<Item>& Queue<Item>::operator=(const Queue<Item>& q)
{
if (this == &q)
return *this;
}

-,
, , ,
.
, lock unlock,
.
;
.
operator=
, :
q)

template<class Item>
Queue<Item>& Queue<Item>::operator=(const Queue<Item>&
{
((Queue<Item>&)q).lock();
((Queue<Item>&)q),unlock();
return *this;
}

,
const .

9.3.

,
, ,
.
(, , )
,
27.

. ,
(. 6),
.
, Set :
setHashFunction

.
clear
.
add
.
remove
.
setUnion
.
intersection
.
difference
,
.
extent
.
isEmpty
1, .
isMember
1,
.

isSubset
1,
.
1,
isProperSubset
.
BinaryTree:
.
clear
.
insert
append
.
remove
.
share
.
.
swapChild
child
.
leftChild
.
rightChild
.
.
parent
setItem
,
.
1, .
hasChildren
1, .
isNull
isShared
1,
.
isRoot
1, .
itemAt
,
.
.

, (. 3).


,
, , ,
Bounded Unbounded, .
, ,
,
,
.
, , :

.
, "" :
"" ,
- .
Dynamic

, (
) ,
(
).
,
Bounded Unbounded,
.
(, DynamicString, GuardedDynamicString,
SynchronizedDynamicString). ,
:

template<class Item, class StorageManager> class Dynamic


{ Public:
Dynamic(unsigned int chunkSize);
Protected:
Item* rep;
unsigned int size;
unsigned
int totalChunks;
unsigned
int chunkSize;
unsigned
int start;
unsigned
int stop;
void resize(unsigned int currentLength,
unsigned int newLength, int preserve
- 1);
unsigned
int expandLeft(unsigned int from);
unsigned
int expandRight(unsigned int from);
void shrinkLeft(unsigned int from);
void shrinkRight(unsigned int from);
};


chunkSize. ,
.
, Dynamic
Bounded Unbounded.
.
.
,
. ,
, .
, .
- .
, .
, - ,
, .
, -
, .

:
template<class Item, class Value, unsigned int Buckets,
class Container> class Table { public:
Table(unsigned int (*hash)(const Item&))
void setHashFunction(unsigned int (*hash)(const Item&));
void clear();
int bind(const Item&, const Value&);
int rebind(const Item&, const Value&);
int unbind(const Item&);
Container* bucket(unsigned int bucket);
unsigned int extent() const;
int isBound(const Item&) const;
const Value* valueOf(const Item&) const;
const Container *const bucket(unsigned int bucket)
const;
protected:
Container rep[Buckets];
};

Container
-

. (
) ,
Table Unbounded:
template<class Item, class Value, unsigned int Buckets,
class StorageManager> class UnboundedMap : public
Map<Item, Value> { public:
UnboundedMap();
virtual int bind(const Item&, const Value&);
virtual int rebind(const Item&, const Value&);
virtual int unbind(const Item&);
protected:
Table<Item, Value, Buckets, Unbounded<Pair<Item, Value>,
StorageManager> > rep;
};
Table
unbounded. . 9-12 .


Table
.

. 9-12.


,
; -. ,
Table,
.
,
. ,
,
, .
- ,
, [16].

, .
,
.

. :



.
0(), - - .
--

0(+). (Knuth-Morris-Pratt) ,
.
-

(-)
0((+)), 1 .
,
.

: (
, ),
,
( ),
( ,
, ).
. ,
, .
, ,
,
. operator==,
PersormelRecord, , ,
, , ,
.
,
( ) ,
. , ,
,

. :
template<class Item, class Sequence> class PatternMatch
{ public:
PatternMatch();
PatternMatch(int ( *isEqual)(const Item& x, const Item&
y));
virtual ~PatternMatch();
virtual void setIsEqualFunction(int (*)(const Item& x,
const Item& y));
virtual int
match(const Sequence& target, const Sequences; pattern,
unsigned int start = 0) = 0;
virtual int
match(const Sequence&; target, unsigned int start = 0) =
;
protected:
Sequence rep;
int (*isEqual)(const Item& x, const Item& y);
private:
void operator=(coust PattemMatcb&) {} void
operator==(const PatternMatch&) {} void operator!=(const
PatternMatch&) {}
};


,
. ,
.

,
-:
template<class Item, class Sequence>
class BMPatternMatch ; public PatternMatch<ltem,
Sequence> {
public:
BMPatternMatch();
BMPattemMatch(int (*isEqual) (const Item& x, const Item&
y));
virtual ~BMPattemMatch();
virtual int
match(const Sequence& target, const Seque unsigned int
start = 0);
virtual int
match(const Sequence& target, unsigned in
Protected:
unsigned int length;
unsigned int* skipTable;

. 9-13.
void preprogress(const Sequence& pattern);
unsigned int itemsSkip(const Sequence& pattern,const
Item& item);
};


. ,

.
,
.
.
. 9-13 .
.
,
,
.

9.4.

, , ,
. ,

,

, ,
. ,
,
.


.
.
,
- ,
,
,
.
,
,
.
, . -,
,
. -, ,
.
.
-, "";
-
. ,
,
. , ,
.
,
(
-
).
,
-. ,
,
, . ,
,
.
. 9-14 ,
. persist
Queue;
Queue :
friend class Persist<ltem, Queue<Item>

>;


- Queue.
,
Persist .
persist
put get,
. :
template<class Item, class Structure> class Persist {
Public:
Persist();
Persist(iostream& input, iostream& output);
virtual ~Persist();
virtual void setInputStream(iostream&);
virtual void setOutputStream(iostream&);

. 9-14.
virtual void put (Structure&);
virtual void get (Structure&);
protected:
iostream* inStreain;
iostream* outStream;
};

,
Structure,
. , Persist
purge, cardinality, itemAt, lock, unlock.
:
Structure , persist

.
Persist::put:
template<class Item, class Structure>
void Persist<Item, Structure>:put(Structure& s)
{
s.lock() ;
unsigned int count = s.cardinality();
(*outStream) " count " endl;
for (unsigned int index = 0; index < count; index++)
(*outStream)
s.unlock() ;
}

" s.itemAt(index);


, ,
. :
, , ,
. persist:: get
:
template<class Item, class Structure> void Persist<ltem,
Structure>::get(Structure& s)
{
s.lock() ;

unsigned int count;


Item item;
if (! inStream->eof()) {
(*inStream) " count;
s.purge() ;
for (unsigned int index = 0; (index < count) && (!
inStream->eof()); index++) { (*inStream) " item;
s.add(item);
} } s.unlock () ;
}

,
,
.
.

, .
:
, .
.
,
.
, ,
. ,
, ,
. ,
,
,
.


(Biggerstaffand Perlis) [H 1989]

. - (Wirfs-Brock) [ 1988]
- . (Johnson) [G 1992]

.
[G 1989] Macintosh
-
.
(Schmucker) [G 1986].
(Goldstein and Alger) [ 1992]
-
Macintosh.
: ( (Meirowitz)
[ 1986]), ( (Yoshida) [ 1988]),
( (Young) [ 1987]), (
(Ferrel) [ 1989]). : ++ (
(Weinand) [ 1989]) MVC- ( (Shan)
[G 1989]). (Coggins) [ 1990] , ,
C++.
-
(Lewis) [
1992].

10

:
-
, ,
.
().
, ,
:
,
- . , , ,
, .
,
,
.
"" ,
.
,

. , -,
. ,
, ,
, , .

,
.
- ,

.
:
,
, .
, ,
-. , "
-
.
,
, , ,
, "
[1]. - (MIS,
management information system) , -

-.

10.1.

.
, ,
.
, , ,
,
.

- ,

(. 7).


"",
.
. ,
,
. ,
.
:


.


.
.

, .


,
, ,
.

.
,
. , ,
. ,

.
. :
, ,
.

; .
.
, , .
.

.
,

, ,
,
.


.


.

.

,
.
,
. -10-1 ,
.

:

,
.
. -,
,
, ,
: , ,
, , ,
,
. ,

. 10-1.
.
, , : ,
, .

.
(LAN),

: ,
, , .

,
.


. .

,
.

, .


, - .
, ,
.
,
.
,
.

. ,
. ,

( ,
, ), (
).
- :
,
, , .
- :
.
,
:
; , ;
,
. ,
,
,
/
.
.
,
.
,
:

.

, ,
. ,
,
.28 ,
, .
, ,
, ,

.
, , :

,
.
, , ,
. ,
.

. ,

( ) . ;

. ( )
. , , - ,
. , Windows, -
, .
,
. :
.
, ;

, .
.
-,
(), .
;

, ,
.
.

, . -,
. 10-1, ,
.
,
. ; , , .
. ,
, .
, ,

.

-

-, ,

.
-, ,
.29
- "
,

. -
,
" [2].
;
,
. ,
- :

,
.
, - .
: , ,
, .

-
,
, , ,
, , -.

, "
...
SQL" (SQL, Structured Query Language,
).

"
,
...
- " [].

.
,
- .
, , POSIX (Portable Operating System
Interface, ), OSI (Open Systems
Interconnection, ), CORBA (Common Object Request
Broker, ), -
SQL (SQL3), OLE (Object Linking and Embedding,
) Microsoft.30

. , ,
.
-:
,
-, .
, ,
,
-.
-,

,
.
,
,
, -
, ,
[4].

, -
. , -:

.
,
.
,
.
[5]. , ,
:

, ,
(
-).
... [].

, -
.


, ,
.
:

, .
.
, .
,
.

.

.
.
.
.
.

.
.
.

.

.

:
.
,
.
, ,
, .
,
.
,
.
.
,
, .
, .
, ,
.
,
.
, ,
.
,
.31
: ,
( ),
80% , ,

.
.
. 10-2 ,
.
.
(aCustomer) (anAgent),
, :
(aCustomerRecord), (inventoryDatabase)
(aPackingOrder),

. 10-2.

. 10-3.
.
.
. 10-3 .
. ,
.
, (shipping),
. , . 10-3,
. 10-2,
. ,
(anOrder) ,
. .

.

? :
?
?
(
)? ,
?

,
. , :
Customer

Supplier

OrderAgent

Accountant

ShippingAgent

Stockperson

PurchasingAgent

ReceivingAgent

Planner

:
. ,
,
. ,
,
. ,

.
:
.
,
:
CustomerRecord

ProductRecord

SupplierRecord

Order

PurchaseOrder

Invoice

PackingOrder

StockingOrder

ShippingLabel

CustomerRecord, ProductRecord SupplierRecord
Customer, Product Supplier. ,
,
.
, : ,
, ,
. , ,
, .
Packingorder StockingOrder
. ,
, (OrderAgent) (order)
(Customer), (StockPerson)
.
Packingorder ( ).
,

. ,
,
. ,
, ,
. ,
:
, , ,
,

. 10-4.
. 32 ,
- ,

.
.
. 10-4 ,

.
,
.

. ,
, , , ,
;
(order) (customer). ,

; ,
, -
. , ,
.
.
.
Order PackingOrder
1:N ( )? -
.
. , , ,
, .
,
.

StockPerson
PackingOrder:
,
.
, :
Report

Transaction

Report ,

,
, ,
, ,
. ,
,
,

.
,
. ,
, ,
.


"
. , , ,
. "" ,

,
... "" , ,
,
" [7].
" , ,

" [8].
,
.

, . ,
, , ,
. ,
,
.
.

, ,
, [9].
, ", ,
, .
, ,
" [10].
, -,

. ,
.

"-" (entityrelationship diagrams). , ,


,
-,
.
,
: "
?" [ 11 ].
, ,
:


.
, ().
.
,
()
(CASE),
.

. ,
, -
, . ,
"" . ,
,
- ,
.
,
-
.
,
,
. , ,
,
,
.
.
, ,
, ,
, .
, :
.
. ,
, - .

", ,
...

:
" [12].

, , .

.
:
products
productId

description

0081735
0081736
3891043
9074000
9074001

Resistor, 10 1/4 watt


Resistor, 10 1/4 watt
Capacitor, 100 pF
7400 1 quad NAND
74LS00 1 quad HAND

,
. ,
(), ; ,
. , productID,
,
.
;
, ,
, , , . ,
:
Suppliers
SupplierID
Company
Address
Telephone
00056
Interstate Supply
2222 Fannin,
806-555-0036
Amarillo, TX
03107
Interstate Supply
3320 Scott, Santa
408-555-3600
Clara, CA
78829
Universal Products 2171 Parfet Ct,
303-555-2405
Lakewood, CD
supplierID - ,
. ,
, .

, .
/:
Prices
productID
0081735
0081735
0156999
7775098
6889655
9074001

SupplierID
03107
78829
78829
03107
00056
03107

Price
$0.10
$0.09
$367.75
$10.69
$0.09
$1.75

.

productID supplierID. , ,
. ,
- ;
productID supplierID
. productID supplierID ,
.

. 10-5 ,
. , ,
,
. .

. 10-5.
, ,
:
Inventory
ProductId
Quantity
0081735
1000
0097890
2000
0156999
34
7775098
46
6889655
1
9074001
92
, -
.
, . 10-4, quantity
ProductRecord, a , ,
quantity . , , ,
(description) ,
(quantity) ,
.
.
, . 10-4,
. productRecord
, quantity .


, .
,

( ).
(, ). ,
.
(, [13])
.
; ,
.
, [14]:
(1NF)
( ).

(2NF) 1NF,
(
).
(3NF) 2NF,

( ).
" ,
" [15].
3NF.
,
, .
, -
,
, .

,
, .

SQL
- ,
,
. , ,
,
.
, ,

,
. , ,
,
,
.
, .
- SQL
(Structured Query Language, ). SQL
, .
SQL
SELECT :
SELECT <attribute> FROM
<relation> WHERE <condition>
, , ,
100 , :
SELECT PRODUCTID, QUANTITY FROM
INVENTORY WHERE
QUANTITY < 100
. ,
:
SELECT NAME, QUANTITY FROM
INVENTORY, PRODUCTS
WHERE QUANTITY < 100 AND
INVENTORY.PRODUCTID =
PRODUCTS.PRODUCTID
,
. SELECT
, .
,
. SQL
, ,
3. , ,
:

DECLARE CURSOR
FOR SELECT NAME, QUANTITY
FROM
INVENTORY, PRODUCTS
WHERE
QUANTITY < 100
AND
INVENTORY.PRODUCTID - PRODUCTS.PRODUCTID
,
OPEN
FETCH:
FETCH INTO NAME, AMOUNT
, , , , ;
CLOSE
:
, .
.
. , , ,
, :
CREATE VIEW V (NAME, COMPANY, COST)
AS SELECT PRODUCTS.NAME, SUPPLIERS.COMPANY,
PRICES.PRICE FROM
PRODUCTS, SUPPLIERS, PRICES WHERE
PRODUCTS.PRODUCTID . PRICES.PRODUCTID AND
SUPPLIERS.SUPPLIERID - PRICES.SUPPLIERID
,

.
,
.
, ,
.
, ,
.
SQL-
. SQL,
. SQL
. SQL-

. ,
, .
: ,
. SQL,
. , ,
C++, :
currentOrder.customer().name()
-
customer, , name, .
:
SELECT NAME
FROM
ORDERS, CUSTOMERS
WHERE ORDERS.CUSTOMERID CURRENTORDER.CUSTOMERID
AND
ORDERS . CUSTOMERID = CUSTOMERS .CUSTOMERID
,
SQL.

-
,
33 , "
- ,
, " [16].
,
( ) :
.
" "
.
" "
[17].

:
.
(
).

( ) [18].
,
SQL .34
, ,
, , ,
.
;

.


: " ,
.
? ,
? " [19].
,
.
,
,
, .
.
,
( , ,
):
CustomerTable
SupplierTable
OrderAgentTable
AccountantTable
ShippingAgentTable
StockPersonTable
RecetvingAgentTable
Flannel-Table
,
:
ProductTable
InventoryTable

, , :
OrderTable
PurchaseOrderTable
InvoiceTable
PackingOrderTable
StockOrderTable
ShippingLabelTable
Report Transaction, -
, .

. ,
;
(. . 10-4),
.

10.2.
,
:
,
, .

/
/
,
, , .
, :
,
,
. ,
,
,
.
Order ProductRecord.
:
construct
setCustomer
setOrderAgent
addItem
removeItem
orderID
customer
orderAgent
numberOfItems
itemAt
quantityOf
totalValue

C++, :
// typedef unsigned int OrderID;
// , typedef float Money;
:
class Order { public:
Order();

Order(OrderID);
Orderfconst Order&);
-Order() ;
Orders operator=(const Orders);
int operator==(const Orders) const;
int operator!=(const Orders) const;
void setCustomer(Customer&);
void setOrderAgent(OrderAgent&);
void addItem(Product&, unsigned int quantity = 1);
void removeItem(unsigned int index, unsigned int quantity = 1);
OrderID orderID() const;
Customer& customer() const;
OrderAgent& orderAgent() const;
unsigned int numberOfItem() const;
Product& itemAt (unsigned int) const;
unsigned int quantityOf(unsigned int) const;
Money totalValue() const;
protected:
...
};
.
(Order ())
OrderID.
,
,
.
OrderID,

. ,
, . ,
, :
SQL-
,
, . , ,
, ,
.
.
order ,
OrderID,
.
,
.
. 10-6 SQL .
:
* aClient setCustomer
Order; Customer .
Order customerID c
,
.

. 10-6.
, , SQL-
UPDATE, .
,

( ,
).
,
,
9. ,

, .
.
. -
. -
, . ,
, .
.
, ,
-,
- .
.
, ,
.

.35
,
.
, ,
, ,
. .
, /
: -, -
; -,
-
, .

product. :
construct
setDescription

setQuantity
setLocation
setSupplier
productID
description
quantity
location
supplier
. ,
, ,
. ,
, ,
:
,
.
,
.
,
(, )
.
,
- -.

. ,
, .
, . 107.
, .
,
? :

.

. 10-7.
, ,
( )
( -).
,
.


/
,

. , "
/" [20]:
(pipes)
(RPC)
/ SQL.
. ,
,

.
,
.
,
. "
,
" [21].
: -
, , ,
,
.
,
, .

.
. ,
,
.
,
:
attachOperation
dispatch
commit
rollback
status
,
. , Transact ion
-, attachoperation,
SQL .
, -
,
. , "
SQL (, SQL),

".36

.
,
, .
, (dispatch),
.

(commit).
, -
.
(rollback). status ,
.


.
,
,
?
[23]. ,
Transaction,
. .
, ,
commit.
.
.
,
. , Transaction ,
.

. 10-8.
.
10-8. . Transaction

.
. , ,
UpdateTransaction QueryTransaccion,
: ,
- . ,
, .
, ,
,
. , ,
,
AddTransaction DeleteTransaction,
.
, Transaction
. , C++
:
public:
Transaction(};
virtual ~Transact ion ();
virtual void set0peration(const
UnboundedCollection<SQLStatement>&);
virtual int dispatch();
virtual void commit();
virtual void rollbackO;
virtual int status{) const;
protected:
...

};
,
, 9.
.

UnboundedCollection.

SQL-.

,
.



. ,

- , . ,
/,
( ) .

: , , ,
.

. -, ,
"" . -, ,

.
,
, .
,
. ,
.
.
,
.
, , Window System MIT,
Open Look, Windows Microsoft, MacApp Apple, NextStep Next,
Presentation Manager IBM. :
, ,
,
.

. .
,
. ,
.
,
.
9 ,
(
) .
GUI- .
, ,
[24]:





/
/.
.37
,
.

Transaction, ,
.
, ,
.

[25]:


.


GUI; ,
.


.
, , MacApp
, Motif - , a Microsoft Windows
.
,
GUI-: , , , ,
, , , ,
. ,
,
GUI- .

GUI- ,
.

10.3.

,
, .
(
) ,
.
:
, .

.
, :
;
: ; ,
.
, :
.

, :
.
, :
.
, .
,
.
12-18
3 .

.
6 ,
,
.
/ , ,
- (
-).

- .



.
, .

(4GL).
- . , 4GL-

.

.
. , ""
- . ,
4GL, ,
, ,
.
4GL,
- .
,
--
- (API) C++.

- .
,
. 38, GUI, " .
,
.

10.4.
/ .
, .

,
.
,
:

.

- .
,
- .
,
, .
--
-,
.


/ ,
. (Dewire) [H 1992] (Berson) [H 1992],

/. (Bloom) [H 1993] ,
/.
- ,
/,
/ - .

(Guengerich) [H 1992].

(Date) [ 1981,1983,1986]. , (Date)
[E 1987] SQL.
(Veryarcl) [ 1984],
(Hawryszkiewycz) [ 1984) (Ross) [F 1987).
-
.
(Cattle) ( 1991], (Atwood) [ 1991],
. (Davis et al.) [H 1983], - (Kim and Lochovsky)
[H 1989], (Zdonik and Maier) [E 1990].

- .
Microsoft Windows API Windows [G 1992],
Apple - [G 1992].

11

,
, . , ,
, .

.
, .
.
- .
.

.

,
. , ,
. , - ,
" (
):
, ;
, ;
,
;
;
" [1 ].

.
, ,
: , ,
, .
; , ,
,
, [2].

,
. ,
- .

11.1.

, .

. , ,
DES (Data Encryption Standard,
,
), , -,
. ,
.

( ,
!) ,
:
Q AZWS DSSC KAS DXZNN DASNN
: w v .

. ,
26 , 26! (
4.031026) . ,
, ,
.
,
. ,
,
.
, :
1. , w v.


" " [].
( )
() .
(
) .
. ,
: B, B C, a Z
. :
CLOS is an object-oriented programming language

:
DMPT jt bo pckfdu-psjfoufe qsphsbnnjoh mbohvbhf

. ,
G, B J . . :
PDG TBCER CQ AL S NGELCH QZBBR SBAJG
: C O

.
,
,
.
,
. ,
, , -

(I, a, or, it, in, of. on).
,
. ,
O, one,our, off.

. ,
qq. g
ing.
, it
ia , if is.
: . ,
, , ,
.

,
.
, ,
or, .

, , on.
: ,
, ,
() .
Q AZVS DSSC KAS DXZNN DASNN

2. , , I; ,
:
A AZVS DSEC KAS DXZNN DASNN

3. ,
. UU II, (
). .
A AZVE DEEC DXZNN DAENN

4. ,
THE.
A HZVE DEEC THE DXZNN DHENN

5. , I, O, U
( ). I
.
A HIVE DEEC THE DXINN DHENN

6. E
(DEER, BEER, SEEN). , ,
SEEN.
A HIVE SEEN THE SXINN SHENN

7. ,
(HIVE) (SEEN), , - .
, ,
, -
I.
:
I HAVE SEEN THE SXANN SHENN

8. . S
, LL
.
I HAVE SEEN THE SXALL SHELL

9. , . S?ALL, SMALL.
I HAVE SEEN THE SMALL SHELL

, . ,
:
: ,
, .
,
, .
, .
( ,
, , THE),
(?? DEER, BEER, SEEN,
SEEN).

.
1962 ,
Hearsay Hearsay II [4].
,
, ,
, [5].
;

[].

(. 9).
.



,
:
,
, .
, ""
(, ).
,
, . ,
, .
. ,
, .

.
, .
.
.
( ) (
, ).
, ,
[7].
. 11-1 , :
- ,
[8]. ,
. :
"
,
. .

" [9].
: "

. ,
.
-

. 11-1.
.
,
" [10].
.
,
, .
, ,
, , ,
, , (, , ,
).

, . ,

,
. ,
( ),
( ).
, (
) ,
( ),

.

, ,
, , .

: ,
,
.
, , :
.
, ""
( ). ,

( ).

,
.

:
, ,
, ,
, , - .
, , ,
.



, . ,
,
, .

.
,
:


(, re, anti, un).


(ly, ing, es, ed).

, .

, ,

.


(tt,ll,ss).

.


(, qu zg).

, .

,
.

-, -, -
.


.

, .


, ,
, , ,
. .
- ,
,
, (),
(
) (
).
.
, , ,
.
: , ,
.

11.2.

,
.
" ":
.
:
, .
,
.
.
,
. , :
Sentence


Word

CipherLetter

,
:
Assumption
,
,
,
:
Alphabet
,


- ?
:
,
, .
:
class BlackboardObject ...


:
register


resign

BlackboardObject, ? ,
. ""
, : " ,
?".
,
(, ).
, , ,
.
. ,
:
. , ,
( )
,
,
.

Smalltalk, 4.
-:
class Dependent {
public:
Dependent();
Dependent(const Dependent&);
virtual ~Dependent();
...
protected
UnboundedCollection<KnowledgeSource*> references;
};


,
, 9. . 39
:
add


remove

numberOfDependents

notify

:
,
.
. ,
- , ,

.
.
:
.
, (Assumption)
(BlackboardObject). ,
, K .
, G J.
:
class Affirmation . . .

(
) .
, . , ,
, .

. , , , .
, .
Affirmation ,
, .
:

make

retract

chiphertext


plaintext

,
:
- .

,
.
, Assumption
Assertion ().
Affirmation .
make retract
:
isPlainLetterAsserted

?

isCipherLetterAsserted
?
plainLetterHasAssumptlon

?

cipherLetterHasAssumption
?
Assumption.
,
:
class Assumption : public BlackboardObject {
public:

BlackboardObject* target;
KnowledgeSource* creator;
String<char> reason;
char plainLetter;
char chipherLetter;
};

, ,
9, , String.
Assumption ,

.
:
target
,

,
creator


reason

cipherLetter


:
" - "
- (, ).
target . .
,
, ,
, .
Assertion:
class Assertion : public Assumption ...

Assumption Assertion
:
isRetractaole
?

isRetractable , - .
.

. 11-2.
. 11-2 ,
. ,
. ,
KnowledgeSource (creator)
, - (referencer) .

.
.
,
(Sentence), (Word) (cipherLetter).
(
), , , :
class Sentence : public BlackboardObject,
virtual public Dependent {
public:

protected:
List<Word*>. words;
};
Dependent ,
, sentence,
Dependent.
Dependent .
register resign (
BlackboardObject) ,
Dependent,

:
.
value
,
isSolved
.

value .
isSolved , value
.
.
.
,
. Word :
class Word : public BlackboardObject,
virtual public Dependent {
public:

Sentence& sentence() const;


Word* previous 0 const;
Word* next() const;
protected:
List<CipherLetter*> letters;
};

,
:
value
.
,
isSolved
.
cipherLetter ( ).

. , (,
, , )
.
Affirmation.
:
class CipherLetter : public BlackboardObject,
virtual public Dependent {
public:

char value() const;


int isSolvedO const; ...
protected:
char letter;
Affirmation affirmations;
};

,
.

.
affirmations, ,
.
.

.
Affirmation :

moatRecent

n- (
statementAt
)
,
. ,
:

UnboundedOrderedCollection<Assumption*> statements;


9.
Alphabet ().
, .
,
,
. , ,
,

.
:
. Alphabet
:
class Alphabet : public BlackboardObject {
public:
char plaintext (char) const;
char ciphertext(char) const;
int isBound(char) const;
};
, CipherLetter, Alphabet
affirmations

.
, Blackboard,
Blackboardobject :
class Blackboard : public DynamicCollection<BlackboardObject*>
...

(
),
,
DynamicCollectlon.
Collection, ,
, :

reset

assertProblem

connect
,
issolved
retriaveSolution

. . 11-3 ,
Blackboard.
. (, Assumption
) .

. 11-3.
, Blackboard
- DynamicCollection, .
, Dependent
. Blackboard,
.


,
.
( )
.
.
, KnowledgeSource (
BlackboardObject).
,
, - .
, :
, - ,
. :
class SentenceKnowledgeSource : public KnowledgeSource ...
class WordKnowledgeSource : public KnowledgeSource ...
class LetterKnowledgeSource : public KnowledgeSource ...


. SentenceKnowledgeSource
:
class SentenceStructureKnowledgeSource : public
SentenceKnowledgeSource ...
class SolvedKnowledgeSource : public
SentenceKnowledgeSource ...

, WordKnowledgeSource
:
class wordStructureKnowledgeSource : public
WordKnowledgeSource ...
class SmallWordKnowledgeSource : public WordKnowledgeSource
...
class pattemMatchingKnowledgeSource : public
WordKnowledgeSource ...

. ,
.
, ,
, grep UNIX:

?

~

*

{

}
,
?~{ I O U},
, , , .
,
, ,
.
, (.
9).
:
class PatternMatchingKnowledgeSource : public
WordKnowledgeSource { public:
...
protected:
static BoundedCollection<Word*> words;
REPattemMatching pattemMatcher;
};

,
.

,
.
stringKnowledgeSource
:
class CoinmonPrefixKnowledgeSource : public
StringKnowledgesource ...
class ConunonSuffixKnowledgeSource : public
StringKnowledgesource ...
class DoubleLetterKnowledgeSource : public
StringKnowledgesource ...
class LegalStringKnowledgeSource : public
StringKnowledgesource ...

, LetterKnowledgeSource:
class DirectSubstitutionKnowledgeSource : public
LetterKnowledgeSource ...
class VowelKnowledgeSource : public
LetterKnowledgeSource ...
class ConsonantKnowledgeSource : public
LetterKnowledgeSource ...

class LetterPrequencyKnowledgeSource : public


LetterKnowledgeSource ...

. ,
:
Reset
.
.
evaluate
-
:
,
.
:
.

.
.
-
.
.
.
(InferenceEngine) ,
, (
),
( ).
:
class InferenceEngine ( public:
InferenceEngine<DynamicSet<Rules*>};
...
};


.
:
evaluate
.
, :

InferenceEngine.
, KnowledgeSource::evaluate
InferenceEngine::evaluate,
. . 11-4
:

. 11-4.
? ( Lisp)
, :
((* I ? ?)
(* I N G)
(* I E S)

(* I E D))

, *I?? ( antecedent) ING, IES IED ( consequent). C++


:
class Rule{ public:

int bind(String<char>& antecedent, String<char>&


consequent);
int
remove(Strlng<char>& antecedent);
int
remove(String<char>t antecedent, String<char>&
conseiruent);
int
hasConflict(const String<char>& antecedent)
const;
protected:
String<char> antecedent;
List<String<char> > consequents;
};


.
9.
,
. ,
,
. ,
. , ,
.
:
class KnowledgeSource :
public InferenceEngine,
public Dependent (
public:
KnowledgeSource(Blackboard*, Controller*);
void reset() ;
void evaluate {) ;
protected:
Blackboard* blackboard;
Controller* controller;
UnboundedOrderedCollection<Assumption*> pastAssumptions;
};
pastAssumptions,

.
Blackboard
. ,
KnowledgeSources, ,
:
class KnowledgeSources : public
DynamicCollection<KnowledgeSource*>...

,
13 .
:
restart
.

StartKnowledgeSource
.

connect
.

. 11-5.
. 11-5
.



.

. , ,
.
,
, ,
,
evaluate.
,
? :
.
- , ,
.
, ,
.
,
.

KnowledgeSources. ,
,

.
.

controller :
reset
.

addHint
.
removeHint

.

processNextHint
.
. , .
isSolved
UnableToProceed . ,
.
connect

.
:
class Controller {
public:

void reset{);
void connect(Knowledgesource&);
void addHint{KnowledgeSourceu);
void removeHint(KnowledgeSourceu) ;
void processNextHint () ;
int isSolved() const;
int unableToProceed() const;
};

,

.
. 11 -6.
,
: (Initializing), (Selecting),
(Evaluating), (Stuck) (Solved).

. selecting
(CreatingStrategy)
(ProcessingHint) , ,
(SelectingKS).

. 11-6.
,
Evaluating,
. Connecting
Baclctraking,
,
.
solved (
) stuck ( ).

11.3.

, ,
.
,
.
. . 11-7
,
,
. 11-1.
theBlackboard theKnowledgeSources
.
Cryptographer.
, .

. 11-7.
,
, .
:
reset


decipher

, .
reset : ,
.
decipher - .
,
- :
char* solveProblem (char* ciphertext) {
Cryptographer theCryptographer;
return theCryptographer.decipher(ciphertext);
}
decipher .
assertProblem .

. , ,

,
.
,
C++ :
theBlackboard.assertProblem();
cheKnowledgeSources.reset() ;
while (StheController.isSolvea ||
!theController.unableToProceed() )
theController.proceaaNextHint();
it (theBlackboard.isSolved())
return theBlackboard.retrieveSolution() ;


.
,
.
, decipher,
assertProblem retrieveSolution. ,
. :

if
return -
- (
)
for if


-

else
" "

6 ,
.
,
C++ .
retrieveSolution :
, .
isSolved True,
.
. ,
.
.
.
, .
. 11-8 .
,
.
, ,
. ,
,
.

. 11-8.
. ,
I ( ). ,
, - NN (
). ,
. Assumption
,
().
, .

,
,
( InferenceEngine),
. ,
,
, evaluateRules. ,
.
,
.
:
,
, .

.
.

(, ).
, ,
, .
.
.

/ . ,


. ,
-
StructureKnowledgeSource, ,
.
.
,
. ,

- . ,
-
.

11.4.


.

.
:
, . .,
,
.
. ,
, - - ,
. ,

.

, . ,
Action, :
class Action ( public:
Action(KnowledgeSource* who, BlackboardObject* what,
char* why);
Action<Controller* who, KnowledgeSource* what, char*
why);
};

, ,
- . who ()
, what () -
, why () - -
(, ).
,
. , .
, :
, ;
, ;
, ;
, ;
, .
:
.
,
.
,
: ? ? ? ?.
,
Actions.


,

. ,
:
;

, ()
;
.
,
.
. Alphabet
.
,
.
.
, ,

.
,
. ,
,
.
( ,

)
.

.


(Shaw) [A 1991]
.
(Englemore and Morgan) [ 1988]
, ,
, . : 1 BLOB,
.
(Hayes-Roth) D 1985] (Nil) [) 1986].


(Barr and Feigenbamn) [J 1981 ], (Brachman and Levesque)
U 1985], -, (Hayes-Roth, Waterman, and Lenat) [J
1983], (Winston and Horn) [Gl 989].
(Meyer and Matyas) [I 1982]
.

12

:

,
:

.

. , - ,
.
,
.
, . ,
, ,
,
,
. , ,
,
.
. ,
, , -
, - .
,
,
, ; ,
, .
, .
.
,
, " "
, .
, :
, ,
. , - .
, - .

.
. ,
.

12.1.

, ,
.
. ,
,
.
;
- ,
. , .
,


.
- ,
, .


- .
,
, , ,
.

, , , [I].
,
,
: Amtrak, Burlington, Canadian National Railway
Company, CP Rail, CSX Transportation, Norfolk and Western Railway Company,
Southern Railway Company, Union Pacific.
, ; -


:
,
. :
, , ,
, ,
. . 12-1
[2].

. 12-1.


, , , ,
,

, , .
,
- .
,
.

.

,
. :
, , , ,
. ,

,
. , ,

.
-
.
,
.
.

,
, .


(GPS, Global
Positioning System) Navstar.
,
.
,
( ).
(
), .
, GPS,
.
, (, ), (,
).
(,
) .
. ,
.
,
.
,
.

.

,
.
.
,
,

, ,
,
.
.
.
;

.
,
, ,

.
.
(
), (
, , ).
,
, ,
.

.
.
, ,
.
,
, .

. , .

.
-
.
,
, , .
,
:
.
.
,
,
. ,
.

, . 7,
,
; ,

. , ,
.
.40
.
,
. ,
,
: ,
, .


. ,
. ,
, ,
, - .
,

. - ,
,
.

:
, ,
,
,
.

, .
, , , , . . , , . 121- .
,
-. ,
,
.
. , 4:
.

.
( . 12-1),

, 6.
,
, ,
. . 12-2
,
.
, .
, -
, .

.41 6 " 80%". ,

. 12-2.

80%
. 100% .
,
,
(
,
).
- , ,
. ,
. ,

. , ,
.
, , ,
,
, .
, ,
, .
,
.
,
. ,
,
: ,
,
.
. 12-3
;
. . 12-1.
, ,
,
, .
, , , ,
, , ,
. ,
, ;
.
(
) ,
-

. 12-3.

.
(
).
:
( ).

, .

: ,

.
,
.
6 7, ,

.
.
,
,
,
.
. ,
, , ,
.



, :


"/"
.
,
?
.
: ,
,
,
. ,
.

.
,
.


. ,
.
-
. ,
;
.
, UNIX Windows, (
) -,
,
. ,
.
,
.
, ,

.

.
,
. ,
, , -
,
. ,
.

, :
.

, .
, , ,

.

. ,
.
, .

( ) :



.
.
. ,

,
.

12.2.
6,

, .
,
.
(
),
.

.


,
- .
,
.
: ,
,
.
:

.
.
,
, ,
.
-
(. . 12-3).
: (1)
? (2)
? (3)
? .
, ,
""
( - , , -
, ).
,
, .

.

, . ,
,

, , , ,
.
,
. ,
, .
. 12-4
. ,

Message, -

. 12-4.
, .
:
, , .
.
.
,
;
, , ,
,

. ,
, .

.
. ;
//,
typedef unsigned int Packetid;

//,
typedet unsigned Int NodeId;

Message:
class Message {
public:
Message () ;
Message(NodeId sender);
Message(const Message&);
virtual `Message () ;
virtual Message& operator=(const Message&);
virtual Boolean operator==(const Message&);

Boolean operator!=(const Message&);


PacketId id() const;
Time timeStamp() const;
NodeId sender() const;
virtual Boolean isIntact() const = 0;
};


, , ,
( , ,
).
, - , .
,
.

. , ,
.
.
. 12-4, , .
,
,
-

. 12-5.
. -

,
.
,
.
: ,
,
, ,
.
.
. 12-5
. , ,
,
, .
,
, .

Transporter (),
.

, ,
, ,
- .
Listener () ,
,
.
, ,
nextMessage.

ISO OSI [4]. ,

, .
,
, , . ,

,
.


,
.
,
. .
,
.
.
, ,
- , .
,
.
.
. 12-6 ,
TrainPlan. 10,
, ,
( ,
"-"). , ,
. ,

, , , , ,
. , :

0800
1100


40 /

1300

Pueblo
Colorado
Springs
Denver

1600

Pueblo

40 /


30

20

. 12-6 , TrainPlan
UniqueId, ,
TrainPlan.
Mssage ,

; ,
.

,
. . 12-6
. :
?
,
,
.
.
:
, .
, ,

. 12-6. TrainPlan ( )
, ,
. ,
.
,
,
.

. ,
.
( )
, ,
, .
. 12-7 ,
.

.

. 12- 7.
- ( get UniqueId
) ,
. ,
. ,

. , .

. , ,
,
.
,
;
,
.
? ,
. ,
: .
,
.

, ,
.



.
,
, , Microsoft Windows
Windows.
,
.
,
.
, ,
. ,
: (
). , ,
,
. ,
, ,

.

, . ,
,
.
, . , ,
,
.
, .
.
, ,
,
. -

Pc. 12-8.
,
.
. 12-8
.
Windows,
. , Windows API
.
; , Windows
API .
,
,
. ,
() ,
TrainDisplayUtilities.

.


,
. ,
, ,
, , . .

. ,
- , . ,
-
.

,
.
. ,
- , .
,
. ,
(, ),
-
.

, .
,
. ,
, .


, .
8,
.
.
.

.

12.3.

,
, ; ,
,
.
,
.


. , , ,
. ,
.
,
,
. ,
.
, , ,
,
.

, ,
, (
). 7,
,
.
.

, ,
.

,
,

.

, .

.
? 4
,
. ,
,
.
,
. ,
, ,
. ,
.
. 12-9
.
:
, ,
, "/".

. 12-9.


,
, .
, ,
,
. ,
; ,
. C++
,
.
. 12-9 , ,

.
.
NetworkFacilities ().
, -
(RadioCommunication ()), - (Messages
()).

,

.
, Databases ( ),
NetworkFacilities
, .
,
TrainPlanDatabase ( ) TrackDatabase (
). , ,
DatabaseManager (
).
Devices ()
. ,
, , ,
, - .
Devices,
TrainPlanDatabase Messages.
, Devices
, .
,
UserApplications ( )
, EngineerApplications ( )
DispatcherApplications ( ),

. EngineerApplications ,
, ,

. DispatcherApplicatlona
"/".
EngineerApplications DispatcherApplications
, Displays (),
.

,
. ,
,
. 7,
,
.

. ,
,
.
7
.
,
- , -
, - . .

, ,
. .

. ,
. ?
.
, 4 :

?
? ?
, TrainPlanDatabase.
(Messages, TrainDatabase,
TrackDatabase) -
WaysideDevices ( ), LocomotiveDevices (
), EngineerApplications DispatcherApplications.
TrainPlanBatabase -
. , ,
.
, ,
- ,
Messages.
TrainPlanDatabase?
: ,
, . 10,
C++,
.

. , ,
, . ,
, , ,
,
( ), ,
- .

12.4.


, ,
. , ,
( ).

,
,
.
:
. , ,

, ,

.
.
, ;
,
.
,
. ,
.
,
, ,
. . ,
.

?
.
UserApplications.
, .
- :

.
, :
,
.
? .
TrainPlanDatabase
DispatcherApplications, ,
, TrainPlanDatabase; ,
DispatcherApplications
. ,
. ,
,
11.


, ,
. , ,
,
.42
. ,

. ?

,
.
, ,
,
. ,
Displays. ,
,
, .
,
.
, Massages
. ,
; Messages
.
, , ,
. -
- .



(Advanced Train Control System),
(Murphy) [ 1988].

. , (Plinta, Lee, and
Rissman) [ 1989]

,
.


.
- ,
, ,
, ,
.

(GUY
LEFRANCOIS)
(Of Children)

- - .

.
.
,
,
-

,

.

- -
-
- . ,
,
- .
, :


[1].
,
, .
, , ,
- C++ Smalltalk.

.1.

.
.
-

. -1. -
.
-
.

,
, , .
2
: ,
, , -.

.
- .
2, ,
; -
,
.

- Simula, 1960
, [2]. Simula
ALGOL, .
, Simula,
, ,
.
. -1, [],
-

: Smalltalk. Object Pascal, C++,


CLOS Ada.
"".

.2. Smalltalk

Smalltalk Xerox Palo Alto Research


Center Learning Research Group (Xerox, , ,
), Dynabook (Alan Kay).
Simula, FLEX
(Seymore Papert) (Wallace Feurzeig).
Smalltalk ,
. - - ,
; - .
Simula, Smalltalk -
,
,
,
Macintosh, Windows Motif.
Smalltalk
.
(Dan Ingalls),
(Peter Deutsh), (Glenn Krasner) (Kim McCall).
, (James Althoff),
(Robert Flegal), (Ned Kaehler), (Diana Merry)
(Steve Putz) Smalltalk.
(Adele Goldberg) (David Robson)
.
Smalltalk,
:
Smalltalk-72, -74. -76, -78, - Smalltalk-80.
1972 1974 ,
,
.
; , .
Smalltalk-80 .
( Smalltalk-80),
Smalltalk/V. Digitalk IBM PC
(Windows OS/2) Macintosh.
, Smalltalk/V
. Smalltalk-80
[4].

: " Smalltalk -
. ,
,

" [5].
:
; ,
.

. -1 Smalltalk
.

- [].
-1. Smalltalk

()

( )

: ,
, (.
3). Smalltalk
, ,
.
, -
. AShape :
Object subclass: AShape

instanceVariableNames: 'theCenter'
classVariableNames: ' ' poolDictionaries: ' '
category: 'Appendix'
initialize

" "
theCenter:= Point new
setCenter: aPoint

" "
theCenter := aPoint
center

" "
^theCenter
draw

" "
self subclassResponsibility
ACircle:
AShane subclass: #ACircle

instanceVariableNames: 'theRadius'
classVariableNames: ''
poolDictionaries: ''
category: 'Appendix'
setRadius: anInteger

" "

theRadius := aInteger
radius

" "
^theRadius
draw

" "
| anArc index |
anArc := Arc new.
index := 1.
[index <= 4]
whileTrue:
[anArc
center: theCenter radius: theRadius quadrant: index. anArc display. index :=
index + 1]
ARectangle:
AShape subclass: ARectangle

instanceVariableNaines: 'theHeight theWidth'


classVariableNairies : ' '
poolDictionaries: ''
category: 'Appendix'
draw

" "
| aLine upperLeftCorner |
aLine := Line new.
upperLeftCorner := theCenter x - (theWidth
/2)@
(theCenter - (theHeight /2)). aLine beginPoint: upperLeftCorner.
aLine endPoint: upperLeftCorner x + theWidth @
upperCorner y.
aLine display.
aLine beginPoint:: aLine endPoint.
aLine endPoint: upperLeftCorner x + thewidth
(upperCorner +
theHeight). aLine display.
aLine beginPoint: aLine endPoint. aLine endPoint: upperLeftCorner x @
(upperLeftCorner
+
theHeight). aLine display.
aLine beginPoint: aLine endPoint. aLine endPoint: upperLeftCorner. aLine
display
setHeight: anInteger

" "
theHeight := anInteger
setWidth: anInteger

" "
CheWidth := anInteger
height

" "
^theHeight
width

" "
^thewidth
, ASolidRectangle :
ARectangle subclass: #ASolldRectangle

instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Appendix'
draw

" "
I upperLeftCorner lowerRightCorner I
super draw.
upperLeftCorner := theCenter x - (thewidth quo: 2) + 1
(theCenter - (theHeight quo: 2) + 1). lowerRigthCorner :=
upperLeftCorner x + thewidth - 1
(upperLeftCorner + theHeight - 1). Display
fill:
(upperLeftCorner corner: lowerRightCorner)
mask: Form gray

Smalltalk
"Smalltalk-80:
The Language", [7]; "Smalltalk-80: The Interactive
Programming Environment", [8]; "Smalltalk-80: Bit of History Words of
Advice", Kpac-, [9]. [10] Smalltalk-80,
.

.3. Object Pascal

Object Pascal Apple Computer


( Smalltalk)
(Niklaus Wirth), Pascal.
Object Pascal Clascal
(- Pascal Lisa). Object Pascal
1986 -
, Macintosh Programmer's Workshop
(MPW), Macintosh Apple. MPW
, ,
,
Macintosh.

(Schmucker) , "Object Pascal - ""


- . ,
, .
,
"" " [II].
. -2 Object Pascal.
-2. Object Pascal

(unit)

()

Object Pascal "MPW Object Pascal


Reference" Apple [12].1

.4. C++

C++ ,
AT&T Bell Laboratories.
C++ with Classes, 1980 .
with Classes, , Simula.
C++ - .
C++ , ,
, . , C++
.
C++. 1.0
- ,
,
. 1989 2.0
(, ),

. 3.0 (1990)
( ) . ANSI C++
(X3J16) (
)
.
C++
, cfront.
, C++
UNIX-.
( ) "" C++.

: "C++
,
. ,

. C++ .
, "
[13]. C++ ,
, , , , ,
, [14].

Delphi Borland. - . .
C++ . -3.
-3. C++

, ,
, ,

()

( )

. C++
.
:
struct point {
int x;
int ;
};
class Shape {
public:
Shape();
void setCenter (Point p};
virtual void draw() = 0;
Point center 0 const;
private
Point theCenter;
};
class Circle : public Shape {
public:
Circle();
void setRadius(int r);
virtual void draw();
int radius() const;
private:
int theRadius;
};
class Rectangle : public Shape {
public:
Rectangle();
void setHeight(int h);
void setWidth(int w);
virtual void draw();
int height () conat;
inc width () const;

private:
int theHeigh;
int TheWidth;
};
class SolidRectangle : public Rectangle {
public:
virtual void draw();
};
C++ .
Windows
Display, window, GraphlcsContext ( xlib).
,
, :
Shape::Shape()
{
theCenter.x = 0;
theCenter.y = 0;
};
void Shape::getCenter(Point p)
{
theCenter = p;
};
Point Shape::center() const
{
return theCenter;
};
Circle::Circle() : theRadius(0) {};
void Circle: :setRadius( int r)
{
theRadius = r;
};
void Circle::draw()
{
int x = (center ().x - theRadius);
int Y = (center(). - theRadius);
XDrawArc(Display, Window, GraphicsContext, X, Y,
(theRadius 2), (theRadius * 2), 0, (360 64));
};
int Circle::radius() const
{
return theRadius;
};
Rectangle::Rectangle() : theHeight(0), theWidth(0) {};
void Rectangle: :setHeight( int h)
{
theHeight = h;
};

void Rectangle: :setWidth( int w)


{
theWidth = w;
};
void Rectangle::draw()
{
int X = (center().x - (theWidth / 2));
int Y = (center (). - (theHeight / 2));
XDrawRectangle (Display, Window, GraphicsContext, X, Y, thewidth,
theHeight);
};
int Rectangle: : height() const
{
return theHeight;
};
int Rectangle: : width () const
{
return thewidth;
};
void SolidRectangle::draw()
{
Rectangle::draw() ;
int x - (centerO.x - (width() / 2));
int Y - (center().y - (height() / 2));
gc oldGraphicsContext = GraphicsContext;
XSetForeground(Display, OraphicsContext, Gray);
XDrawFilled(Display, Window, GraphicsContext, X, Y,
width (), height());
GraphicaContext = OldGraphicsContext;
};

C++ "Annotated C++ Reference Manual"


[15]. , [16]
.

.5. Common Lisp Object System (CLOS)

Lisp,
MacLisp, Standard Lisp, SpiceLisp, S-1 Lisp, ZetaLisp, Nil, InterLisp Scheme.
80- -
Lisp,
.
Common Lisp 1986 .
ACM
Lisp 1986 ,

X3J13 ANSI (
Common Lisp).
Common Lisp, Common Lisp Object
System ( Common Lisp) , , - CLOS.
(Daniel Bobrow),
(Sonya Keene), (Linda DeMichiel), (Patrick
Dussud), (Richard Gabriel), (James Kempf),
(Gregor Kicazles) (David Moon).
CLOS NewFlavors
CommonLoops. , 1988
CLOS.

, CLOS .
CLOS :
,
-
;
,
;
, ,
,
- [17].
CLOS . -4.
, CLOS
, [18].
-4. CLOS

,,

()

CLOS -"Common Lisp


Object System Specification" [19].

.6. Ada

, ,
. 70-
:

,
. , ,
,
. ,
,

. Ada
, .
1975 (Steelman)
1978 . ,
17 . , ,
;
.
- Green (
); Ada
(Ada Augusta Lovelace),

. (Jean Ichbian)
. : - (Bernd
Krieg-Brueckner), (Brian Wichmann), (Henry
Ledgard), - (Jean-Claude Heliard), - (Jean-Loup
Gailly), - (Jean-Raymond Abrial), (John
Barnes), (Mike Woodger), (Olivier Roubine), . .
(S. A. Schumann) . . (S. . Vestal).
Ada Pascal
, Euclid, Lis, Mesa, Modula Sue.
ALGOL-68, Simula, CLU Alphard. ANSI
Ada 1983 . Ada, ,
.
, Ada
. Ada -
, ,
. ANSI
,
Ada 9x.
: , ,
. Ada ,
- . 9x
-.

Ada :
;
;
[20].
. -5 Ada
.
-5. Ada

,
,

( Ada9x)

( Ada9x)

Ada "Reference Manual for


the Ada Programming Language" [21].

A.7. Eiffel

Eiffel (Bertrand Meyer)


- ,
.
Simula, Eiffel -
- .
Eiffel
,
. Eiffel
, ,
, . ,
,
;
, ,
.
- ,
,
. .
, .

Eiffel ,
, ,
, .

.
Eiffel ,
,
, . ,
.
. -6.
-6. Eiffel

(unit)

"Object Oriented Software


Construction" [22].

.8. -

. -2
- ,
.
ABCL/1
ABE
Acore
Act/1
Act/2

EmeraldNew
FlavorsSASTAct/3
Actors
Felix
PascalOakUspSelfActra
Argus
ART
Berkeley Smalltalk
FOOPS
ObjectCobot
Smalltalk

Concurrent Smalltalk
CSSA
CST
Director
Distributed Smalltalk
Eiffel

Lore
Mace
MELD
Mjolner
ModPascal
Neon

Plasma 11
POOL-T
PROCOL
Quick Pascal
Quicktalk
ROSSActor

ExperCommonLisp
Extended Smalltalk

NIL
0-CPU

SCOOP
SCOOPSAda

Flavors
FOOPlog

Oberon
Object Assembler

Simula
SINA

Object Lisp
Object Logo
Object Oberon

Smalltalk AT
Smalltalk V
Smallworld

OOPC
OOPS+

STROBE
TClassic

Beta
FRL
Blaze
Galileo
GLISPObject
Garp
PascalSPOOLC++ Gypsy
Objective-C SR _
talkHybridObjVLispSRLBro
uhaha
Cantor
Inheritance
IntermissionOPALTrellis/Ow InnovAda
lClascal
Jasmine
KL-

OneOrient84/KUniform

Orbil

wilh Classes

Ada

Turbo Pascal 5.xCluster

86

Common
LoopsKRLOTMUNITS
Common
ObjectsKRSPCOLVulcanCo
mmon ORBITLittle
SmalltalkPIEXLISPConcurr
ent
PrologLOOPSPL/LLZoom/V
MCLOS

. -2. -

[23] . [24]:
Actor
,
.

-,
.

- ,
.

, .


-
.
Smalltalk
Smalltalk .


.

.


CRC-, CRC cards. CRC Class/Responsibilities/Collaborators,
/-/; ,
.
, abstract operation. ,
. C++
-.
, abstract class. , .
,
, , .
, abstraction. ,

. .
.
, agent. ,
.
.
, actor. , ,
. ,
.
, active object. ,
.
, algorithmic decomposition.
, .

, , module architecture. ,
, .
.
, process architecture. ,
, .
.
, architecture. ,
.
, association. ,
.
, attribute. ().
, base class. - .
.

, .
, blocking object. ,
.
.
, visibility. ,
, . ,
.
.
, virtual function. - .
, ,
,
.
.
, time complexity. ,
.
, action. , ,
, .
, , .
, delegation. ,
, .
, destructor. ,
/ .
, activity. ,
.
, interaction diagram.
- ;
- .
, class diagram. ; ,
.
.
, module diagram. ;
.
.
, object diagram. ; ,
.
; .
.
, state transition diagram.
- ;
, ,
, , .

, process diagram. ; , ,
.
.
, dynamic binding.
(, ) .
,
, .
, friend. ,
. .
, private. - , ,
() , .
, protected. - ,
, ,
.
, identity. ; ,
.
, idiom. , -
- ,
- .
, hierarchy. .
( /)
( /);
.
, invariant. ,
.
, encapsulation. ,
.
.
, instantiation.
; ,
.
, interface. , ,
.
, exception. ,
. C++ ,

, .
, use. . , iterator. ,
.
, class category. ,
, ~ .
.

, class. .
( ) .
,
.
-, container class. ,
. (
) (
, ), C++
,
.
, client. ,
, ,
, key. , .
, key abstraction. ,
.
, concrete class. ,
, , .
, constructor. , /
.
, metaclass. ; ,
.
, method. , .
, . ,
.
;
,
, .
, mechanism. ,
, , .
, modifier. , .
, module. ,
; , ,

. ,
.
, modularity. ,
.
, monomorphism. ,
(, )
.
, cardinality. : ,
.

, inheritance. ,
( )
( ) . /
.

.
, generic function. - .
; ,
,
.
.
, generic class. ,
: , /
. .
.
.
, reverse-engineering.
. .
, object, , . ,
.
. .
, object model. ,
- ;
, , ,
, , , .
, object-based programming.
,
, .
, .
, ,
.
- , object-oriented decomposition.
,
. -
- ,
,
.
- , object-oriented programming
(OOP). , ,
,
- , .
, ,
.
- , object-oriented design (OOD).
, -
,
.
, , .

- , object-oriented analysis. ,
,
.
-, member object. . . ,
. - .
, constraint. ,
.
, class operation. , ,
, .
, operation. , ,
. , - ,
- ().
, .
, responsibility. , .
, public. - , ,
() , .
, concurrency. ,
.
, concurrent object. ,
.
, parameterized class. ,
; , /
.
. .
.
, passive object. ,
.
, class variable. .
.
. C++ .
, instance variable. .
.
, , - .
, transition. .
, behavior. ,
;
.
, subclass. ,
( ).
, subsystem. ,
, .

, field. ;
. , , -
.
, polymorphism. ,
(, ) (
) . , , ,
- .
, round-trip gestalt design.
,
: ,
; -
,
.
, sequential object. ,
.
, postcondition. , .
, thread of control. .

; ,
.
.
. (
thread of control .
. ,
flow of control, . .
.)
, precondition. , .
, mixin. , - ;
;
, .
, space complexity,
, .
, state space.
. ,
( ).
, protocol. ,
; ;
.
, process. . , processor.
, .
, forward-engineering.
. .
, partition. ,
.

, reactive system. , .
-.
, implementation. ,
, .
, role. ,
;
; ,
.
, free subprogram. ,

. ,
- .
, link. , . , selector.
, , .
, server. , ,
; , .
, signature.
.
, strongly typed. ,
.
, synchronization. .
( );
( ); (,
); (,
); (
).
, real-time system. ,
.
;
.
, information hiding.
, ;
.
, data dictionary. . ,
layer. .
, slot. ;
. , , -
.
, event. -, .
, message. ,
. , .
(), aggregate object. ,
( ).

, state. :
, , ;

(, ) (, )
.
, collaboration. ,
.
, persistence. ,
, () ,
.
, framework. ,
. ,
, .
, static binding.
(, ) .
( ), ,
.
, guard. , ;
, .
, strategic design decision.
, .
, class structure. ,
, .
.
, object structure. ,
, .
.
, structure. .
, ,
.
, structured design. ,
.
, superclass. , (
).
, scenario. ,
.
, tactical design decision. ,
.
, type. ,
, , .
( ) ; ,
.

, typing. ,
, , .
, transformational system. ,
- , access control.
. C++ ,
, ,
. ,
.
, level of abstraction.
, , .
/ ,
, : /,
, .
, service. , .
, device. ,
.
, assertion. ,
.
, class utility. . C++
, / -.
, function point.
, .
, function. -,
.
-, member function. ,
. - , - . - .
- ;
- ,
,
.
, instance. , . ,
.
. .

Вам также может понравиться