$30 off During Our Annual Pro Sale. View Details »

Object-Oriented Programming Basics with Smalltalk

Object-Oriented Programming Basics with Smalltalk

Presented at CodeMash 2016

Larry Staton Jr.

January 07, 2016
Tweet

More Decks by Larry Staton Jr.

Other Decks in Programming

Transcript

  1. SMALLTALK
    OBJECT-ORIENTED PROGRAMMING BASICS

    View Slide

  2. @statonjr OOP Basics with Smalltalk
    100 Dealerships
    10,000+ Employees

    View Slide

  3. @statonjr OOP Basics with Smalltalk
    OVERVIEW

    View Slide

  4. @statonjr OOP Basics with Smalltalk
    What is
    OBJECT-ORIENTED PROGRAMMING?

    View Slide

  5. View Slide

  6. @statonjr OOP Basics with Smalltalk
    1966

    View Slide

  7. @statonjr OOP Basics with Smalltalk
    1970

    View Slide

  8. @statonjr OOP Basics with Smalltalk
    1972

    View Slide

  9. @statonjr OOP Basics with Smalltalk
    Six Main Ideas of Smalltalk

    View Slide

  10. @statonjr OOP Basics with Smalltalk
    Everything is an object

    View Slide

  11. @statonjr OOP Basics with Smalltalk
    Objects communicate by sending and receiving messages

    View Slide

  12. @statonjr OOP Basics with Smalltalk
    Objects have their own memory

    View Slide

  13. @statonjr OOP Basics with Smalltalk
    Every object is an instance of a class

    View Slide

  14. @statonjr OOP Basics with Smalltalk
    The class holds the shared behavior for its instances

    View Slide

  15. @statonjr OOP Basics with Smalltalk
    To eval a program list, control is passed to the first
    object and the remainder is treated as its message

    View Slide

  16. @statonjr OOP Basics with Smalltalk
    1976

    View Slide

  17. @statonjr OOP Basics with Smalltalk

    View Slide

  18. @statonjr OOP Basics with Smalltalk
    Everything is an object

    View Slide

  19. @statonjr OOP Basics with Smalltalk
    Data
    Code

    View Slide

  20. @statonjr OOP Basics with Smalltalk
    Data
    Code Methods

    View Slide

  21. @statonjr OOP Basics with Smalltalk
    Data
    Code Methods
    Variables

    View Slide

  22. GENERALLY, WE DON'T WANT THE
    PROGRAMMER TO BE MESSING
    AROUND WITH STATE, WHETHER
    SIMULATED OR NOT.
    Alan Kay
    THE EARLY HISTORY OF SMALLTALK

    View Slide

  23. @statonjr OOP Basics with Smalltalk
    Objects communicate by sending and receiving messages

    View Slide

  24. @statonjr OOP Basics with Smalltalk
    SENDER RECEIVER
    Message
    Return Value

    View Slide

  25. @statonjr OOP Basics with Smalltalk
    Every object is an instance of a class

    View Slide

  26. @statonjr OOP Basics with Smalltalk
    Class Instances

    View Slide

  27. @statonjr OOP Basics with Smalltalk
    Class Instance
    Class Methods Class Variables
    Instance Methods Instance Variables
    Instance Methods Instance Variables

    View Slide

  28. @statonjr OOP Basics with Smalltalk
    The class holds the shared behavior for its instances

    View Slide

  29. @statonjr OOP Basics with Smalltalk
    COMPOSITION

    View Slide

  30. @statonjr OOP Basics with Smalltalk
    INHERITANCE

    View Slide

  31. @statonjr OOP Basics with Smalltalk
    name
    age
    grade
    Person
    Student

    View Slide

  32. @statonjr OOP Basics with Smalltalk
    POLYMORPHISM

    View Slide

  33. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX

    View Slide

  34. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX

    View Slide

  35. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX
    Tokens: Identifiers, Numbers, ‘Strings’, “Comments”, Binary
    Operators, Keywords, Special Tokens

    View Slide

  36. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX
    Special Tokens: #:^’|”;()[]
    Tokens: Identifiers, Numbers, ‘Strings’, “Comments”, Binary
    Operators, Keywords, Special Tokens

    View Slide

  37. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX
    Special Tokens: #:^’|”;()[]
    Tokens: Identifiers, Numbers, ‘Strings’, “Comments”, Binary
    Operators, Keywords, Special Tokens
    Reserved Words: nil false true self super

    View Slide

  38. @statonjr OOP Basics with Smalltalk
    SMALLTALK SYNTAX
    Special Tokens: #:^’|”;()[]
    Tokens: Identifiers, Numbers, ‘Strings’, “Comments”, Binary
    Operators, Keywords, Special Tokens
    Reserved Words: nil false true self super
    Syntactic Forms: Unary messages, Binary messages,
    Keyword messages, Block closures, Return Value,
    Method definition, Assignment, Cascade

    View Slide

  39. @statonjr OOP Basics with Smalltalk
    DEMO

    View Slide

  40. @statonjr OOP Basics with Smalltalk
    RESOURCES
    http://pharo.org
    http://pharobyexample.org
    Smalltalk-80: The Language and Its Implementation
    http://files.pharo.org/books/
    ProfStef go

    View Slide