When comparing C vs Smalltalk, the Slant community recommends Smalltalk for most people. In the question“What is the best programming language to learn first?” Smalltalk is ranked 2nd while C is ranked 4th. The most important reason people chose Smalltalk is:
You can modify the system as it's running. You're "swimming with the fish", instead of probing a black box by remote control.
Ranked in these QuestionsQuestion Ranking
Pro Understanding of computers
Learning C forces you to grapple with the low-level workings of your computer (memory management, pointers, etc.) in ways that the other languages abstract away. Without an understanding of these low-level aspects of computer programming you will be limited if you try to develop an application that needs to run in a memory or performance constrained environment.
Other languages like Python can obscure a lot of details, so your foundation may be weaker.
Pro Industry standard
C is the industry standard programming language, moreover, it is the most popular programming language to use. C is the language used for most Windows, UNIX and Mac operating systems.
Pro Helps with learning other languages later
Pro Must have
Capability to program in C is greatly appreciated in developers, creates an image of competency, and many programmers will learn it at some point in their careers.
C is portable between most hardware. Generally a C compiler is made for any new architecture, and already exists for existing architectures.
C is portable between all operating systems (Windows, UNIX and Mac) and only needs a program to be recompiled to work. This allows anyone on any operating system to learn about the language and not be held back by intricacies of their operating system.
With this said, C's portability these days is not quite what it used to be. Much of said portability relies on the POSIX standard in particular, and as time passes, the compliance of a given system with that standard is becoming less certain; especially in the case of Linux. Most things will still be portable (or at least emulatable) between Windows, Linux, and FreeBSD for example; but you will at times need to make use of platform-specific support libraries for certain individual cases, as well.
Pro Low level of abstraction
While higher level languages languages like Java and Python provide possibilities to be "more expressive" per line of code, it's much more convenient to start with "less efficient" (get me right) language, in order to get initial concepts of how things behave at lower level.
Actually C is a good starting point moving to both higher and lower levels of abstraction, the good example here would be learning C before Assembler, as for general use the Assembler quite hard to understand due to low level of its abstraction (like getting the understanding on how loops work in C before trying to implement them on Assembler).
Pro Teaches good practices
Writing in C will require you to understand how things are done. C implies using and understanding the fundamentals. Learning a higher-level language after is much easier.
Pro If you can't grok C you should not be a professional programmer
It sets an early bar that if you can't hurdle you might as well do something other than programming and not waste any more of your time.
Pro Basic concepts can be applied to accelerate learning any other language
You can easily pivot knowledge learned here and apply it to almost every other language.
Pro C is simple with lesser rules than any other language
C is standardized and it is the goto language when you have to speed things up
Pro More control over the code
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 Internal source code and documentation
You can explore how everything works easily.
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 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 Incremental compilation
Provides an extremely fast code-compile-run-debug cycle. This is great for beginners to experiment and prototype ideas.
Pro Inspired many other languages' object systems
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 Powerful integrated debugger
You can edit code and swap it in while the your 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 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 Open source
MIT licensed implementations Pharo, Squeak, Cuis & Dolphin
and GPL licensed GnuSmalltalk.
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 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 First-class functions with lexical closures
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.
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.
Con Languages is full of corner cases and undefined behaviors
Undefined behavior in a program can cause unexpected results, making it hard to debug. With UB, program behavior may vary wildly depending on optimization settings. There are many cases that invoke UB, such as signed overflow, invalid dereferences, large integer shifts, uninitialized variables, etc. These serve to frustrate novice programmers when they could be learning other concepts.
Con C will require you to learn concepts too advanced for most beginners
While other programmers will learn algorithms and structures and will do magic tricks and awesome applications, you will learn trash info that you should know maybe after 5-7 years experience in software development, not earlier. It's like going the first time as a seven year old kid to first school class, and your teacher tells you to learn you about Discrete Math, without basic math and how to do 2x2.
If you wish to be a really good programmer, C for sure will be in your portfolio, but not as a first language, and this programming language is used only for very hard and very limited tools which require a lot of professional skills from the programmer.
Con Requires memory management
Learning programming is already hard enough when you don't have to worry about memory leaks.
Con Long learning curve
While the language compliments knowledge of computer components very well, and gives a deeper understanding, it is also quite difficult to learn, and to use correctly, especially without aforementioned knowledge.
Con Completely lacks type safety
The C standard library is not type safe, and the language itself does not promote type safety built into the language, which leads to error-proneness of the language. If anything, I would recommend those interested in C to instead put their time in D, which actually includes a complete copy of the C standard library rewritten to be fully type safe.
Depending on the purpose this can be either a pro or a con. If the task is to learn how to program, low-level of C will impend learning important concepts. Furthermore, C is rather limited in ways of building abstractions.
"Low-levelness" of C can be a pro feature in learning system programming.
Con Heavily outdated programming concepts
C lacks a large majority of programming concepts that modern languages make use of today. The existing functionality of C makes use of outdated and deprecated methodologies which can be of great annoyance to the modern day programmer.
Con Does not support modules; header file annoyances
Header files are a poor man's implementation of modules. Modern programming languages make use of modules which eliminate the need for C includes and header files and the many issues caused by them, such as the complete lack of dependency checking. Header files often contain even more include statements that point to other header files which also point to even more which drastically increases compile time. Modules only have to be compiled once, and when importing those modules into your software project, you only have to pull in the module that you are using, which is often times already precompiled. This way, the compiler knows exactly what it needs before beginning to compile your project and can automatically compile the few dependencies it needs in advance rather than recursively compiling every header file it runs across as in C.
Con Lack of support for first class strings
C does not support the string type, nor does it support UTF-8 strings that modern languages are employing today. Instead of strings, C makes use of the *char type which is a pointer to a character array.
Con Arrays are not first class objects
When an array is passed to a function, it is converted to a pointer, even though the prototype confusingly says it's an array. When this conversion happens, all array type information gets lost. C arrays also cannot not be resized, which means that even simple aggregates like a stack are complicated to implement. C arrays also cannot be bounds checked, because they don't know what the array bounds are.
Con The need for C developers in the current market is very low, and trending downward
Older languages, like C, are no longer in their hay day. Even if you do learn it as your first language, you are only setting yourself up to need to learn another language in the long run. If you want a skill that you can not only learn from, but also potentially build a career on, C should not be your first choice.
Con Isn't truly portable or cross platform
The C programming language is not portable to other operating systems, and even different compilers, because the C language does not provide any reference cross platform libraries or compilers. Different platforms and compilers provide their own implementation of the C standard library which may not be compatible with the implementation in another compiler or platform. Without cross platform libraries and tools, one cannot state that C is portable. This is in stark contrast to modern programming languages that provide their own cross platform libraries and compilers, such as D, Go and Rust.
Con Compiles procedurally rather than intelligently
In the same manner that C recursively compiles header files ad infinitum without any sort of dependency checking, C source code is also compiled in the same manner. If you attempt to call a function before it is declared, the compiler will fail because the function was not compiled before it was caled.
Con C structs are very weak and outdated
C structs lack a lot of modern capabilities that are vital in programming languages of today, such as assigning member functions to structs to give them object-oriented capabilities, constructs, deconstructors and RAII. Great care must be used when using structs in C to prevent memory leaks and ridiculously slow structs.
Con Includes require obscene resources to compile
All the modern languages have resulted in ditching the ancient deprecated model of #include statements and have instead adopted the superior model of modules. When compiling software written in C, the programmer is forced to also compile X headers which contain Y headers which contain Z headers and so forth -- drastically increasing the number of lines that need to be compiled. In order to compile something as simple as "Hello, World", for example, 18K lines of code needs to be compiled. This can be very taxing on RAM and CPU resources, causing compile times to quickly absorb a large portion of the programming process.
Con Only offers basic support for source code split into multiple files
Modern programming languages are capable of compiling split source code files by concatenating them together efficiently at compile time before compiling them. However, C requires the developer to resort to messing with header files and makefiles to get similar functionality.
Con Not common
Smalltalk and its implementations are no longer popular languages to use. Available jobs are scarce (but do exist), and online communities are relatively small. There is little to no modern books or resources made for the language, although older, very good books do exist.
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 so easy.
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.