































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to object-oriented programming (oop) in smalltalk, focusing on encapsulation, computation as simulation, and creating objects. It covers the concept of objects being responsible for their own actions, the difference between procedural and object-oriented programming, and the importance of encapsulation in oop. Additionally, it discusses the creation of objects through factories and the use of blocks in smalltalk.
Typology: Study notes
1 / 39
This page cannot be seen from the preview
Don't miss anything!
































CSE 420/520: Object-Oriented Programming
Objects are responsible for their own
actions!
that reaches into the internals of some data
structure and twiddles with the bits
0 0 1 1 0 0 1 1
process
reads/
writes
process
reads/
writes
process
reads/
writes
string
CSE 420/520: Object-Oriented Programming
some other object to perform some work on
my behalf, and it politely answers me
0 0 1 1 0 0 1 1
concat
copy
String
Encapsulation
boundary
CSE 420/520: Object-Oriented Programming
some other object to perform some work on
my behalf, and it politely answers me
0 0 1 1 0 0 1 1
concat
copy
String
Encapsulation
boundary
copy
CSE 420/520: Object-Oriented Programming
some other object to perform some work on
my behalf, and it politely answers me
0 0 1 1 0 0 1 1
concat
copy
String
Encapsulation
boundary
aNewString
CSE 420/520: Object-Oriented Programming
some other object to perform some work on
my behalf, and it politely answers me
0 0 1 1 0 0 1 1
concat
copy
String
Encapsulation
boundary
CSE 420/520: Object-Oriented Programming
Programming Philosophy
programming by simulation.
the solution.
‘reality’, then the new requirements will be consistent
in that reality.
structure: uncover the structure rather than construct
in isolation.
CSE 420/520: Object-Oriented Programming
Shopping vs. Building
application is a process of shopping for the
components that one needs
the programmer to change the component
that almost fits into one that is a good fit.
shelf, and if they are open to change.
CSE 420/520: Object-Oriented Programming
Smalltalk
Smalltalk.
language
create and interact with objects.
including many PDAs
!
"#$!%&'$()!+,-./+0$+*
!
-!604*2)7!5#!)80)193).5!:95;!#<=)25>
!
?
!
@#1A)5!0049259#.>B!$94)>B!2#3094)1>B!C5DDD
? @#2(>!#.!#<=)25>
!
"#$%%&$%'!"()&$*
!
6
!
7#!89.5:!$#1!2488)8;!02+<)8;! etc.
!
=
!
488!21)5?#.!.@!3)5A#@!25)<#1?B5?#.!1)!@#.)!
imperatively
!
!(8?.<!5A)!@)C)4#03).5!5##
!
6
!
DA)!3)5A#@!89.5*:!?8!8?304);!E(5!@?$$)1).
!
+,!$"&-.)/!
!
F-.
!
G)1!GA)5A)1!5A)!1)2)?C)1!8#158!$5)1!#1!)'(4!5#!
&51?.<H!DA)!2#445?#.!#1@)1!?8!8?304)!82??!IG?5A!28)!
@?$$)1).2)8JHF
K!I8)4$!2#301),!8)4$!G?5A,!&51?.<!2#44*5)@,!-82??/1@)1J!LM!N
!
"#$%%&$%'!(!)+!,$-./$.+*
!
786*
!
+5!09:*36;
!
#<
!
=>!)/8()!$9:*36!#<
!
"?@A
!
=>*!!
!
$+68/B!1$8/6!/)49*2!"?@A
"@?A" ;+4!+;!+9$C*
D+!;628/BD +!;628/B
E2();6 6>*!;F49$5! request.
!
G6!8;!)/8()*H!6I$!;F49$5;!
I86>!6>!;+4!/+4!J/$6!6>!;+4!$9:
K2 6>!;8/B5!3>+2+36*2! r
ELMN!#@<N!D+!;628/BDO +/!+22+F!5862+5@!!=>8;!8;!+!>62$B/*$);!+22+F!
3$/6+8/8/B!+/!8/6B2N!+!!$+6N!+/J!+!;628/B
67.18#9)::;)#<$.)#*1;(3).5=>
? :)4)25$1#7:#$.)#$1#5@$#:0)274#2A1*25)1:
B#C#D 3)::*;)# = 5 ##:).5#5$#$EF)25#B
G#H#I 3)::*;)# + 3 ##:).5#5$#$EF)25#G
!B#JJ#I 3)::*;)# // 3 ##:).5#5$#7.5);)1#$EF)25#!B#
<1):(45#7:#D>
!B#J#I 3)::*;)# / 3 ##:).5#5$#7.5);)1#$EF)25#!B#
<1):(45#7:#######>
D##H#G
1)2)7K)
:)4)25$
*1;(3).
i i
67.18#9)::;)#<$.)#*1;(3).5=>
? :)4)25$1#7:#$.)#$1#5@$#:0)274#2A1*25)1:
B#C#D 3)::*;)# = 5 ##:).5#5$#$EF)25#B
G#H#I 3)::*;)# + 3 ##:).5#5$#$EF)25#G
!B#JJ#I 3)::*;)# // 3 ##:).5#5$#7.5);)1#$EF)25#!B#
<1):(45#7:#D>
!B#J#I 3)::*;)# / 3 ##:).5#5$#7.5);)1#$EF)25#!B#
<1):(45#7:#######>
D##H#G
1)2)7K)
:)4)25$
*1;(3).
i i
Not exactly; i is
not an object. It's a
variable that's bound to
an object