There are thousands of programming languages, all having features unique than others. There are some more readable, others more performant, some are simple, others are complex. Here I'm presenting you 4 different programming languages from 4 different sides of programming. I invite you to try each of them, enjoy their strengths, find their weaknesses. Each one of them is very different than the others. They each are better for some kinds of problems. They will teach you the same problem in different ways.
1. C
While working on the Unix operating system at Bells Lab, Dennis Ritchie wanted a language that will suit the task of writing parts of the Operating System. He wrote C language taking inspiration from BCPL and B.
A lot of C's syntax maps directly to machine code. C has the power of assembly but unlike assembly, it is cross-platform, If you wrote your code with portability in mind then it can work on multiple OSes and CPU architecture without much code changes.
When you want to talk directly to the machine, removing all the abstractions in between you and the machine, then C is the language for that kind of tasks.
Here is some C code
int square (int number) {
return number * number;
}
and here it the assembly code generated by the compiler
square(int):
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], edi
mov eax, DWORD PTR [rbp-4]
imul eax, eax
pop rbp
ret
2. Smalltalk
When I made up the term object-oriented, and I can tell you I did not have C++ in mind.
-- Alan Kay
Smalltalk was created to teach kids programming. Creator Alan Kay had revolutionary ideas about how programming should be done. He pioneered the idea of individual units communicating through message passing. He believed that languages should be built around a generalized concept. Smalltalk and Object Oriented Programming revolutionized the world of programming but certainly not a good way, the world misunderstood the whole idea of Object Oriented Programming. Classes became the epic center of Object Oriented Programming.
here is some smalltalk code:
"Return the weekday of a date"
'2013/5/7' asDate dayOfWeekName
"Save the HTML source of a web page to a file"
'http://www.pharo.org' asUrl saveContentsToFile: 'page.html'
"Count the number of, or show the leap years between two years"
(1914 to: 1945) count: [ :each | Year isLeapYear: each ].
(1895 to: 1915) select: [ :each | Year isLeapYear: each ].
If you already know ruby, smalltalk will not take a lot of time to grasp, but its live debugger is something from another world.
3. Lisp
“Lisp is a programmable programming language.”
— John Foderaro, CACM, September 1991
If you are looking for a language in functional programming world, there is a good chance you will hear about lisp. Lisp is a minimalist kind of programming language. Its has virtually no syntax. Lisp is one of those languages which is enlightening. Currently the most popular lisp variant is Clojure.
Lisp is programmable. which means if you don't like any constructs of of the language, you can override it with what works better for your team. Imagine if javascript was lisp we could fix a lot of its bad parts.
here is some clojure code:
;; define a var
(def a 42)
;; => #'user/a
;; call a function named `+`
(+ a 8)
;; => 50
;; call a function named `even?`
(even? a)
;; => true
;; define a function that returns the remainder of `n` when divided by 10
(defn foo [n] (rem n 10))
;; => #'user/foo
;; call the function
(foo a)
;; => 2
;; if else
(str "2 is " (if (even? 2) "even" "odd"))
4. Haskell
Haskell is the language grown out of mathematics world, It is a statically typed (perhaps the best kind of static typing), functional programming language. Unlike most mainstream static typed languages it has strong type inference so you don't have to write types everywhere but you still get type safety.
If you are writing in statically typed language, you should try Haskell, it has very strong type inference. You can see the below code which has type safety but I didn't wrote any types.
Haskell has pattern matching, recursion, list comprehension, first class functions and all the other cool stuff of functional programming languages.
-- Using recursion (with the "if then else" expression)
factorial n = if n < 2
then 1
else n * factorial (n - 1)
cover image credits: Thanks to Ian Schneider for sharing their work on Unsplash
Top comments (39)
My favorite programmings languages are:
F# for functional programming.
Lua for an embedded scripting language.
Python (3.x) for general purpose scripting language. Also my recommendation for the best programming language to learn as your first programming language.
D as a "better C++ than C++" language.
My "on the horizon" languages I'm keen on are:
Elm as a web language.
Rust as a potentially "the next mainstream language".
Swift as the language for Apple platforms.
The language I use day-in and day-out is C++.
lua was the first language i ever tried and i was obsessed with it since i was 11 but was always overwhelmed with it. I learned JS and perhaps I will revisit it.
Look for luawinmulti on GitHub. It will instruct you to install mingw, then guide you in installing Lua. It supports 5.1, 5.2, and 5.3. You'll end up with a Lua environment that runs out of a standard Windows command shell.
Always wanted to learn F#! Looks nice.
The Book of F# by Dave Fancher is a great introduction and tutorial to F#. I've read many F# books, and that was the only book that I'd recommend. (I just started reading Expert F# by Don Syme this weekend, I'm on chapter 1, so I cannot recommend nor criticize.)
I'm most interested in (in no particular order):
Idris
Elixir
Elm
Haskell
Julia
Python
Wolfram Language
I have tried elixir and python.
Idris and Elm looks instresting.
Thanks Saurabh!
My addition: If you struggle with Haskell and like frontend work, try elm-lang.org/ instead. Much more approachable IMHO.
For something completely different, try an RTL hardware design language like VHDL or Verilog. Always parallel, all the time. Changes the way you think about "programming" and I think should be mandatory for any budding developer.
Yeah, it is something completely new
Java, C#, Scala, Go. My 4 favourites. Honestly I use many more and I think every GPPL is fun and you need to understand which one is the best for your goal.
When I studied OpenGL I spent more time to experiment with different programming languages than effectively learning OpenGL
Looking through the discussion —
As far as reactive web development goes, Svelte is a great tool to try if Elm is too radical of a paradigm shift from the Javascript, HTML, and CSS realm.
Definitely recommend it as an alternative to React, Angular, or Vue if you’re interested in learning any of those
I also recommed svelte to anyone intrested in web development.
I have been programming in C since 1981, though for the first 10 years or so I thought in pdp-11 assembly language while doing so.
I learned lisp in college, wrote a small lisp interpreter with the primitives in pdp-11 FORTRAN-IV and assembly and the rest in lisp in college. Have not used it much since then.
Wrote a smalltalk interpreter in C some time in the 1980s or 1990s. Switched to much better open source implementations later.
Haven't tried Haskell yet.
You missed SNOBOL, TCL, and FORTH. All of these are very different than the usual fare.
Yeah I agree I left a lot of languages. Maybe I will do a second part
Most people, myself included, probably won't find the time to literally follow the advice in the post. I think you gain some context just from reading this.
...But if your take away is that you will take this and literally make a small program in each one of these languages, you'd probably level up as a programmer that very day.
Actually picking new languages isnt that hard. 4 - 5 hours is enough to get the basics,
then you can solve project euler problems for practice.
I tried to understand smalltalk but I didn't. C syntax looks easy here, the snippet doesn't show what makes C different. Closure? It's just different from normal programming languages, I was happy when I wrote fizzbuzz with it. As for Haskell, it looks interesting.
imo the part of C is its syntax maps directly to assembly
Really want to learn Smalltalk this year. It seems to pop up a lot as a 'proper' oo language.
It's got a few things that make it intriguing: a pure object-oriented environment (literally everything is an object), OOP implemented as "message passing" (Alan Kay's vision), and an IDE with integrated tools, refactoring, debugging, and search (it's very reflective/introspective). Download Pharo Launcher & try it! It's a lot of fun to program with!
I actually wanted to give the squeak implementation a try. They also have a GraalVM support, which opens up a lot of possibilities.
Bit if there are good reasons to prefer Pharo I love to hear them.
Smalltalk is a new world in its own