SlideShare uma empresa Scribd logo
1 de 27
Smalltalk
The dynamic language




Mohamed Samy
August 2011
samy2004@gmail.com
The Dynabook project - 1968
●   Presented in the paper
      "A Personal Computer for children of all ages"
    by Alan C. Kay
The Dynabook project - 1968
The Dynabook project - 1968
The Dynabook project - 1968
The Dynabook project - 1968
The Dynabook project - 1968
The Dynabook project - 1968
Smalltalk
●   One of the first OOP languages, greatly
    influenced OOP
●   Ideas transferred to C++, Objective-C, Java, C#,
    Ruby, Python, Dylan, ...etc...etc
●   Has intellectual 'children' like Self, which in turn
    influenced IO, JavaScript, and Newspeak
●   Commercial implementations:
    ●   VisualWorks, Dolphin Smalltalk, VA Smalltalk
●   Open source implementations
    ●   Squeak, Pharo, GNU Smalltalk
Pure OOP?

●   What does a language like C++ do in non object-
    oriented ways?
    ●   Primitive data types like int, char, float...
    ●   Control flow like if, while, for
    ●   Functions
    ●   Function names
    ●   Classes (while they can create objects, they are not
        objects).
    ●   The call stack
    ●   Processes/threads
    ●   ...etc
Small syntax
●   Assignment:
        a := 5
●   Message sends:
        obj message
        obj messageWithArg: 12
        obj messageWithArgA: 12 argB: 13
        obj1 + obj2 / obj3
    ●   Note that 1 + 3 * 5 evaluates to 20, since + , * are
        message sends like any other.
Small syntax
●   Messages on top of messages:
      2 squared factorial
●   Message cascading:
    window := ShellView new show.
    window
     position: 80@80;
     extent: 320@90;
     backcolor: Color blue;
     caption: 'Test Window'.
Small syntax
●   Blocks
      myFunc := [ MessageBox notify: 'I have arrived
      mommy' ]
      myfunc value
●   Blocks with args
      myFunc := [ :x | MessageBox notify:
             'I have arrived ' , x]
      myFunc value: 'Tamer'
      myFunc := [ :x :y | x + y ]
      myFunc value: 12 value: 13
Pure OOP?

●   What does a language like C++ do in non object-
    oriented ways?
    ●   Primitive data types like int, char, float...
    ●   Control flow like if, while, for
    ●   Functions
    ●   Function names
    ●   Classes (while they can create objects, they are not
        objects).
    ●   The call stack
    ●   Processes/threads
    ●   ...etc
Primitive types
●   Integers, floats, fractions, booleans...etc are all
    objects
●   They even have a class hierarchy ^ ^
●   The hierarchy allows e.g switching between
    different integral types during program execution,
    making use of the dynamic typing nature of the
    language.
●   Consider
      5 factorial class
      100 factorial class
Control flow
●   If
    ●    cond ifTrue: [block]
    ●    cond ifTrue: [block1] ifFalse: [block2]
●   While/Until
    ●    [cond] whileTrue: [block]
    ●    [cond] whileFalse: [cond]
●   Counting
    ●    5 timesRepeat: [ MessageBox notify: 'hi' ]
    ●    1 to: 10 do: [ :a | MessageBox notify: a printString ]
    ●    1 to: 10 by: 2 do: [ :a | MessageBox notify: a
         printString ]
Let's create a 'whileNot' loop
●   1- Create a class MyLoop and define this method:
    whileNot: cond do: action
    cond value ifFalse: [action value.
                    self whileNot: cond do: action ]
●   2- Let's test our method
    loop = MyLoop new.
    i:=0.
    loop whileNot: [ i=10] do : [i:= i+1].
    MessageBox notify: i printString
Symbols
●   An expression like #abc represents an object
●   Symbols guarantee that the same #... expression
    always returns the same object
●   This guarantee makes comparing symbols very
    fast (compare references instead of strings)
●   Class names, message selectors, ...etc are
    symbols
●   The benefits of this are related to the dynamic
    nature of the language, and will appear shortly
Pure OOP?

●   What does a language like C++ do in non object-
    oriented ways?
    ●   Primitive data types like int, char, float...
    ●   Control flow like if, while, for
    ●   Functions
    ●   Function names
    ●   Classes (while they can create objects, they are not
        objects).
    ●   The call stack
    ●   Processes/threads
    ●   ...etc
Processes & Continuations
clockStep := [Processor sleep: 1000.
(View desktop canvas)
    font: (Font name: 'Arial' pointSize: 36) beBold;
    text: Time now printString at: 10@10;
    free
]
digitalClockProcess := [ clockStep repeat ] fork.
Processes & Continuations
●   A process is an object and, like any other, can be
    sent messages.
●   It knows about its call stack, Smalltalk has support
    for continuations
●   This has a lot of uses...
    ●   Debugging
    ●   Distributed computing
    ●   Continuation-based web frameworks like Seaside
    ●
        ...
Pure OOP?

●   What does a language like C++ do in non object-
    oriented ways?
    ●   Primitive data types like int, char, float...
    ●   Control flow like if, while, for
    ●   Functions
    ●   Function names
    ●   Classes (while they can create objects, they are not
        objects).
    ●   The call stack
    ●   Processes/threads
    ●   ...etc
Secrets of the classes
●   How was the class MyLoop created?
      Object subclass: #MyLoop
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''
●   Can we do this manually?
Classes are objects

        MessageBox notify: 12 class printString
        Console.WriteLine("{0}",12.GetType( ).ToString( ))
        System.out.println(myObj.getClass( ))
●   Reflection: The program can ask for information
    about its own classes, methods, fields...etc
●   Useful for metaprogramming, many applications
    ●   Automatic serialization
    ●   Generation of GUI
    ●   Factories
    ●   ...etc
Classes are objects

●   Classes are defined, modified at runtime
●   Everything happens at runtime! No compile
    time/runtime distinction.
    ●   But methods are compiled, into bytecode or JITed
●   It's like Photoshop + Interpreter
●   The IDE and application are one!
    ●   e.g Debugging
    ●   e.g Inspector
    ●   Inspect & debug IDE!
Applications: Smalltalk
●   Education
    ●   eToys
    ●   OpenCroquet
●   Tools
    ●   The Seaside web framework
    ●   Aida/Web web framework
●   Commercial applications
    ●   Auctomatic
    ●   DabbleDB
    ●   Teleplace
Applications: Ideas
●   Applying the concept to non-smalltalk applications:
    ●   The web, social networks, ...etc are live applications
        that grow without stopping
    ●   The web-browser itself as a live environment
    ●   A new generation of IDEs
    ●   Creative tools with a programming aspect
●   Real tools influenced by Smalltalk:
    ●   Objective-C (iPhone, iPad, Mac applications)
    ●   Java/ .net
    ●   Eclipse
    ●   Firefox 6.0 Scratchpad (demo)

Mais conteúdo relacionado

Mais procurados

Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsVineeta Garg
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4thConnex
 
Being Expressive in Code
Being Expressive in CodeBeing Expressive in Code
Being Expressive in CodeEamonn Boyle
 
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard WarburtonJava generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard WarburtonJAXLondon_Conference
 
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017Hardik Trivedi
 
NDK Primer (AnDevCon Boston 2014)
NDK Primer (AnDevCon Boston 2014)NDK Primer (AnDevCon Boston 2014)
NDK Primer (AnDevCon Boston 2014)Ron Munitz
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript BasicsMindfire Solutions
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variablesteach4uin
 
Ballerina philosophy
Ballerina philosophy Ballerina philosophy
Ballerina philosophy Ballerina
 

Mais procurados (18)

C# basics
 C# basics C# basics
C# basics
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Typescript
TypescriptTypescript
Typescript
 
iOS Basic
iOS BasiciOS Basic
iOS Basic
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)
 
Being Expressive in Code
Being Expressive in CodeBeing Expressive in Code
Being Expressive in Code
 
Typescript Basics
Typescript BasicsTypescript Basics
Typescript Basics
 
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard WarburtonJava generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
Java generics past, present and future - Raoul-Gabriel Urma, Richard Warburton
 
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017Introduction to kotlin for android app development   gdg ahmedabad dev fest 2017
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
 
Groovy Programming Language
Groovy Programming LanguageGroovy Programming Language
Groovy Programming Language
 
NDK Primer (AnDevCon Boston 2014)
NDK Primer (AnDevCon Boston 2014)NDK Primer (AnDevCon Boston 2014)
NDK Primer (AnDevCon Boston 2014)
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript Basics
 
Objective c
Objective cObjective c
Objective c
 
C++ basic
C++ basicC++ basic
C++ basic
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variables
 
Ballerina philosophy
Ballerina philosophy Ballerina philosophy
Ballerina philosophy
 

Semelhante a Smalltalk, the dynamic language

Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageAzilen Technologies Pvt. Ltd.
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scaladatamantra
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016maiktoepfer
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: KotlinEvolve
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Michał Konarski
 
New c sharp4_features_part_v
New c sharp4_features_part_vNew c sharp4_features_part_v
New c sharp4_features_part_vNico Ludwig
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Baltasar García Perez-Schofield
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBhalaji Nagarajan
 
Introduction to f#
Introduction to f#Introduction to f#
Introduction to f#mjyeaney
 
Understanding Implicits in Scala
Understanding Implicits in ScalaUnderstanding Implicits in Scala
Understanding Implicits in Scaladatamantra
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?sbjug
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersJuho Teperi
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptxHaythamBarakeh1
 

Semelhante a Smalltalk, the dynamic language (20)

Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!Ruxmon.2013-08.-.CodeBro!
Ruxmon.2013-08.-.CodeBro!
 
Core Java Tutorial
Core Java TutorialCore Java Tutorial
Core Java Tutorial
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: Kotlin
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Unit 1
Unit 1Unit 1
Unit 1
 
Start with swift
Start with swiftStart with swift
Start with swift
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
 
New c sharp4_features_part_v
New c sharp4_features_part_vNew c sharp4_features_part_v
New c sharp4_features_part_v
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
 
JavaScript for real men
JavaScript for real menJavaScript for real men
JavaScript for real men
 
Introduction to f#
Introduction to f#Introduction to f#
Introduction to f#
 
Understanding Implicits in Scala
Understanding Implicits in ScalaUnderstanding Implicits in Scala
Understanding Implicits in Scala
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 

Mais de mohamedsamyali

Computational thinking in Egypt
Computational thinking in EgyptComputational thinking in Egypt
Computational thinking in Egyptmohamedsamyali
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3mohamedsamyali
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
C# Summer course - Lecture 1
C# Summer course - Lecture 1C# Summer course - Lecture 1
C# Summer course - Lecture 1mohamedsamyali
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4mohamedsamyali
 
Computer science department - a four page presentation
Computer science department - a four page presentationComputer science department - a four page presentation
Computer science department - a four page presentationmohamedsamyali
 
Presentation skills for Graduation projects
Presentation skills for Graduation projectsPresentation skills for Graduation projects
Presentation skills for Graduation projectsmohamedsamyali
 
Themes for graduation projects 2010
Themes for graduation projects   2010Themes for graduation projects   2010
Themes for graduation projects 2010mohamedsamyali
 

Mais de mohamedsamyali (11)

Computational thinking in Egypt
Computational thinking in EgyptComputational thinking in Egypt
Computational thinking in Egypt
 
C++ syntax summary
C++ syntax summaryC++ syntax summary
C++ syntax summary
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
C# Summer course - Lecture 1
C# Summer course - Lecture 1C# Summer course - Lecture 1
C# Summer course - Lecture 1
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4
 
Computer science department - a four page presentation
Computer science department - a four page presentationComputer science department - a four page presentation
Computer science department - a four page presentation
 
Presentation skills for Graduation projects
Presentation skills for Graduation projectsPresentation skills for Graduation projects
Presentation skills for Graduation projects
 
Erlang session1
Erlang session1Erlang session1
Erlang session1
 
Erlang session2
Erlang session2Erlang session2
Erlang session2
 
Themes for graduation projects 2010
Themes for graduation projects   2010Themes for graduation projects   2010
Themes for graduation projects 2010
 

Último

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Último (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

Smalltalk, the dynamic language

  • 1. Smalltalk The dynamic language Mohamed Samy August 2011 samy2004@gmail.com
  • 2. The Dynabook project - 1968 ● Presented in the paper "A Personal Computer for children of all ages" by Alan C. Kay
  • 9. Smalltalk ● One of the first OOP languages, greatly influenced OOP ● Ideas transferred to C++, Objective-C, Java, C#, Ruby, Python, Dylan, ...etc...etc ● Has intellectual 'children' like Self, which in turn influenced IO, JavaScript, and Newspeak ● Commercial implementations: ● VisualWorks, Dolphin Smalltalk, VA Smalltalk ● Open source implementations ● Squeak, Pharo, GNU Smalltalk
  • 10. Pure OOP? ● What does a language like C++ do in non object- oriented ways? ● Primitive data types like int, char, float... ● Control flow like if, while, for ● Functions ● Function names ● Classes (while they can create objects, they are not objects). ● The call stack ● Processes/threads ● ...etc
  • 11. Small syntax ● Assignment: a := 5 ● Message sends: obj message obj messageWithArg: 12 obj messageWithArgA: 12 argB: 13 obj1 + obj2 / obj3 ● Note that 1 + 3 * 5 evaluates to 20, since + , * are message sends like any other.
  • 12. Small syntax ● Messages on top of messages: 2 squared factorial ● Message cascading: window := ShellView new show. window position: 80@80; extent: 320@90; backcolor: Color blue; caption: 'Test Window'.
  • 13. Small syntax ● Blocks myFunc := [ MessageBox notify: 'I have arrived mommy' ] myfunc value ● Blocks with args myFunc := [ :x | MessageBox notify: 'I have arrived ' , x] myFunc value: 'Tamer' myFunc := [ :x :y | x + y ] myFunc value: 12 value: 13
  • 14. Pure OOP? ● What does a language like C++ do in non object- oriented ways? ● Primitive data types like int, char, float... ● Control flow like if, while, for ● Functions ● Function names ● Classes (while they can create objects, they are not objects). ● The call stack ● Processes/threads ● ...etc
  • 15. Primitive types ● Integers, floats, fractions, booleans...etc are all objects ● They even have a class hierarchy ^ ^ ● The hierarchy allows e.g switching between different integral types during program execution, making use of the dynamic typing nature of the language. ● Consider 5 factorial class 100 factorial class
  • 16. Control flow ● If ● cond ifTrue: [block] ● cond ifTrue: [block1] ifFalse: [block2] ● While/Until ● [cond] whileTrue: [block] ● [cond] whileFalse: [cond] ● Counting ● 5 timesRepeat: [ MessageBox notify: 'hi' ] ● 1 to: 10 do: [ :a | MessageBox notify: a printString ] ● 1 to: 10 by: 2 do: [ :a | MessageBox notify: a printString ]
  • 17. Let's create a 'whileNot' loop ● 1- Create a class MyLoop and define this method: whileNot: cond do: action cond value ifFalse: [action value. self whileNot: cond do: action ] ● 2- Let's test our method loop = MyLoop new. i:=0. loop whileNot: [ i=10] do : [i:= i+1]. MessageBox notify: i printString
  • 18. Symbols ● An expression like #abc represents an object ● Symbols guarantee that the same #... expression always returns the same object ● This guarantee makes comparing symbols very fast (compare references instead of strings) ● Class names, message selectors, ...etc are symbols ● The benefits of this are related to the dynamic nature of the language, and will appear shortly
  • 19. Pure OOP? ● What does a language like C++ do in non object- oriented ways? ● Primitive data types like int, char, float... ● Control flow like if, while, for ● Functions ● Function names ● Classes (while they can create objects, they are not objects). ● The call stack ● Processes/threads ● ...etc
  • 20. Processes & Continuations clockStep := [Processor sleep: 1000. (View desktop canvas) font: (Font name: 'Arial' pointSize: 36) beBold; text: Time now printString at: 10@10; free ] digitalClockProcess := [ clockStep repeat ] fork.
  • 21. Processes & Continuations ● A process is an object and, like any other, can be sent messages. ● It knows about its call stack, Smalltalk has support for continuations ● This has a lot of uses... ● Debugging ● Distributed computing ● Continuation-based web frameworks like Seaside ● ...
  • 22. Pure OOP? ● What does a language like C++ do in non object- oriented ways? ● Primitive data types like int, char, float... ● Control flow like if, while, for ● Functions ● Function names ● Classes (while they can create objects, they are not objects). ● The call stack ● Processes/threads ● ...etc
  • 23. Secrets of the classes ● How was the class MyLoop created? Object subclass: #MyLoop instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' classInstanceVariableNames: '' ● Can we do this manually?
  • 24. Classes are objects MessageBox notify: 12 class printString Console.WriteLine("{0}",12.GetType( ).ToString( )) System.out.println(myObj.getClass( )) ● Reflection: The program can ask for information about its own classes, methods, fields...etc ● Useful for metaprogramming, many applications ● Automatic serialization ● Generation of GUI ● Factories ● ...etc
  • 25. Classes are objects ● Classes are defined, modified at runtime ● Everything happens at runtime! No compile time/runtime distinction. ● But methods are compiled, into bytecode or JITed ● It's like Photoshop + Interpreter ● The IDE and application are one! ● e.g Debugging ● e.g Inspector ● Inspect & debug IDE!
  • 26. Applications: Smalltalk ● Education ● eToys ● OpenCroquet ● Tools ● The Seaside web framework ● Aida/Web web framework ● Commercial applications ● Auctomatic ● DabbleDB ● Teleplace
  • 27. Applications: Ideas ● Applying the concept to non-smalltalk applications: ● The web, social networks, ...etc are live applications that grow without stopping ● The web-browser itself as a live environment ● A new generation of IDEs ● Creative tools with a programming aspect ● Real tools influenced by Smalltalk: ● Objective-C (iPhone, iPad, Mac applications) ● Java/ .net ● Eclipse ● Firefox 6.0 Scratchpad (demo)