Thursday, July 5, 2007

We Owe It All To Smalltalk

The more I learn about Smalltalk, the more I realize what a foundational language it was.  I'm not convinced it it a language that really deserves widespread use today.  Newer languages have improved upon most of its features in one way or another.  However, a lot of modern programming originated with Smalltalk.  Here's a sampling:

  • The GUI was first popularized on the Xerox Alto which, if I'm not mistaken, was programmed primarily in Smalltalk.
  • The Model-View-Controller UI design model came from Smalltalk
  • Most of our Object Oriented design ideas came from the world of Smalltalk.
  • Unit testing originated in Smalltalk with Kent Beck's Testing Framework.
  • Extreme Programming comes out of the world of Smalltalk programmers.
  • Refactoring came out of the Smalltalk community.
  • Responsibility Driven Development (like CRC cards) came out of Smalltalk too.
  • Design Patterns originated in the Smalltalk community.

Some of this is the language, a lot of it is the community.  Things like XP, Unit Testing, Refactoring, and CRC cards are all obviously community creations.  However, even some of what we usually consider language features come from the community.  In Smalltalk a huge amount of what is enforced by languages today is done through convention.  Smalltalk has objects and inheritance but there is no sense of an interface in the language.  There is no support for abstract classes.  Yet most of the design patterns originated in the world of Smalltalk.

Why is this?  I'm not certain.  At the time, all other languages (other than Simula) were procedural.  Smalltalk was the only one that was object oriented.  The world didn't really tune in to objects until at least a decade after Smalltalk took off.  It's long been said that a programming language influences the way you think.  Perhaps that is what happened.  Maybe in order to come up with extreme programming, you need to be freed from the ways of procedural language.

Why do you think all of these inventions came from this relatively small community?  I'd love to hear your thoughts.

4 comments:

  1. OOP doesn't free you from procedural programming, it's just an abstraction on top of it.
    You can see that every time you write code that depends on modifying state.
    It was possible to do OOP in Lisp too at the time, and it's not fair to call Lisp a procedural language - it's a multi-paradigm language.
    Also, interfaces and abstract classes are crutches that static type systems need.  Dynamic type systems don't need that; if a method is there you can call it, otherwise you'll get a runtime error (which isn't necessarily disastrous, it won't be a segfault).
    In other words, you don't need to restrict your real-life button-pressing ability to objects that implement the interface HasButton, only to objects that have buttons.  The name HasButton is unnecessary.

    ReplyDelete
  2. I get really fed up with Palo Alto and XEROX - PARC getting all the creds for OOP, that's PURE BULLSHIT!
    Simula (from the mod 60s, still taught in universities in Norway) was the origin of OOP.
    They had classes, virtual methods, hiding (methods and data) etc...
    This was in the 1960s! PARC wasn't even STARTED before the mid 70s (something)
    .t

    ReplyDelete
  3. I think it's cool that we recognize major accomplishments of the past, and Smalltalk was indeed massively influential.  Alan Kay and others deserve their awards.
    I'm not sure that all of these were "inventions" though.  I think people have probably been refactoring since 1956 in Fortran.
    Also, we owe a tremendous debt to C++ because it was the hybrid language that introduced OO on a huge scale. OO might have had a cult-following if it weren't for C++.
    That said, two reasons why this community was so ground-breaking:
    (a) They were a focused group of very bright people.
    (b) If you think of computer science as a giant evolutionary tree, there are hundreds of branches (languages, styles), that _didn't_ work out.  The branch of Smalltalk was lucky enough to build on the fertile idea of OO (via Simula etc), execute with astounding excellence, and produce (or influence) amazing offspring (C++, Java).

    ReplyDelete
  4. @Ricky - I understand that you don't need interfaces and abstract classes, but they make things a lot easier.  Abstract classes are useful because the language will stop you from instantiating a class not intended to be instantiating.  In Smalltalk, you can create an object from an abstract class only to run into errors later.  Interfaces, while not strictly necessary, make understanding the code easier.  It's easier to see if something implements ReadStream than to memorize which of the methods need to be present to treat something as a readable stream.
    @Thomas - you are correct that Simula was the first OO language, but I don't think it got the popularity that Smalltalk did.  Thus I said Smalltalk popularized OO.
    @M Easter - Refactoring is not the same as restructing code.  Refactoring is changing the code without changing the functionality.  That may have been done in Fortran, but I think that was more likely changing the code in the process of adding a feature.  Whether it was or not, the formal recognition of the process came out of the Smalltalk community.
    I enjoy reading your insight into why Smalltalk had so much impact.  I think you make great points.

    ReplyDelete