When comparing Scheme vs Smalltalk, the Slant community recommends Scheme for most people. In the question“What is the best programming language to learn first?” Scheme is ranked 8th while Smalltalk is ranked 15th. The most important reason people chose Scheme is:
Scheme syntax is extremely regular and easy to pick up. A *formal* specification of the syntax fits onto just a few pages; it can be introduced informally in a paragraph or two. Students are not distracted by remembering how to write if statements or loops or even operator precedence because every syntactic follows the same pattern. Ultimately, everything looks something like this: (func a b c) This includes not only user-defined functions but even control flow: (if cond then-clause else-clause) or even primitive operations like `define` and `set`: (define foo 10) (set! foo 11) This means that nothing really has special syntactic treatment in the language. There are essentially no weird edge-cases to memorize, and different concepts are given a more equal weight in the language. (Unlike Algol-like languages which tend to given undue weight to loops and assignment statements, for example.)
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Simple syntax
Scheme syntax is extremely regular and easy to pick up. A formal specification of the syntax fits onto just a few pages; it can be introduced informally in a paragraph or two. Students are not distracted by remembering how to write if statements or loops or even operator precedence because every syntactic follows the same pattern.
Ultimately, everything looks something like this:
(func a b c)
This includes not only user-defined functions but even control flow:
(if cond then-clause else-clause)
or even primitive operations like define
and set
:
(define foo 10)
(set! foo 11)
This means that nothing really has special syntactic treatment in the language. There are essentially no weird edge-cases to memorize, and different concepts are given a more equal weight in the language. (Unlike Algol-like languages which tend to given undue weight to loops and assignment statements, for example.)
Pro No magic - it's clear how everything works
Scheme has far less built into the language itself, helping students see that things like OOP are not magical: they are just patterns for organizing code. Everything in Scheme is built up from a very small set of primitives which compose in a natural and intuitive fashion.
Having a language that does not accord many things special status helps keep students open minded. This will help students later go between different languages and paradigms from procedural to object-oriented to functional.
Pro Great at teaching fundamental programming ideas
Scheme teaches the important, fundamental ideas immediately without the distraction of unnecessary syntax or language features.
Pro Multi platform
GNU/Linux, OS X, and Windows versions available.
Pro Great, well known textbooks
There is a set of very strong textbooks introducing CS and programming using Scheme. These books are available for free online.
The most famous example--and one of the most famous CS books full stop--is Structure and Interpretation of Computer Programs usually known as SICP. This book introduces fundamental ideas in computer science and covers an incredible amount of material quickly and clearly without requiring any prior knowledge.
However, some people find SICP a bit challenging as a first text. Happily, there are other more introductory texts as well. Simply Scheme is a book designed to be read before SICP, easing beginners into the language as well as CS and programming in general. How to Design Programs is another text used in introductory college courses.
Pro Encourages creativity
Pro Robust metaprogramming
The quotation functionality of Lisp allow for extremely powerful, yet syntactically straightforward metaprogramming via macros. This is more powerful than the C preprocessor while being less involved than something like Template Haskell or F# quotations.
Using macros to properly decompose a problem domain teaches new developers good habits, improving composibility and reliability when tackling large programs. Scheme metaprogramming also serves as a gentle introduction to domain specific languages.
Pro Multiparadigm
Unlike most languages, Scheme actually accords both functional programming and imperative programming roughly equal status. Many other languages like Python and Java are staunchly imperative while SML and Haskell are primarily functional; Scheme is a nice middle ground.
Additionally, since Scheme syntax is extremely flexible, it can easily be re-purposed for teaching non-deterministic and logic programming. There is no need to learn a new language like Prolog when the same ideas can easily be expressed with Scheme syntax.
This gives students a good perspective on different ways to think about and organize programs, which makes it much easier to move forward to other languages and technologies.
Pro Environment of live objects
You can modify the system as it's running. You're "swimming with the fish", instead of probing a black box by remote control.
Pro Easy to learn and experiment
Pro Inspector makes objects transparent
Programmers must make detailed mental models of the system they are developing. Bugs usually happen when the mental model does not match the actual system. This is one of the greatest difficulties beginners have because most systems are so opaque. It takes a lot of effort to see what's really going on. But in Smalltalk this is much easier, thanks to the powerful tools included in the environment, like the object inspector.
Pro Superb Integrated Development Environment (IDE)
All tools (Inspector, Browser, Debugger etc.) are written in Smalltalk and are live objects in the environment. All sources are present, so that the tools can easily be studied, changed and experimented with.
The same goes for the other components like the compiler, OS-Integration etc.
Pro Pure and easy object orientation
Smalltalk is one of few languages that are purely object oriented. This provides a solid and easy to understand base on which to learn object oriented programming, the most popular approach to programming.
Pro Elegant syntax fits on a postcard
The syntax was designed to be easy enough for children to learn. Beginners can learn the language rules very quickly and then focus on programming without fighting the syntax at the same time. Things that have to be baked into the grammar in other languages are simple message sends with block arguments in Smalltalk. Expressions have only three precedence levels to worry about.
Pro Agile "interactive" test-driven development
Smalltalk had the original (and still the best) unit test system that inspired it in many other languages (like Java's JUnit). Working with interactive live objects in Smalltalk style TDD makes it easy to teach and learn TDD.
Pro Powerful integrated debugger
You can edit code and swap it in while the program is still running after an exception has already been signaled, or restart from anywhere in the call stack. You can inspect and modify the state of any object. Some Smalltalkers write unit tests and then program exclusively in the debugger.
Pro Internal source code and documentation
You can explore how everything works easily.
Pro Incremental compilation
Smalltalk provides an extremely fast code-compile-run-debug cycle. You don't have to stop and reset the world to tweak your program, since you can compile one method at a time while the environment is still running. This is great for beginners to experiment and prototype ideas.
Pro Inspired many other languages' object systems
Pro Open source
MIT licensed implementations Pharo, Squeak, Cuis & Dolphin
and GPL licensed GnuSmalltalk.
Pro Save and restore virtual machine image
A Smalltalk environment can save the state of a running program and later restore and resume execution. This includes the internal state of live objects, multiple thread stacks, and debugging sessions, making it easier for beginners to take the exact problem to an expert for assistance.
Pro Language uniformity
This leads to a very simple programming model (pure OO) that is still very powerful. A lot of stuff that is hard to implement in other languages is easier in Smalltalk.
Pro Graphical user interface
Beginners are usually stuck making command-line applications in other languages, because GUIs are too hard. Smalltalk GUIs are easy enough to start with.
Pro First-class functions with lexical closures
Also known as "blocks". These objects contain reusable snippets of code and as first-class objects they can be passed as arguments to other methods or blocks and also returned from them. "lexical closures" mean they retain access to the variables in the lexical environment they were written in, that is, in the surrounding code.
Pro It invented a lot of stuff
Smalltalk is the inventor of Just-in-Time compilation and the MVC concept, refactoring through their so-called refactoring browser and it was also one of the first adopters of a language virtual machine, closures, live programming, test driven development, an IDE and the development of GUI`s.
Pro As a first language, almost forces you to learn OO design
Hybrid languages (e.g., Java, C#, C++) make it easy to slip into procedural thinking. Smalltalk's pure OO approach makes it hard not to think in object-oriented terms. In addition, since the entire IDE and runtime components are there in the image for you to browse, you have plenty of examples of good OO design to learn from.
Pro Provides a functional way to interact with objects
Many languages today use object orientation, while the most of them stock on the half way in that perspective.
Smalltalk sees literally everything as an object and this includes things like the classes and primitive data types. There is are zero control structures such as selection and iteration, since all is done by sending messages to objects.
It use a lot of concepts from Lisp in order to provide a nice experience for this pure kind of object orientation.
It provides immutable data structures, closures, anonymous functions and higher order functions, while all those functions are objects. This is what makes Smalltalk so simple, elegant, and easy.
All this counts for Pharo, while other implementations as Amber are probably feature complete to it.
Cons
Con Little job market
There are little to none jobs searching for a Scheme programmer. The ones that exist are more related to Research in Maths or Artificial Intelligence.
Con A language that is purely academic
If someone said "I am starting a project in Scheme" then they are either talking about their homework or they are starting a joke.
Con Fragmented ecosystem
Scheme is an IEEE standard, not an implementation. Unfortunately, the standard is too minimal and practical implementations have diverged--they had to expand on the standard to get anything done, but did so in incompatible ways.
The later de facto standard R6RS tried to correct this, but lost Scheme's minimalist elegance in the process. The newer R7RS standard takes the best of both worlds with an elegant minimalist core and a practical standard library.
Con Very different semantics from mainstream programming languages
LISP-like languages are very different from mainstream languages (such as C/C++/Java/JavaScript/Python/you-name-it) - both in semantics and syntax. This, in turn, severely limits uses of whatever-learned-with-Scheme, for real-world use.
Con OO is becoming obsolete
Smalltalk did it best, but the whole paradigm is a poor fit for the expected future multicore processors. Isolated mutable variables with no compile checks is a recipe for race conditions in multithreaded code. Beginners would be better off learning a functional language.
Con Not common
Smalltalk missed an opportunity to become mainstream when its implementations cost $5000 per seat versus $0 open source. New open source implementations (Pharo, Squeak) have minor corporate backers but not yet an IT behemoth. Direct jobs are scarce (but indirectly Smalltalk experience is very well regarded). Online communities are relatively small.
Con Not useful for mobile development
While Smalltalk is very powerful and easy to learn, it doesn't have a well supported mobile distribution, but you'll be spoiled for working in mainstream languages like Java, Swift or Kotlin where jobs are more readily available.
Con Virtual machine in its own isolated world
Smalltalk wants to be the whole OS. While this has tremendous advantages internally, interacting with the world outside the VM is not as easy as pure Smalltalk and must be done via a Foreign Function Interface.
Con Non-standard arithmetic ordering
Since every operation is considered a message sent sent is a specific order, all arithmetic operators have the same precedence. E.g. 2 + 3 x 4 translates to 2 + 3, and the result is multiplied by 4, giving an answer of 24 (instead of the correct answer - 14). Once you are learn this, it can easily handled using brackets, e.g. 2 + (3 x 4), but still a momentary suprise for beginners.