Learning from Programming Languages

Knowing how to program involves learning a programming language. Like languages in general, there are many different kinds of programming languages which offer different (and maybe subtle) structures. Languages can share similar roots (such as Latin based languages), and therefore some attributes such as grammar. Languages can be a reflection of a culture and also lead to different ways of thinking, so knowing multiple languages is a great benefit to advancing your skills (in programming or beyond).

I saw a recent post asking why someone should learn Swift, so I started thinking what are some of the things I've learned from programming languages.

Basic and then Visual Basic taught me some of the magic of creating from virtually nothing to a working useful program. In retrospect, it also showed me how easy UI programming could be with a UI builder; programs that can help with programming are very useful tools.

Turbo Pascal taught me general imperative style programming with records. It also made me aware of operators and all these years later, I still wonder about having an explicit := operator versus overloading =.

C taught me about pointers, memory management, heap allocation versus stack allocation, and type casting. It drove home the pains of manual memory management and the random segfault.

C++ taught me about classes and inheritance, polymorphism and virtual methods (e.g. dynamic dispatch versus static), templates, and namespaces. It was the first programming language where I felt that the syntax with all the templates and operator overloading was a bit much, especially when reading the source code for things like Boost.

PHP taught me about the ease which you can put a website on the web. In retrospect, it also showed the great power of having a single request/response context lifecycle. Not having to worry about multithreaded access to a variable, concurrency deadlocks, etc. makes for a much simpler programming model.

Java taught me about interfaces/protocols, bytecode and virtual machines, garbage collection, package management and distribution (e.g. Maven), schemas and the advantages/disadvantages of XML, multithreading in a server based environment, exception handling, and enterprise design patterns (for better or worse). JavaDoc was also very influential as well as automated unit based testing.

Scheme taught me about functional programming and side-effects. It also showed me how beautiful and ugly parentheses are.

JavaScript taught me the power of what a runtime environment can do and the power of a platform. The prototype based inheritance is interesting, but JavaScript's ability to continue to evolve and power so many critical functions today (within just the browser) is amazing. Of course, the actual JavaScript language in the early days of the web is very different than today. The DOM, event handling, closures and capturing of contexts, and callbacks are other things that I learned with JavaScript. Promises and the async/await coroutines are also some recent things I've picked up. While all of these are great leaps and strides over the original language, it is really the power of the web platform that has made the continued investment in this language worthwhile.

Objective-C taught me about reference counting and dynamic messaging passing. From the Cocoa framework, it taught me about the power of immutability versus mutability, practical design patterns, and framework and API design. Grand Central Dispatch (a.k.a Dispatch) taught me about different ways to think about concurrency.

Ruby taught me about the power of duck typing. While not particular to Ruby, the community around Ruby on Rails taught me about the power of community derived conventions and common abstractions. It also taught me about monkey patching, and how programming languages/libraries/frameworks should really be meant to be joyful. Ruby is also the language where I learned how TDD is almost a must have skill for some languages.

Node.js taught me about event loops and how one can really re-purpose a language from one environment to another. It also showed me how micro-libraries and the framework of the hour can both help and harm the community.

Swift is teaching me about protocol oriented programming.

Go is teaching me more about co-routines and different ways of looking at interface design.

Rust has taught me about memory ownership in ways that I like and dislike.

If I were to name the most influential languages, I would have to say C, Scheme, and JavaScript. Each one of them has a fundamental trait (e.g. memory management, functional programming, and closures) that practically define the usage of the language. Rust may also be along the same lines eventually as I use it more.

From an API/framework point of view, Foundation/Grand Central Dispatch/Cocoa (Objective-C/Swift), and Ruby's libraries are perhaps the most fun to work with. Swift's Standard Library and Rust's have perhaps the most modernized abstractions (which can be great but also frustrating like working with individual characters in Strings even though it is correct and safe).

If I were to suggest a programming today, JavaScript is something everyone will probably eventually work with. However, for fundamentally changing how you program, Scheme (for functional programming) or Rust (for a modernized take on all the previous systems programming languages) would be my choices with a nod towards Rust for practicality.