Title: Where do programming languages come from
1(No Transcript)
2Where do programming languages come from?
Where do programming languages come from? Dad,
where do the programming languages come
from? They come from God, my boy How do
they come down to us, Dad? God has created
something wonderful called inspiration, and
uses that to bring a language into the minds of
some nice and bright people called language
designers. They write it down so that we may
read it and learn it. Dad, why has God made
such strange rules for parameters? Dont
trouble your brain with such difficult questions.
He always has a deeper meaning with what he does.
Read the language manual and learn it by heart!
3Mathematics
Mathematics is about relations Relations between
specified quantities, valid within specified
domains x a x ab Rules for transformation
into other valid relations exist, as x x a
implies 0 a Informatics is about
processes Description of sequences of events
(state transitions) in processes x x a
does not imply a 0 and should instead be
written x a x
4Notation Mathematics, BETA (98-08-11)
In the 1950s it was natural to try to
make programs look like mathematics (Fortran
means Formula Translation)
- Mathematics y x , y F(x)
- Fortran y x , y F(x)
- Algol and Simula used a different operator
- y x y F(x)
- BETA emphasises that programs should describe
processes, not relations - x y , x F y
Mathematics y Fn( F(n-1)(... F2( F1( x ) )..
).).).).).).) BETA (a,b) T12 T23 ...
T(n-1)n (x,y,z)
5The pedagogy
The pedagogics of OO In pedagogics, a well-known
principle is that the basic concepts should be
taught first. More difficult and composite
concepts should come later, after the basic ones
are understood and mastered. Object-oriented
programming is intended to comprehend and
organise complexity. Its basic concepts are
objects, classes, inheritance, with objects
having attributes, virtuals, and possibly action
sequences (threads) that may run
concurrently. Teaching object-oriented
programming thus must begin with exposing
students to complex situation that only may be
mastered by understanding and using these
concepts.
6The Restaurant, main picture
7The Restaurant Waiter!/1
8Waiter! Waiter!!... Waiter!!! Sorry.
Not my table.
RestaurantWaiter!/2
9The Restaurant Waiter!/3
How will these people describe their evening at
Restaurant Objecta? Alternatives We had a
wonderful discussionabout William Blakes
poetry. A sadly dissapointing ChateauBrâne
Cantenac. Two bottlesof excellent Hermitage more
than made up for it. Laura is an
extraordinarilyintelligent woman. You can read
it in her eyes while she listens to
you.Object-oriented programming is not suited
to discussions about poetry, wines, women, men or
gastronomy.
10The Restaurant Waiter!/4
Object-oriented programming is not suited to
discussions about poetry, wines, women or
gastronomy. OK.
F.A.Q
Q But what is OO then suited to describe? A
Systems. Q What is a system? A A system is
something that you have decided to regard as a
system. Q What does it imply to regard something
as a system? A You regard it as a whole,
consisting of components, each component has
pro-perties and may interact with other
components.
A restaurant owner, a head-waiter, an architect,
an infor-mation system designer will often regard
something as a system.
11Waiter! Waiter!!... Waiter!!! Sorry.
Not my table.
RestaurantWaiter!/2
12Waiter! Waiter!! Sorry. Not my table.
What is a table?
What is a table?
13Who will be permitted to enter Restaurant Objecta?
14J. P. Morgan IVs visit at Objecta
J. P. Morgan IVs visit at Restaurant OBJECTA
J. P. Morgan IV arrives every day (except
weekends) at 1700, and leaves 1800. He has
Table 2 reserved, and Peterson, his waiter, has
made everything ready for him. He will drink one
glass (after a smart deal two glasses) of
his special Armagnac 1942, drink Colombian coffee
and smoke a (Cuban, dont mention it) cigar. He
is known for always carrying at least 1000 and
a gun.
15James Smiths visit at Restaurant Objecta
James Smith was hilariouslyhappy when the
wonderfulVenus Jones accepted hisdinner
invitation He had 117.35 to spend. When the
(perhaps) naiveVenus Jones read the menu,she
exclaimed They saythat Russian caviar is
fantastic with champagne!James Smith did not
have the guts to say no. Now their waiter, Aku
Akufrom Easter Island, waitsthe accumulated
bill is 147.50. if fundsnegotiateelse pay and leave
James Smiths visit at Objecta
16Attributes Objects are individual identified
components having substance (material existence
in our environment, on the substrate of our
brain, on paper, in the memory of a
computer).Properties of objects are called
attributes. A reference is an attribute that
indicates some object and its current state is
called its referent. A quantity is attribute that
may be observed and measured, the result being
mapped upon a value set. The current state is
called its value. An action part is an attribute
specifying a sequence of transitions to be
carried out by the object, and the current state
is called its ongoing transition. A pattern
attribute is is an attribute prescribing the
common structure for a category of objects. The
collection of an objects pattern attributes is
called its repertoire.
17Basic qualities of processes
Basic qualities of processes Substance Guests,
waiters, gatekeepers, tables, chairs, menus,
food, drinks, bills State References My table,
My waiter, successor (in queue) Quantities
Available money, food names, prices, smoker,
finished OBS!Action part object begin ...
... end object Pattern attributes
Order Transition Seating, ordering, serving,
eating, paying, negotiating Structure (permanent
properties of the process)
18Basic qualities of processes
Basic qualities of processes Substance Guests,
waiters, gatekeepers, tables, chairs, menus,
food, drinks, bills State Available money, accum.
amounts on bills, guest names, food names,
prices, table numbers, reserved, smoker,
finished, no. of guests, Transition Seating,
ordering, serving, eating, paying,
negotiating Structure
19The queue inside, with the headwaiter as
gatekeeper
The queue outside, with the doorman as gatekeeper
The gatekeepers
20Description of J. P. Morgan IV/1(2000-05-25)
J. P. Morgan IVs visit at Restaurant OBJECTA
GUEST 1 object begin text name (J. P. Morgan
IV) amount funds ( 1000.00), accum bill (
147,50) Boolean smoker (true), finished
(false), reserved table
(true) ref(table) my table (TABLE 2)
ref(waiter) my waiter (PETERSON) procedure
order begin .... end if not reserved then
begin enter(outside queue) wait
end enter(inside queue) wait sit down at my
table attract ( my waiter) get menu order
drinks wait(consider smart deal) drink attract
(my waiter) while not finished do begin order
food order drinks wait (consider smart
deal) eat and drink if smoker then smoke
attract (my waiter) end ask for check wait
(consider smart deal) if accum bill funds
then pay else negotiate leave end object
21James Morgan IVs visit at Restaurant OBJECTA
Colour code Structure, Substance,
State, Transition, Comments
GUEST 1 object begin text name (James Morgan
IV) amount funds ( 1000.00), accum bill (
147,50) Boolean smoker (true), finished
(false), reserved table
(true) ref(table) my table (TABLE 2)
ref(waiter) my waiter (PETERSON) procedure
order begin .... end if not reserved then
begin enter(outside queue) wait
end enter(inside queue) wait sit down at my
table attract (my waiter) get menu order
drinks wait(consider smart deal) drink attract
(my waiter) while not finished do begin order
food order drinks wait (consider smart
deal) eat and drink if smoker then smoke
attract (my waiter) end ask for check wait
(consider smart deal) if accum bill funds
then pay else negotiate leave end object
Description of J. P, Morgan IV/2(2000-05-25)
22Guest James Smith (2000-05-25)
James Smiths visit at Restaurant OBJECTA
GUEST 9 object begin text name (JAMES
SMITH) amount funds ( 113.35), accum bill (
147,50) Boolean smoker (false), finished
(false), reserved table
(false) ref(table) my table (TABLE 6)
ref(waiter) my waiter (AKUAKU) procedure
order begin .... end if not reserved then
begin enter(outside queue) wait
end enter(inside queue) wait sit down at my
table attract ( my waiter) get menu order
drinks wait (admire Venus Jones) drink attract
(my waiter) while not finished do begin order
food order drinks wait (admire Venus
Jones) eat and drink if smoker then smoke
attract (my waiter) end ask for check wait
(nervously) if accum bill funds then pay else
negotiate leave end object
Description of James Smith/1(2000-05-25)
23Guests at Restaurant OBJECTA (2000-05-25)
Guests visit at Restaurant OBJECTA
Structure, Substance, State,Transition, Comments
class guest begin text name amount funds,
accum bill Boolean smoker, finished, reserved
table ref(table) my table ref(waiter) my
waiter procedure order begin .... end if
not reserved then begin enter(outside queue)
wait end enter(inside queue) wait sit down at
my table attract ( my waiter) get menu order
drinks wait drink attract (my waiter)
while not finished do begin order food order
drinks wait eat and drink if smoker then
smoke attract (my waiter) end ask for check
wait if accum bill funds then pay else
negotiate leave end class
new guest (J. P. MORGAN IV, 1000.00, 0,
true, false, true, none, none)
new guest (JAMES SMITH, 113.35, 0,
false, false, false, none, none)
24Cashier in Restaurant OBJECTA (2000-05-25)
25The hub of the money streams. Hopefully, the
cash register model only reflect that the artist
was in a nostalgic mood. Or that it is one of
the modern gimmicks with a com- puter inside.
Cashier (2000-05-25)
26Harbour as restaurant
Guests (ships) waiting outside restaurant
(harbour)
Head waiter (harbour captain)
Guest (ship) being tabled (berthed)
Waiter (crane)
Waiter (crane)
Waiter (crane)
Waiter (crane)
Guests (ships) at tables (berths)
Kitchen (warehouses delivering goods)
Warehouses receiving goods
27Basic qualities of processes
Basic qualities of processes Substance Guests,
waiters, tables, food - Ships, berths, cranes
- Clerks, customers, waiting lines, accounts
- Records, documents, files State No. of guests,
prices, accum. amounts on bills - Largest free
berth length, crane speed, crane max. load
- Client waiting time, clerks average
transaction time - Documents arrival date, name
of sender, department code Transition Seating,
ordering, serving, eating, paying - Assigning
berths, berthing, unloading, loading, leaving
- Waiting, paying, receiving, informing
- Classifying, filing, finding, sending Structure
28Attributes of objects
Attributes of objects (themselves having
substance)
Substance attributes Guests Successor guests in
waiting line, table unit, waiter, menu,
food Waiters Table units, orders,
cashier,chef Ships Berth, crane,
containers Documents Enclosures, sender, receiver
State attributes Guests Available money,
accumulated bill, smoker/non-smoker, finished
Waiters No. of tables, busy/available, accum.
tips Ships Arrival time, length, cargo
load Documents Arrival date, security level,
ref.no.
Transition attributes Guests Entering outside
queue, waiting, waiting inside for table,
getting attention and menu, ordering, waiting,
eating, paying, leaving Waiters Order cycle
Getting orders- informing kitchen - delivering
food, presenting bill, collecting Ships
Arriving, berthing, unloading, loading,
leaving Documents Creation, sending, receiving,
filing, updating
29Reference Substance state - 1 (2000-05-22)
Reference Substance state
Scope
Specifier Block struct.
30Reference Substance state - 2 (2000-05-22)
Reference Substance state
Scope
Specifier Block struct.
internal
31Quantity Measured value state
State
Scope
Structure
Designation
Specifier Block struct.
Category Type
Name, Identifier
Value
Integer
Age
34
Quantities/Measured state(2000-05-25)
32Pattern Structure state (2000-05-22)
Pattern Structure state
33Intercepting cattle herds (98-08-09)
Structural similarity between very diverse
systems Intercepting cattle herds by mobile
milking machines
(Introducing SIMULA 67 to UNIVACs civilian and
military simulation groups in 1967)