Playing with language documentation to get an overview of similarities and differences
16 Sep 2019
I am on holiday for a week, so thought it would be fun using the time off to go down a bunch of research rabbit holes that I have been putting off in favour of 'more important' things over the last few months.
This is also probably why it's easier to learn each new language, because you won't be starting completely from scratch anymore. You'll will already have a baseline of concepts that you don't have to expend mental energy on learning, you can jump right to the things that you don't understand. Oh this is a lightbulb moment for me. Start with the basics, then when you know those solidly, make the next pass through and dive a little deeper. Cool.
The languages I'm going to quickly read about will include some languages I have exposure to, and some languages I have not touched before. Will list my reasons for picking the ones I have chosen below, just for transparency.
- Ruby: also familiar with this one, same reason.
- Pharo: started learning this one because it is a pure object-oriented language, it forces you to write pure OO, so thought it would help me understand OO better. Including because a birdseye view would be helpful.
- Kotlin: currently playing with this language, so on the list by default.
- Java: some experience with this one, interested in getting some idea of how it differs from Kotlin, as they are similar to each other.
- Elixir: at work there was an off-hand conversation about this being an events-based language, so interested in learning more about it.
- Haskell: have heard that this is a purely functional language. I tend to be interested in languages that are paradigm specific to help me learn new perspectives.
- MySQL: curious about potential crossovers in concepts even though this is a database specific language.
- C++: because I am interested in programming arduinos. Not planning on diving deep into this one any time soon but it's on the radar.
- Bash: I always use the command line so learning more about this is sensible.
I'm going to start with master list of concepts for one language. Then when I start the documentation for the next language will create two lists, one for comman concepts and one for distinct concepts and so on until all of the 10 documentation sources listed above have been covered.
I'm expecting many of my assumptions below to be wrong, this is a surface level exploratory exercise.
Upate: I decided against merging them into similar and different concept lists. It's more interesting to keep the lists seperate.
- No distinction between types of objects.
- Inheritance is through the prototype mechanism, and properties and methods can be added to any object dynamically.
- Variable data types are not declared (dynamic typing, loosely typed).
- Cannot automatically write to hard disk.
- Grammer and types: variables and data structures
- Control flow
- Error handling
- Loops and iteration
- Expressions and operators
- Numbers and Dates
- Text formatting
- Indexed collections
- Keyed collections
- Iterators and generators
- Meta programming
Ruby is "an interpreted scripting language for quick and easy object-oriented programming".
- ability to make operating system calls directly
- powerful string operations and regular expressions
- variable declarations are unnecessary
- variables are not typed
- memory management is automatic
- everything is an object
- classes, methods, inheritance
- singleton methods
- "mixin" functionality by module
- iterators and closures
- threading support
- Regular expressions
- Control structures
- Object-oriented thinking
- Methods, classes, inheritance
- access control
- procedure objects
- Exception processing
- Object initialisation
Java is a general-purpose programming language that is class-based, object-oriented (although not a pure object-oriented language, as it contains primitive types.
- Objects are divided into classes and instances with all inheritance through the class hierarchy.
- Classes and instances cannot have properties or methods added dynamically.
- Variable data types must be declared (static typing, strongly typed).
- Can automatically write to hard disk.
- Expressions, statements and blocks
- Control flow statements
- Interfaces and inheritance
- Numbers and strings
Pharo: an Immersive Object-Oriented System based on Smalltalk.
- Message based programming
- Sequence and cascade
- Booleans and Conditions
- Packages, tags and groups
- Hooks and templates
This is something to come back to, pretty tired after doing this for four languages. Also much harder to identify similarities and consistencies as all of the documentation styles are wildly different from one another.