Presentation is loading. Please wait.

Presentation is loading. Please wait.

Principles of Object-Oriented Software Development The language Smalltalk.

Similar presentations


Presentation on theme: "Principles of Object-Oriented Software Development The language Smalltalk."— Presentation transcript:

1 Principles of Object-Oriented Software Development The language Smalltalk

2 Introduction Terminology Expressions Control Objects Inheritance Techniques Summary

3 Smalltalk -- a radical change in programming 1972 Dynabook -- Alan Kay 1976 SmallTalk76 1980 SmallTalk80 1990 ObjectWorks/SmallTalk -- VisualWorks Design principles -- rapid prototyping uniform object model -- control dynamic typing -- flexible standard libraries -- functionality

4 Terminology literal -- constants object -- action by messages class -- collection of protocols protocol -- related methods category -- collection of classes Smalltalk

5 Literal constants number -- 1, 34.6, 8r24 character -- $a, $b,... string -- "this is a string" symbol -- #Float byte array -- # [0 255 2 7] array of literals -- # (12.1 # ($a $b))

6 Assignment aVar := 1. Variables temporary, instance, class, pool, global Block expressions [ :arg | expression ]

7 Message expressions unary, binary, keyword Unary 1.0 sin, Random new Binary arithmetic -- ctr + 1 comparison -- aVar >= 200 combination -- 100 @ 200 association -- # Two -> 2

8 Keyword methods (i <= 7) ifTrue: [ m:= "oke" ] ifFalse: [... ] Control structures conditional -- ifTrue: ifFalse: iteration -- whileTrue: looping -- to: by: do: [ :i |... ] Smalltalk -- control

9 Object -- behavior instance variables, methods Class -- description class variables, class methods Self -- self reference super for ancestors Smalltalk -- objects (1)

10 Example -- class Behavior subclass: #Ctr instanceVariableNames: 'value' Ctr methodsFor: 'initialization' initialize value := 0. Ctr methodsFor: 'modifications' add: aValue value := value + aValue. Ctr methodsFor: 'inspection' value ^value Smalltalk -- objects (2)

11 Class description meta class Ctr class instanceVariableNames: ‘ ‘ Ctr class methodsFor: 'instance creation' new ^super new initialize Smalltalk -- objects (3)

12 Inheritance Object Magnitude ArithmeticValue Number Integer Smalltalk -- inheritance

13 Model subclass: #Ctr Model... initialize value := 0. TV open: self.... add: anInt value := value + anInt. self changed: #value. Smalltalk -- technology (1)

14 View subclass: #TV View instanceVariableNames: '' TV methodsFor: 'updating' update: aValue Transcript show: 'ok'; cr. TV class instanceVariableNames: '' TV class methodsFor: 'instance creation' open: aCtr self new model: aCtr Smalltalk -- technology (2)

15 The language Smalltalk design principles -- prototyping terminology -- object, class, protocols syntax -- method expressions objects -- self reference inheritance -- class hierarchy techniques -- MVC paradigm


Download ppt "Principles of Object-Oriented Software Development The language Smalltalk."

Similar presentations


Ads by Google