SlideShare a Scribd company logo
1 of 45
Download to read offline
Dynamic Object-Oriented Programming with
Smalltalk
1. Introduction
Prof. O. Nierstrasz
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.2
Smalltalk is still today one of the
few fully reflective, fully dynamic,
object-oriented development
environments.
Smalltalk is still today one of the
few fully reflective, fully dynamic,
object-oriented development
environments.
We will see how a simple, uniform
object model enables live, dynamic,
interactive software development.
We will see how a simple, uniform
object model enables live, dynamic,
interactive software development.
© Oscar Nierstrasz
ST — xxx
X.3
What you should know!
How does Smalltalk differ from Java or C++?
Where are Smalltalk programs stored?
Where are objects stored?
What was the Dynabook?
Is a class an object?
What is dynamic binding?
What is the difference between a message and a
method?
© Oscar Nierstrasz
ST — xxx
X.4
Can you answer these questions?
What ideas did Smalltalk take from Simula? From Lisp?
Is there anything in Smalltalk which is not an object?
What exactly is stored in the changes file?
If objects have private state, then how can an Inspector
get at that state?
How do you create a new class?
What is the root of the class hierarchy?
If a class is an object, then what is its class? The class
of its class? …
If you don’t know, how would you find out?
2. Smalltalk Basics
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.6
Less is More — simple syntax and semantics
uniformly applied can lead to an expressive and
flexible system, not an impoverished one.
Less is More — simple syntax and semantics
uniformly applied can lead to an expressive and
flexible system, not an impoverished one.
© Oscar Nierstrasz
ST — xxx
X.7
What you should know!
How can you indicate that a method is “private”?
What is the difference between a comment and a
string?
Why does 1+2*3 = 9?
What is a cascade?
How is a block like a lambda expression?
How do you create a new class?
How do you inspect an object?
© Oscar Nierstrasz
ST — xxx
X.8
Can you answer these questions?
Why does Smalltalk support single (and not multiple)
inheritance?
Is the cascade strictly necessary?
Why do you need to declare local variables if there are
no static types?
How can you discover the class of GUI object?
How does SUnit differ from JUnit?
3. Standard Classes
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.10
Reify everything — by reifying its entire
implementation model, Smalltalk succeeds in being open,
and extensible.
New features can be added without changing the syntax!
Reify everything — by reifying its entire
implementation model, Smalltalk succeeds in being open,
and extensible.
New features can be added without changing the syntax!
© Oscar Nierstrasz
ST — xxx
X.11
What you should know!
How are abstract classes defined in Smalltalk?
What’s the difference between a String and a
Symbol?
Where are class names stored?
What is the difference between self and super?
Why do we need Blocks?
How is a Block like a lambda?
How would you implement Boolean>>and:?
What does inject:into: do?
© Oscar Nierstrasz
ST — xxx
X.12
Can you answer these questions?
How are Numbers represented internally?
Is it an error to instantiate an abstract class in Smalltalk?
Why isn’t the assignment operator considered to be a
message?
What happens if you send the message #new to
Boolean? To True or False?
Is nil an object? If so, what is its class?
Why does ArrayedCollection>>add: send itself the
message shouldNotImplement?
4. Smalltalk Coding Idioms
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.14
Distribute responsibility — in a well-designed object-
oriented system you will typically find many, small,
carefully named methods.
This promotes fluent interfaces, reuse, and maintainability.
Distribute responsibility — in a well-designed object-
oriented system you will typically find many, small,
carefully named methods.
This promotes fluent interfaces, reuse, and maintainability.
© Oscar Nierstrasz
ST — xxx
X.15
What you should know!
What does yourself return? Why is it needed?
How is a new instance of a class initialized?
When should you implement invariants and
preconditions?
What happens when we evaluate an expression with
“print it”?
Why should a method never send super a different
message?
How is super static and self dynamic?
How do you make your code self-documenting?
© Oscar Nierstrasz
ST — xxx
X.16
Can you answer these questions?
When should you override new?
If instance variables are really private, why can we see
them with an inspector?
When does self = super?
When does super = self?
Which classes implement assert: ?
What does self refer to in the method
SnakesAndLadders class>>example?
5. Seaside
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.18
Model your domain with objects — model
domain components as objects. Compose objects, not
text. Strive for fluent interfaces. Build applications by
scripting components.
Model your domain with objects — model
domain components as objects. Compose objects, not
text. Strive for fluent interfaces. Build applications by
scripting components.
6. Debugging
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.20
It can be easier to talk to objects than to read
classes — The system is alive. Talk to it.
The debugger can be your best friend. Don’t be afraid of it.
It can be easier to talk to objects than to read
classes — The system is alive. Talk to it.
The debugger can be your best friend. Don’t be afraid of it.
© Oscar Nierstrasz
ST — xxx
X.21
What you should know!
When should you explicitly return self?
Why shouldn’t you redefine methods named basic*?
Why are blocks not full closures?
How do you provide access to instance variables that
are collections, without breaking encapsulation?
What is one of the most important uses of super?
How does programming with Smalltalk differ from
programming in a conventional static language?
© Oscar Nierstrasz
ST — xxx
X.22
Can you answer these questions?
What will happen if you redefine the method class?
When should you define accessors for instance
variables?
How can explicit references to class names make your
application fragile?
Where is the method halt defined?
7. Best Practice Patterns
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.24
Let your code talk — Names matter. Let the
code say what it means.
Introduce a method for everything that needs to be
done. Don’t be afraid to delegate, even to yourself.
Let your code talk — Names matter. Let the
code say what it means.
Introduce a method for everything that needs to be
done. Don’t be afraid to delegate, even to yourself.
© Oscar Nierstrasz
ST — xxx
X.25
What you should know!
How should you name instance variables?
Why should you be suspicious of comments?
How does Simple Delegation differ from Self
Delegation?
When would you use Double Dispatch?
Why should you avoid introducing a Converter Method
for an object supporting a different protocol?
How do you sort a Collection?
When should you use Lazy Initialization?
© Oscar Nierstrasz
ST — xxx
X.26
Can you answer these questions?
Which patterns would you use to implement a
transactional interface?
How can Method Object help you to decompose long
methods?
Why is it a bad idea to query an object for its class?
Why are you less likely to see Double Dispatch in a
statically-typed language?
How can you avoid Modifying Super?
How can you avoid writing case statements?
What pattern does Object>>-> illustrate?
8. Refactoring and Design Patterns
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.28
Beware of misplaced
responsibilities — cluttered code
impacts extensibility.
Beware of misplaced
responsibilities — cluttered code
impacts extensibility.
© Oscar Nierstrasz
ST — xxx
X.29
What you should know!
How does the Open-Closed Principle apply to OOP?
What are signs that an object has clearly-defined
responsibilities?
How can you recognize misplaced methods?
How should you refactor long methods?
How can you eliminate duplicated code between
unrelated classes?
Why are type tests a code smell?
When do design patterns themselves turn into code
smells?
Why is it a bad idea to use global variables to store
Singleton instances?
© Oscar Nierstrasz
ST — xxx
X.30
Can you answer these questions?
How do the Common Closure and Common Reuse
Principles alter the usual notion of cohesion?
How does refactoring differ from reengineering?
Can refactoring be fully automated?
In what situations does the Law of Demeter not apply?
How do design patterns make use of delegation?
Why are Long Parameter Lists a code smell?
Are isNil tests a code smell? What design pattern
could help you eliminate them?
Is the Smalltalk SystemDictionary a good example of a
Singleton?
9. Understanding Classes and Metaclasses
Birds-eye view
© Oscar Nierstrasz
ST — Introduction
1.32
Reify your metamodel — A fully reflective
system models its own metamodel.
Reify your metamodel — A fully reflective
system models its own metamodel.
© Oscar Nierstrasz
ST — xxx
X.33
What you should know!
What does is-a mean?
What is the difference between sending a message to
an object and to its class?
What are the responsibilities of a metaclass?
What is the superclass of Object class?
Where is new defined?
What is the difference between class variables and
class instance variables?
© Oscar Nierstrasz
ST — xxx
X.34
Can you answer these questions?
Why are there no explicit metaclasses?
When should you override new?
Why don’t metaclasses inherit from Class?
Are there any classes that don’t inherit from Object?
Is Metaclass a Class? Why or why not?
Where are the methods class and superclass defined?
When should you define an indexed class?
Are Java static variables just like class variables or class instance
variables?
Where is the SystemDictionary Smalltalk defined?
10. Reflection
© Oscar Nierstrasz
ST — xxx
X.36
What you should know!
What is the difference between introspection and
intercession?
What is the difference between structural and
behavioural reflection?
What is an object? What is a class?
What is the difference between performing a message
send and simply evaluating a method looked up in a
MethodDictionary?
In what way does thisContext represent the run-time
stack?
What different techniques can you use to intercept and
control message sends?
© Oscar Nierstrasz
ST — xxx
X.37
Can you answer these questions?
What form of “reflection” is supported by Java?
What can you do with a metacircular architecture?
Why are Behaviour and Class different classes?
What is the class ProtoObject good for?
Why is it not possible to become: a SmallInteger?
What happens to the stack returned by thisContext if you
proceed from the self halt?
What is the metaclass of an anonymous class?
11. Working with Bytecode
© Oscar Nierstrasz
ST — xxx
X.39
What you should know!
What are the problems of the old compiler?
How is the new Squeak compiler organized?
What does the Squeak semantic analyzer add to the
parser-generated AST?
What is the format of the intermediate representation?
What kind of virtual machine does the Squeak bytecode
address?
How can you inspect the bytecode of a particular
method?
© Oscar Nierstrasz
ST — xxx
X.40
Can you answer these questions?
What different groups of bytecode are supported?
Why is the SmaCC grammar only BNF-“like”?
How can you find out what all the bytecodes are?
What is the purpose of IRBuilder?
Why do we not generate bytecode directly?
What is the responsibility of class InstructionStream?
How would you implement a statement coverage
analyzer?
12. Virtual Machines
13. Traits and Classboxes
© Oscar Nierstrasz
ST — xxx
X.43
What you should know!
Why does single inheritance lead to duplicated code?
How does the composing class retain control of trait
composition?
What do “glue” methods do for traits?
What is the “flattening property” and why is it important
for traits?
Why is there “inappropriate inheritance” in the Smalltalk
Collections hierarchy?
What is a “class extension”?
In what way to classboxes ensure locality of changes?
What problems are solved by combined traits and
classboxes?
© Oscar Nierstrasz
ST — xxx
X.44
Can you answer these questions?
Why do multiple inheritance and mixins leads to “fragile
class hierarchies”?
C++, Eiffel and Python all offer multiple inheritance – are
they broken?
Why don’t traits specify any state?
How much code is duplicated in the standard Java
libraries?
What problems occur in Java due to the lack of class
extensions?
Can classboxes be “flattened” in the same way that traits
can? Why or why not?
© Oscar Nierstrasz
ST — Introduction
1.45
Attribution-ShareAlike 3.0 Unported
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
Under the following conditions:
Attribution. You must attribute the work in the manner specified by the author or
licensor (but not in any way that suggests that they endorse you or your use of the
work).
Share Alike. If you alter, transform, or build upon this work, you may distribute the
resulting work only under the same, similar or a compatible license.
For any reuse or distribution, you must make clear to others the license terms of this work.
The best way to do this is with a link to this web page.
Any of the above conditions can be waived if you get permission from the copyright holder.
Nothing in this license impairs or restricts the author's moral rights.
License
http://creativecommons.org/licenses/by-sa/3.0/

More Related Content

What's hot

What's hot (7)

04 idioms
04 idioms04 idioms
04 idioms
 
5 - OOP - Smalltalk in a Nutshell (a)
5 - OOP - Smalltalk in a Nutshell (a)5 - OOP - Smalltalk in a Nutshell (a)
5 - OOP - Smalltalk in a Nutshell (a)
 
The View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptThe View object orientated programming in Lotuscript
The View object orientated programming in Lotuscript
 
Core java concepts
Core    java  conceptsCore    java  concepts
Core java concepts
 
Inheritance
InheritanceInheritance
Inheritance
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
 
C Language Unit-7
C Language Unit-7C Language Unit-7
C Language Unit-7
 

Viewers also liked (20)

1 - OOP
1 - OOP1 - OOP
1 - OOP
 
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
OBJECT ORIENTED ROGRAMMING With Question And Answer  FullOBJECT ORIENTED ROGRAMMING With Question And Answer  Full
OBJECT ORIENTED ROGRAMMING With Question And Answer Full
 
Stoop 400 o-metaclassonly
Stoop 400 o-metaclassonlyStoop 400 o-metaclassonly
Stoop 400 o-metaclassonly
 
Stoop 434-composite
Stoop 434-compositeStoop 434-composite
Stoop 434-composite
 
Stoop sed-sharing ornot
Stoop sed-sharing ornotStoop sed-sharing ornot
Stoop sed-sharing ornot
 
Debugging VisualWorks
Debugging VisualWorksDebugging VisualWorks
Debugging VisualWorks
 
Stoop 300-block optimizationinvw
Stoop 300-block optimizationinvwStoop 300-block optimizationinvw
Stoop 300-block optimizationinvw
 
Stoop ed-subtyping subclassing
Stoop ed-subtyping subclassingStoop ed-subtyping subclassing
Stoop ed-subtyping subclassing
 
Stoop 431-visitor
Stoop 431-visitorStoop 431-visitor
Stoop 431-visitor
 
01 intro
01 intro01 intro
01 intro
 
12 - Conditions and Loops
12 - Conditions and Loops12 - Conditions and Loops
12 - Conditions and Loops
 
14 - Exceptions
14 - Exceptions14 - Exceptions
14 - Exceptions
 
11 - OOP - Numbers
11 - OOP - Numbers11 - OOP - Numbers
11 - OOP - Numbers
 
Stoop sed-class initialization
Stoop sed-class initializationStoop sed-class initialization
Stoop sed-class initialization
 
Stoop 414-smalltalk elementsofdesign
Stoop 414-smalltalk elementsofdesignStoop 414-smalltalk elementsofdesign
Stoop 414-smalltalk elementsofdesign
 
Stoop 433-chain
Stoop 433-chainStoop 433-chain
Stoop 433-chain
 
Stoop sed-smells
Stoop sed-smellsStoop sed-smells
Stoop sed-smells
 
Stoop ed-unit ofreuse
Stoop ed-unit ofreuseStoop ed-unit ofreuse
Stoop ed-unit ofreuse
 
11 bytecode
11 bytecode11 bytecode
11 bytecode
 
Stoop 430-design patternsintro
Stoop 430-design patternsintroStoop 430-design patternsintro
Stoop 430-design patternsintro
 

Similar to 99 questions

The Role Of Ontology In Modern Expert Systems Dallas 2008
The Role Of Ontology In Modern Expert Systems   Dallas   2008The Role Of Ontology In Modern Expert Systems   Dallas   2008
The Role Of Ontology In Modern Expert Systems Dallas 2008Jason Morris
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programmingAbzetdin Adamov
 
7 latest-dot-net-interview-questions
7  latest-dot-net-interview-questions7  latest-dot-net-interview-questions
7 latest-dot-net-interview-questionssadiqkhanpathan
 
Software Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic ArchitecturesSoftware Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic ArchitecturesAngelos Kapsimanis
 
Matlab for a computational PhD
Matlab for a computational PhDMatlab for a computational PhD
Matlab for a computational PhDAlbanLevy
 
Mobile Distributed Systems For Secure Communication Essay
Mobile Distributed Systems For Secure Communication EssayMobile Distributed Systems For Secure Communication Essay
Mobile Distributed Systems For Secure Communication EssaySusan Kennedy
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityShubham Narkhede
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
Paradigm Shifts are Never Pretty
Paradigm Shifts are Never PrettyParadigm Shifts are Never Pretty
Paradigm Shifts are Never PrettySarah O'Keefe
 
Models vs Reality: Quest for the Roots of Complexity
Models vs Reality: Quest for the Roots of ComplexityModels vs Reality: Quest for the Roots of Complexity
Models vs Reality: Quest for the Roots of ComplexityJulian Warszawski
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternNishith Shukla
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsLalit Kale
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented developmentrajmundr
 
136 latest dot net interview questions
136  latest dot net interview questions136  latest dot net interview questions
136 latest dot net interview questionssandi4204
 
Five pattern(facade mediator_singleton_monostate_null)
Five pattern(facade mediator_singleton_monostate_null)Five pattern(facade mediator_singleton_monostate_null)
Five pattern(facade mediator_singleton_monostate_null)이효서
 
Advanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, IdiomsAdvanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, IdiomsClint Edmonson
 
Applying Design Principles in Practice
Applying Design Principles in PracticeApplying Design Principles in Practice
Applying Design Principles in PracticeGanesh Samarthyam
 
Evolving as a professional software developer
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developerAnton Kirillov
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structureselliando dias
 

Similar to 99 questions (20)

The Role Of Ontology In Modern Expert Systems Dallas 2008
The Role Of Ontology In Modern Expert Systems   Dallas   2008The Role Of Ontology In Modern Expert Systems   Dallas   2008
The Role Of Ontology In Modern Expert Systems Dallas 2008
 
Introduction to object oriented programming
Introduction to object oriented programmingIntroduction to object oriented programming
Introduction to object oriented programming
 
7 latest-dot-net-interview-questions
7  latest-dot-net-interview-questions7  latest-dot-net-interview-questions
7 latest-dot-net-interview-questions
 
Software Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic ArchitecturesSoftware Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic Architectures
 
Matlab for a computational PhD
Matlab for a computational PhDMatlab for a computational PhD
Matlab for a computational PhD
 
Mobile Distributed Systems For Secure Communication Essay
Mobile Distributed Systems For Secure Communication EssayMobile Distributed Systems For Secure Communication Essay
Mobile Distributed Systems For Secure Communication Essay
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Paradigm Shifts are Never Pretty
Paradigm Shifts are Never PrettyParadigm Shifts are Never Pretty
Paradigm Shifts are Never Pretty
 
Models vs Reality: Quest for the Roots of Complexity
Models vs Reality: Quest for the Roots of ComplexityModels vs Reality: Quest for the Roots of Complexity
Models vs Reality: Quest for the Roots of Complexity
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 
136 latest dot net interview questions
136  latest dot net interview questions136  latest dot net interview questions
136 latest dot net interview questions
 
L05 Design Patterns
L05 Design PatternsL05 Design Patterns
L05 Design Patterns
 
Five pattern(facade mediator_singleton_monostate_null)
Five pattern(facade mediator_singleton_monostate_null)Five pattern(facade mediator_singleton_monostate_null)
Five pattern(facade mediator_singleton_monostate_null)
 
Advanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, IdiomsAdvanced OOP - Laws, Principles, Idioms
Advanced OOP - Laws, Principles, Idioms
 
Applying Design Principles in Practice
Applying Design Principles in PracticeApplying Design Principles in Practice
Applying Design Principles in Practice
 
Evolving as a professional software developer
Evolving as a professional software developerEvolving as a professional software developer
Evolving as a professional software developer
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 

More from The World of Smalltalk (14)

05 seaside canvas
05 seaside canvas05 seaside canvas
05 seaside canvas
 
12 virtualmachine
12 virtualmachine12 virtualmachine
12 virtualmachine
 
06 debugging
06 debugging06 debugging
06 debugging
 
Stoop sed-class initialization
Stoop sed-class initializationStoop sed-class initialization
Stoop sed-class initialization
 
Stoop metaclasses
Stoop metaclassesStoop metaclasses
Stoop metaclasses
 
Stoop ed-some principles
Stoop ed-some principlesStoop ed-some principles
Stoop ed-some principles
 
Stoop ed-lod
Stoop ed-lodStoop ed-lod
Stoop ed-lod
 
Stoop ed-inheritance composition
Stoop ed-inheritance compositionStoop ed-inheritance composition
Stoop ed-inheritance composition
 
Stoop ed-frameworks
Stoop ed-frameworksStoop ed-frameworks
Stoop ed-frameworks
 
Stoop ed-dual interface
Stoop ed-dual interfaceStoop ed-dual interface
Stoop ed-dual interface
 
Stoop ed-class forreuse
Stoop ed-class forreuseStoop ed-class forreuse
Stoop ed-class forreuse
 
Stoop 450-s unit
Stoop 450-s unitStoop 450-s unit
Stoop 450-s unit
 
Stoop 440-adaptor
Stoop 440-adaptorStoop 440-adaptor
Stoop 440-adaptor
 
Stoop 439-decorator
Stoop 439-decoratorStoop 439-decorator
Stoop 439-decorator
 

Recently uploaded

Material Remains as Source of Ancient Indian History & Culture.ppt
Material Remains as Source of Ancient Indian History & Culture.pptMaterial Remains as Source of Ancient Indian History & Culture.ppt
Material Remains as Source of Ancient Indian History & Culture.pptBanaras Hindu University
 
AI Uses and Misuses: Academic and Workplace Applications
AI Uses and Misuses: Academic and Workplace ApplicationsAI Uses and Misuses: Academic and Workplace Applications
AI Uses and Misuses: Academic and Workplace ApplicationsStella Lee
 
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...gdgsurrey
 
Riti theory by Vamana Indian poetics.pptx
Riti theory by Vamana Indian poetics.pptxRiti theory by Vamana Indian poetics.pptx
Riti theory by Vamana Indian poetics.pptxDhatriParmar
 
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptx
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptxAUDIENCE THEORY - PARTICIPATORY - JENKINS.pptx
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptxiammrhaywood
 
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdf
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdfArti Languages Pre Seed Send Ahead Pitchdeck 2024.pdf
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdfwill854175
 
ICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfVanessa Camilleri
 
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptx
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptxBBA 205 BUSINESS ENVIRONMENT UNIT I.pptx
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptxProf. Kanchan Kumari
 
LEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudLEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudDr. Bruce A. Johnson
 
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdf
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdfPHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdf
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdfSumit Tiwari
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
EDD8524 The Future of Educational Leader
EDD8524 The Future of Educational LeaderEDD8524 The Future of Educational Leader
EDD8524 The Future of Educational LeaderDr. Bruce A. Johnson
 
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptx
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptxBBA 205 BE UNIT 2 economic systems prof dr kanchan.pptx
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptxProf. Kanchan Kumari
 
LEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudLEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudDr. Bruce A. Johnson
 
Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchRushdi Shams
 
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in Pharmacy
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in PharmacyASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in Pharmacy
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in PharmacySumit Tiwari
 
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...Marlene Maheu
 
Metabolism of lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptx
Metabolism of  lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptxMetabolism of  lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptx
Metabolism of lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptxDr. Santhosh Kumar. N
 
3.14.24 Gender Discrimination and Gender Inequity.pptx
3.14.24 Gender Discrimination and Gender Inequity.pptx3.14.24 Gender Discrimination and Gender Inequity.pptx
3.14.24 Gender Discrimination and Gender Inequity.pptxmary850239
 

Recently uploaded (20)

Material Remains as Source of Ancient Indian History & Culture.ppt
Material Remains as Source of Ancient Indian History & Culture.pptMaterial Remains as Source of Ancient Indian History & Culture.ppt
Material Remains as Source of Ancient Indian History & Culture.ppt
 
AI Uses and Misuses: Academic and Workplace Applications
AI Uses and Misuses: Academic and Workplace ApplicationsAI Uses and Misuses: Academic and Workplace Applications
AI Uses and Misuses: Academic and Workplace Applications
 
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...
Certification Study Group - Professional ML Engineer Session 3 (Machine Learn...
 
Riti theory by Vamana Indian poetics.pptx
Riti theory by Vamana Indian poetics.pptxRiti theory by Vamana Indian poetics.pptx
Riti theory by Vamana Indian poetics.pptx
 
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptx
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptxAUDIENCE THEORY - PARTICIPATORY - JENKINS.pptx
AUDIENCE THEORY - PARTICIPATORY - JENKINS.pptx
 
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdf
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdfArti Languages Pre Seed Send Ahead Pitchdeck 2024.pdf
Arti Languages Pre Seed Send Ahead Pitchdeck 2024.pdf
 
t-test Parametric test Biostatics and Research Methodology
t-test Parametric test Biostatics and Research Methodologyt-test Parametric test Biostatics and Research Methodology
t-test Parametric test Biostatics and Research Methodology
 
ICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdfICS2208 Lecture4 Intelligent Interface Agents.pdf
ICS2208 Lecture4 Intelligent Interface Agents.pdf
 
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptx
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptxBBA 205 BUSINESS ENVIRONMENT UNIT I.pptx
BBA 205 BUSINESS ENVIRONMENT UNIT I.pptx
 
LEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudLEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced Stud
 
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdf
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdfPHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdf
PHARMACOGNOSY CHAPTER NO 5 CARMINATIVES AND G.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
EDD8524 The Future of Educational Leader
EDD8524 The Future of Educational LeaderEDD8524 The Future of Educational Leader
EDD8524 The Future of Educational Leader
 
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptx
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptxBBA 205 BE UNIT 2 economic systems prof dr kanchan.pptx
BBA 205 BE UNIT 2 economic systems prof dr kanchan.pptx
 
LEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced StudLEAD6001 - Introduction to Advanced Stud
LEAD6001 - Introduction to Advanced Stud
 
Research Methodology and Tips on Better Research
Research Methodology and Tips on Better ResearchResearch Methodology and Tips on Better Research
Research Methodology and Tips on Better Research
 
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in Pharmacy
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in PharmacyASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in Pharmacy
ASTRINGENTS.pdf Pharmacognosy chapter 5 diploma in Pharmacy
 
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...
2024 March 11, Telehealth Billing- Current Telehealth CPT Codes & Telehealth ...
 
Metabolism of lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptx
Metabolism of  lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptxMetabolism of  lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptx
Metabolism of lipoproteins & its disorders(Chylomicron & VLDL & LDL).pptx
 
3.14.24 Gender Discrimination and Gender Inequity.pptx
3.14.24 Gender Discrimination and Gender Inequity.pptx3.14.24 Gender Discrimination and Gender Inequity.pptx
3.14.24 Gender Discrimination and Gender Inequity.pptx
 

99 questions

  • 1. Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz
  • 2. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.2 Smalltalk is still today one of the few fully reflective, fully dynamic, object-oriented development environments. Smalltalk is still today one of the few fully reflective, fully dynamic, object-oriented development environments. We will see how a simple, uniform object model enables live, dynamic, interactive software development. We will see how a simple, uniform object model enables live, dynamic, interactive software development.
  • 3. © Oscar Nierstrasz ST — xxx X.3 What you should know! How does Smalltalk differ from Java or C++? Where are Smalltalk programs stored? Where are objects stored? What was the Dynabook? Is a class an object? What is dynamic binding? What is the difference between a message and a method?
  • 4. © Oscar Nierstrasz ST — xxx X.4 Can you answer these questions? What ideas did Smalltalk take from Simula? From Lisp? Is there anything in Smalltalk which is not an object? What exactly is stored in the changes file? If objects have private state, then how can an Inspector get at that state? How do you create a new class? What is the root of the class hierarchy? If a class is an object, then what is its class? The class of its class? … If you don’t know, how would you find out?
  • 6. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.6 Less is More — simple syntax and semantics uniformly applied can lead to an expressive and flexible system, not an impoverished one. Less is More — simple syntax and semantics uniformly applied can lead to an expressive and flexible system, not an impoverished one.
  • 7. © Oscar Nierstrasz ST — xxx X.7 What you should know! How can you indicate that a method is “private”? What is the difference between a comment and a string? Why does 1+2*3 = 9? What is a cascade? How is a block like a lambda expression? How do you create a new class? How do you inspect an object?
  • 8. © Oscar Nierstrasz ST — xxx X.8 Can you answer these questions? Why does Smalltalk support single (and not multiple) inheritance? Is the cascade strictly necessary? Why do you need to declare local variables if there are no static types? How can you discover the class of GUI object? How does SUnit differ from JUnit?
  • 10. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.10 Reify everything — by reifying its entire implementation model, Smalltalk succeeds in being open, and extensible. New features can be added without changing the syntax! Reify everything — by reifying its entire implementation model, Smalltalk succeeds in being open, and extensible. New features can be added without changing the syntax!
  • 11. © Oscar Nierstrasz ST — xxx X.11 What you should know! How are abstract classes defined in Smalltalk? What’s the difference between a String and a Symbol? Where are class names stored? What is the difference between self and super? Why do we need Blocks? How is a Block like a lambda? How would you implement Boolean>>and:? What does inject:into: do?
  • 12. © Oscar Nierstrasz ST — xxx X.12 Can you answer these questions? How are Numbers represented internally? Is it an error to instantiate an abstract class in Smalltalk? Why isn’t the assignment operator considered to be a message? What happens if you send the message #new to Boolean? To True or False? Is nil an object? If so, what is its class? Why does ArrayedCollection>>add: send itself the message shouldNotImplement?
  • 14. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.14 Distribute responsibility — in a well-designed object- oriented system you will typically find many, small, carefully named methods. This promotes fluent interfaces, reuse, and maintainability. Distribute responsibility — in a well-designed object- oriented system you will typically find many, small, carefully named methods. This promotes fluent interfaces, reuse, and maintainability.
  • 15. © Oscar Nierstrasz ST — xxx X.15 What you should know! What does yourself return? Why is it needed? How is a new instance of a class initialized? When should you implement invariants and preconditions? What happens when we evaluate an expression with “print it”? Why should a method never send super a different message? How is super static and self dynamic? How do you make your code self-documenting?
  • 16. © Oscar Nierstrasz ST — xxx X.16 Can you answer these questions? When should you override new? If instance variables are really private, why can we see them with an inspector? When does self = super? When does super = self? Which classes implement assert: ? What does self refer to in the method SnakesAndLadders class>>example?
  • 18. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.18 Model your domain with objects — model domain components as objects. Compose objects, not text. Strive for fluent interfaces. Build applications by scripting components. Model your domain with objects — model domain components as objects. Compose objects, not text. Strive for fluent interfaces. Build applications by scripting components.
  • 20. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.20 It can be easier to talk to objects than to read classes — The system is alive. Talk to it. The debugger can be your best friend. Don’t be afraid of it. It can be easier to talk to objects than to read classes — The system is alive. Talk to it. The debugger can be your best friend. Don’t be afraid of it.
  • 21. © Oscar Nierstrasz ST — xxx X.21 What you should know! When should you explicitly return self? Why shouldn’t you redefine methods named basic*? Why are blocks not full closures? How do you provide access to instance variables that are collections, without breaking encapsulation? What is one of the most important uses of super? How does programming with Smalltalk differ from programming in a conventional static language?
  • 22. © Oscar Nierstrasz ST — xxx X.22 Can you answer these questions? What will happen if you redefine the method class? When should you define accessors for instance variables? How can explicit references to class names make your application fragile? Where is the method halt defined?
  • 23. 7. Best Practice Patterns
  • 24. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.24 Let your code talk — Names matter. Let the code say what it means. Introduce a method for everything that needs to be done. Don’t be afraid to delegate, even to yourself. Let your code talk — Names matter. Let the code say what it means. Introduce a method for everything that needs to be done. Don’t be afraid to delegate, even to yourself.
  • 25. © Oscar Nierstrasz ST — xxx X.25 What you should know! How should you name instance variables? Why should you be suspicious of comments? How does Simple Delegation differ from Self Delegation? When would you use Double Dispatch? Why should you avoid introducing a Converter Method for an object supporting a different protocol? How do you sort a Collection? When should you use Lazy Initialization?
  • 26. © Oscar Nierstrasz ST — xxx X.26 Can you answer these questions? Which patterns would you use to implement a transactional interface? How can Method Object help you to decompose long methods? Why is it a bad idea to query an object for its class? Why are you less likely to see Double Dispatch in a statically-typed language? How can you avoid Modifying Super? How can you avoid writing case statements? What pattern does Object>>-> illustrate?
  • 27. 8. Refactoring and Design Patterns
  • 28. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.28 Beware of misplaced responsibilities — cluttered code impacts extensibility. Beware of misplaced responsibilities — cluttered code impacts extensibility.
  • 29. © Oscar Nierstrasz ST — xxx X.29 What you should know! How does the Open-Closed Principle apply to OOP? What are signs that an object has clearly-defined responsibilities? How can you recognize misplaced methods? How should you refactor long methods? How can you eliminate duplicated code between unrelated classes? Why are type tests a code smell? When do design patterns themselves turn into code smells? Why is it a bad idea to use global variables to store Singleton instances?
  • 30. © Oscar Nierstrasz ST — xxx X.30 Can you answer these questions? How do the Common Closure and Common Reuse Principles alter the usual notion of cohesion? How does refactoring differ from reengineering? Can refactoring be fully automated? In what situations does the Law of Demeter not apply? How do design patterns make use of delegation? Why are Long Parameter Lists a code smell? Are isNil tests a code smell? What design pattern could help you eliminate them? Is the Smalltalk SystemDictionary a good example of a Singleton?
  • 31. 9. Understanding Classes and Metaclasses
  • 32. Birds-eye view © Oscar Nierstrasz ST — Introduction 1.32 Reify your metamodel — A fully reflective system models its own metamodel. Reify your metamodel — A fully reflective system models its own metamodel.
  • 33. © Oscar Nierstrasz ST — xxx X.33 What you should know! What does is-a mean? What is the difference between sending a message to an object and to its class? What are the responsibilities of a metaclass? What is the superclass of Object class? Where is new defined? What is the difference between class variables and class instance variables?
  • 34. © Oscar Nierstrasz ST — xxx X.34 Can you answer these questions? Why are there no explicit metaclasses? When should you override new? Why don’t metaclasses inherit from Class? Are there any classes that don’t inherit from Object? Is Metaclass a Class? Why or why not? Where are the methods class and superclass defined? When should you define an indexed class? Are Java static variables just like class variables or class instance variables? Where is the SystemDictionary Smalltalk defined?
  • 36. © Oscar Nierstrasz ST — xxx X.36 What you should know! What is the difference between introspection and intercession? What is the difference between structural and behavioural reflection? What is an object? What is a class? What is the difference between performing a message send and simply evaluating a method looked up in a MethodDictionary? In what way does thisContext represent the run-time stack? What different techniques can you use to intercept and control message sends?
  • 37. © Oscar Nierstrasz ST — xxx X.37 Can you answer these questions? What form of “reflection” is supported by Java? What can you do with a metacircular architecture? Why are Behaviour and Class different classes? What is the class ProtoObject good for? Why is it not possible to become: a SmallInteger? What happens to the stack returned by thisContext if you proceed from the self halt? What is the metaclass of an anonymous class?
  • 38. 11. Working with Bytecode
  • 39. © Oscar Nierstrasz ST — xxx X.39 What you should know! What are the problems of the old compiler? How is the new Squeak compiler organized? What does the Squeak semantic analyzer add to the parser-generated AST? What is the format of the intermediate representation? What kind of virtual machine does the Squeak bytecode address? How can you inspect the bytecode of a particular method?
  • 40. © Oscar Nierstrasz ST — xxx X.40 Can you answer these questions? What different groups of bytecode are supported? Why is the SmaCC grammar only BNF-“like”? How can you find out what all the bytecodes are? What is the purpose of IRBuilder? Why do we not generate bytecode directly? What is the responsibility of class InstructionStream? How would you implement a statement coverage analyzer?
  • 42. 13. Traits and Classboxes
  • 43. © Oscar Nierstrasz ST — xxx X.43 What you should know! Why does single inheritance lead to duplicated code? How does the composing class retain control of trait composition? What do “glue” methods do for traits? What is the “flattening property” and why is it important for traits? Why is there “inappropriate inheritance” in the Smalltalk Collections hierarchy? What is a “class extension”? In what way to classboxes ensure locality of changes? What problems are solved by combined traits and classboxes?
  • 44. © Oscar Nierstrasz ST — xxx X.44 Can you answer these questions? Why do multiple inheritance and mixins leads to “fragile class hierarchies”? C++, Eiffel and Python all offer multiple inheritance – are they broken? Why don’t traits specify any state? How much code is duplicated in the standard Java libraries? What problems occur in Java due to the lack of class extensions? Can classboxes be “flattened” in the same way that traits can? Why or why not?
  • 45. © Oscar Nierstrasz ST — Introduction 1.45 Attribution-ShareAlike 3.0 Unported You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights. License http://creativecommons.org/licenses/by-sa/3.0/

Editor's Notes

  1. http://www.metroactive.com/papers/metro/09.08.04/covers-0437.html
  2. Tinguely car http://www.jaunted.com/story/2006/7/14/55234/2992/travel/When+Garbage+is+More+Than+Garbage