Object-Oriented Programming (OOP)

Summarized using AI

Learning from Smalltalk

Sasha Gerrand • February 19, 2014 • Earth

The video titled "Learning from Smalltalk," presented by Sasha Gerrand at RubyConf AU 2014, explores the significant influence of Smalltalk on the Ruby programming language and shares key lessons that Ruby developers can take away from Smalltalk's design and principles.

Main Topic:

The essence of the talk centers around understanding Smalltalk, its historical roots, and its contributions to modern programming, particularly highlighting how Ruby has been shaped by its predecessor.

Key Points Discussed:

  • Historical Context of Smalltalk:

    • Developed in the late 60s and 70s at Xerox PARC by Alan Kay and others.
    • Inspired by the goal of human-computer interaction rather than traditional programming methods.
    • The name "Smalltalk" was chosen to be approachable and less intimidating, intended to encourage children to learn programming.
  • Influence on Ruby:

    • Both languages are object-oriented, dynamically typed, and rely heavily on the concept that everything is an object, including primitive types.
    • Smalltalk served as a foundational model for the design of Ruby, which operates on similar principles but includes additional features.
  • Characteristics of Smalltalk:

    • Syntax Differences: Smalltalk has a distinct syntax, particularly how it handles variables and literals. Unlike Ruby, it does not use regex or commas in array elements.
    • Development Environment: Smalltalk integrates an IDE with real-time code editing capabilities, including a class browser and debugger, which enhance the development process.
  • Key Advantages of Smalltalk:

    • Virtual Machine Integration: Smalltalk operates within a powerful virtual machine that allows persistent state management, enabling real-time updates and debugging.
    • Real-time Code Inspection: The development tools in Smalltalk facilitate efficient debugging and profiling, supporting developers in making modifications seamlessly during runtime.
    • Exceptional Debugging Tools: Smalltalk's robust debugging environment is designed to provide comprehensive insights into program state and helps in troubleshooting without the usual overhead.

Illustrative Anecdotes:

  • Historical Anecdote: The talk references Steve Jobs's visit to Xerox PARC, which led to pivotal developments in macOS, highlighting Smalltalk's influence beyond programming.
  • Personal Experience: Sasha shares a personal moment from childhood when he first encountered Smalltalk, illustrating its lasting impression on his development journey.

Conclusions and Takeaways:

  • Smalltalk offers a unique programming environment characterized by its interplay between language and development tools, which Ruby might benefit from adopting.
  • Aspiring developers and Rubyists are encouraged to explore Smalltalk to appreciate its historical significance and modern-day applications, particularly through open-source implementations like Squeak.
  • Lessons from Smalltalk can inform Ruby's evolution, particularly in areas like debugging and real-time code management.

This exploration not only highlights the foundational principles of Smalltalk but also serves as a reminder of the importance of learning from programming history to innovate within current languages.

Learning from Smalltalk
Sasha Gerrand • February 19, 2014 • Earth

RubyConf AU 2014: http://www.rubyconf.org.au

Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk is a "pure" object-oriented programming language, meaning that, unlike Java and C++, there is no difference between values which are objects and values which are primitive types. In Smalltalk, primitive values such as integers, booleans and characters are also objects, in the sense that they are instances of corresponding classes, and operations on them are invoked by sending messages.
Sound familiar?
Smalltalk leaves a long shadow on the programming landscape and can be considered both as an ancestor and influence on the design of Ruby. This talk introduces Smalltalk to Rubyists and covers software principles which can be applied to Ruby applications, both large and small.
Topics include:
Brief overview
Design
Expressions
Literals
Messages
Patterns
Reflection

RubyConf AU 2014

00:00:07.440 Thanks, Matt. Thanks everyone for coming to this last talk prior to the closing keynote. I hope everyone's revved up appropriately.
00:00:14.320 I hope my laptop stops falling asleep. The topic of my talk today is Smalltalk and what we can learn from it.
00:00:24.240 When I started looking at the talks being proposed for RubyConf this year, there were a lot of future-looking talks discussing how Ruby could improve. I thought, why not look at where Ruby came from? Smalltalk is a significant inspiration for Ruby.
00:00:43.920 As Matt mentioned, my name is Sasha Gerrand. I'm a programmer working for BigCommerce. I'd like to dedicate my talk to Jim, as RubyConf, in particular, left a big impact on me when I was first learning Ruby.
00:00:59.680 So, a timely question is: what is Smalltalk, anyway, and what relation does it have at a Ruby conference? Well, Smalltalk is very much a forebear of Ruby. It has had a very strong influence on it. Like Ruby, it's object-oriented, dynamically typed, interpreted, reflective, and strongly typed.
00:01:22.720 Smalltalk was created in the late 60s and early 70s as part of a movement around human-computer symbiosis, moving away from punch cards to more interactive methods. It was created at the famed Xerox PARC by Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Scott Wallace, and many others.
00:01:47.040 Alan Kay is considered one of the forefathers of object-oriented programming and made significant contributions to modern windowing systems. Dan Ingalls implemented the first generations of Smalltalk under Alan's initial guidance, while Adele did substantial work on what were called design templates, which resemble what we know today as design patterns.
00:02:10.720 So, how did Smalltalk get its name? There's a good quote from Alan about it. He mentioned that he called it Smalltalk because programming should be a matter of small talk, and children should learn to program in Smalltalk.
00:02:30.000 His research group aimed to introduce people to programming in a new way, with Smalltalk designed for that goal. He also stated he chose the name Smalltalk because it was innocuous enough that if it achieved anything good, people would be pleasantly surprised.
00:02:56.560 Unlike names like ALGOL, FORTRAN, or COBOL, Smalltalk sounded less intimidating. From the 60s to late 70s, various concepts that Alan was developing influenced by other languages like Logo were implemented very early at Xerox PARC.
00:03:11.440 By 1980, they had a version ready for external companies for peer review. There's an anecdote about Steve Jobs touring Xerox PARC when he famously walked out with insights into windowing systems, mouse mechanics, and what we know as macOS today.
00:03:18.720 Adele Goldberg infamously refused to demonstrate Smalltalk during Jobs' visit, which led to a substantial influence on the early work on macOS and the Laser Macintosh at that time. Unfortunately, after Smalltalk-80 was released, commercialization of software and development environments became a major trend.
00:03:50.000 Smalltalk faced difficulties in the 90s as languages like Java were released for free, leading to fierce competition since providers like ParcPlace Systems were charging about $5,000 per seat for developers using Smalltalk. This made it hard to onboard new developers into the language.
00:04:07.200 Luckily, Smalltalk's influence remained strong, inspiring people like Mats. Open-source versions such as Squeak have continued, and original Smalltalk developers have released their forks. These versions are freely available, with a newer command-line oriented version available.
00:04:23.600 One limitation of Smalltalk is that it was primarily GUI-oriented, making it somewhat challenging to run from the command line. Reiterating the significance of the language itself, Smalltalk is often recognized as the first object-oriented language.
00:04:44.080 Like Ruby, an object in Smalltalk is always an instance of a class. Classes serve as blueprints, defining behavior and properties of instances, with slight polymorphic behavior as subclasses can extend a superclass.
00:05:06.080 In fact, all values in Smalltalk are objects, including nil and boolean values. However, Smalltalk is relatively limited compared to Ruby, but they share some similarities, such as that Smalltalk objects can hold state, receive messages, and send messages.
00:05:23.120 Now, regarding syntax, Smalltalk's literal syntax has similarities to Ruby. However, it is slightly different when it comes to symbols. Smalltalk doesn't support regex, but it is quite flexible with respect to numeric representations, including binary and hexadecimal.
00:05:38.000 Despite these differences, the array syntax in Smalltalk is not vastly different from Ruby's. One key difference between the two languages is that Smalltalk doesn't use commas to separate values.
00:05:52.000 In terms of variable declarations, a notable distinction is that in Ruby, you can declare variables anywhere, while in Smalltalk, you need to declare the usage of variables. A common method of doing this in Smalltalk is to use pipes around your variable name.
00:06:17.440 In the above example, single variable 'a' is being declared, followed below by variables 'a', 'b', and 'c'. For those who've worked in languages like Go, Smalltalk's variable assignment is more closely aligned with that.
00:06:36.080 Ruby's syntax for variable assignment and equality comparisons is similar to that in Smalltalk. I'll stop dwelling on syntax now, as it may be a little dry, and we're nearing the conclusion of RubyConf.
00:06:50.080 Many links will be provided at the end of my talk for anyone interested in learning to program in Smalltalk. I'll briefly recap some differences between Smalltalk and Ruby.
00:07:12.080 Smalltalk itself is more than just a programming language. When developing in Smalltalk, you're working within a virtual machine where state management is critical, affecting how development is made.
00:07:26.800 You have persistent state available for inspection at all times, allowing for real-time code changes. Imagine how beneficial it is to change method signatures or return values while actively programming.
00:07:41.920 Additionally, debugging becomes easier as developers can access all information regarding program state and troubleshoot issues without needing to reproduce them after the fact.
00:08:05.680 The core difference is that Smalltalk combines the language with the virtual machine --- it's not about editing code files and running them through an interpreter. Instead, developers are editing text directly inside the virtual machine.
00:08:26.920 Smalltalk was the first integrated development environment (IDE) I encountered as a child. I remember being amazed when my dad took me to work, where an engineer demonstrated its capabilities.
00:08:52.720 This environment included a code editor, class browser for inspecting messages in flight, a graphic library full of user interface components, and tools such as debuggers, profilers, and test runners.
00:09:11.280 In conclusion, I want to touch on some semantic differences between Ruby and Smalltalk. Ruby incorporates mixed-in capabilities, allowing dynamic alterations.
00:09:31.520 Smalltalk, however, relies more heavily on a static implementation without similar flexibility. In Ruby, you can add methods to objects dynamically; in Smalltalk, all methods reside within defined classes.
00:10:02.400 Ruby allows for dynamic method addition, while in Smalltalk, method relocation is strictly class-oriented. Ruby provides more macros within class definitions, while Smalltalk lacks such features.
00:10:25.440 Smalltalk implementations provide beneficial features like ordered collections, automatically maintaining sorted order of lists during mutations, whilst Ruby requires manual sorting each time.
00:10:41.600 Through my exploration of Smalltalk, I've come to appreciate its unique advantages, particularly regarding its development environment. The class browser enables real-time application insight that Ruby's tools don't offer.
00:10:58.880 The debugging capabilities in Smalltalk are particularly impressive. Had I grown up coding in Smalltalk, I feel I would have found it challenging to adapt to environments lacking such supportive features.
00:11:19.520 I highly encourage everyone to check out the links I have at the end of this talk, which allow you to download and run Squeak or other modern Smalltalk implementations.
00:11:38.560 Regex isn't supported in Smalltalk, but the built-in debugging and profiling tools are exceptional. The Smalltalk VM essentially functions as a light table, akin to modern interactive programming environments.
00:11:54.320 As a Rubyist, these features would greatly enhance my development experience. I hope to see similar concepts in Ruby's ecosystem, particularly given that Light Table has focused more on other languages.
00:12:06.400 In conclusion, thank you for your time. I hope you found my observations on Smalltalk enlightening. I'm open to any questions you may have.
00:12:29.120 Thank you. What specifically do you like about the class browser? Could you explain that feature and others like the debugger and profiler?
00:12:50.320 One great benefit of the class browser in Squeak is the ability to inspect code and objects in real-time. It allows developers to traverse a method tree, filter messages, and see their instances in action.
00:13:27.120 The investment in runtime inspections and debugging tools available in Smalltalk greatly enhance its utility for developers. Every part of your codebase can be analyzed and optimized while it runs.
00:13:54.160 With the introduction of questions about the visual aspects of Smalltalk, it's paramount to comprehend how images persist data throughout the programming lifecycle.
00:14:24.560 Images within the Smalltalk VM save data at regular intervals, so if an application crashes, you can retrieve the most recent state, ensuring minimal loss of progress.
00:14:40.160 Do note there's a continuous saving mechanism that protects most recent interactions. This significantly enhances developer confidence during their programming tasks.
00:15:00.040 This assurance translates back into small talk, making it a unique experience during coding. Thank you all once again!
Explore all talks recorded at RubyConf AU 2014
+17