DEV Community

loading...
Cover image for Try these 4 languages from 4 corners of Programming

Try these 4 languages from 4 corners of Programming

itsjzt profile image Saurabh Sharma ・3 min read

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;
}
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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 ].
Enter fullscreen mode Exit fullscreen mode

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"))
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

cover image credits: Thanks to Ian Schneider for sharing their work on Unsplash

Discussion (40)

Collapse
gwutama profile image
Galuh Utama • Edited

Great recommendations!

I would add one more to the list: prolog.

It’s a logic, fact based programming language that has interesting concepts beyond procedural and functional. Sure, it comes from academia and is still not used outside of it but I recommend people to try it.

Collapse
tanayg2 profile image
Tanay Gandhi • Edited

I had to learn prolog for one of my lower div classes and at the time, I spent hours pulling my hair out over this "useless" programming language. While it's not really used for real world development, I think it's a really good tool to demonstrate something like theoretical computer science topics.

Edit: RegEx and Context free languages are concepts that can be demonstrated pretty well with prolog

Collapse
gklijs profile image
Gerard Klijs

We made a text based adventure using prolog in university. The whole lazy evaluation is neat. For sure different then most languages.

Collapse
gwutama profile image
Galuh Utama

Pretty neat!

While in the uni I made a prolog program to rank texas holdem poker hands.

Collapse
itsjzt profile image
Saurabh Sharma Author • Edited

Lots of recommendations for prolog

Collapse
itsjzt profile image
Saurabh Sharma Author • Edited

Actually prolog was on my list. But since i didnt tried it yet so didnt write about it

Collapse
adrianvoica profile image
Adrian Voica

pro*long* :)))) is this pun intended?

Thread Thread
itsjzt profile image
Collapse
pentacular profile image
pentacular

Yes, constraint satisfaction is often overlooked.

Collapse
eljayadobe profile image
Eljay-Adobe

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++.

Collapse
coreyoconnor profile image
Corey O'Connor

Always wanted to learn F#! Looks nice.

Collapse
eljayadobe profile image
Eljay-Adobe

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.)

Collapse
ajlaston profile image
Adam Laston

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.

Collapse
tbrunz profile image
Ted Brunz

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.

Collapse
sycured profile image
sycured

10 years and Python and finally, back to Haskell (I learned concurrency with Haskell documentation) because 99% of my time, I write Python like functional programming.

I'm looking on Elm but I still look at Swift because we can use it on cli and server-side (Vapor or Perfect or another framework) also on Linux system.

Collapse
itsjzt profile image
Saurabh Sharma Author

If you want a language with strong server side support, compiled and static typed

Try Golang

Collapse
sycured profile image
sycured

I tried because I need to adapt Hashicorp Vault but I still prefer Haskell or Python with functional programming way.

Now, I'm sure that I lost 10 years with object oriented programming… no wayback machine to avoid this lost of time

Collapse
euler2718 profile image
John Corley

I'm most interested in (in no particular order):

Idris
Elixir
Elm
Haskell
Julia
Python
Wolfram Language

Collapse
itsjzt profile image
Saurabh Sharma Author

I have tried elixir and python.

Idris and Elm looks instresting.

Collapse
danielkun profile image
Daniel Albuschat

Thanks Saurabh!
My addition: If you struggle with Haskell and like frontend work, try elm-lang.org/ instead. Much more approachable IMHO.

Collapse
jeikabu profile image
jeikabu

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.

Collapse
itsjzt profile image
Saurabh Sharma Author

Yeah, it is something completely new

Collapse
nerolauda profile image
nerolauda

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

Collapse
tonyketcham profile image
Tony Ketcham

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

Collapse
itsjzt profile image
Saurabh Sharma Author

I also recommed svelte to anyone intrested in web development.

Collapse
ben profile image
Ben Halpern

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.

Collapse
itsjzt profile image
Saurabh Sharma Author • Edited

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.

Collapse
filkerzero profile image
FilkerZero

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.

Collapse
itsjzt profile image
Saurabh Sharma Author

Yeah I agree I left a lot of languages. Maybe I will do a second part

Collapse
code_enzyme profile image
ELEZUA VICTOR

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.

Collapse
itsjzt profile image
Saurabh Sharma Author • Edited

the snippet doesn't show what makes C different.

imo the part of C is its syntax maps directly to assembly

Collapse
gklijs profile image
Gerard Klijs

Really want to learn Smalltalk this year. It seems to pop up a lot as a 'proper' oo language.

Collapse
tbrunz profile image
Ted Brunz

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!

Collapse
gklijs profile image
Gerard Klijs

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.

Collapse
itsjzt profile image
Saurabh Sharma Author

Smalltalk is a new world in its own

Collapse
tbrunz profile image
Ted Brunz

To investigate Smalltalk, check out Pharo. It's the modernized descendant and quite effective as a development environment. My other languages of choice are Lua and LabVIEW.

Collapse
itsjzt profile image
Saurabh Sharma Author

Yeah Pharo is the recommended flavour of smalltalk. I have used pharo in smalltalk's code example

Collapse
lafernando profile image
Anjana Fernando

Ballerina (ballerina.io/) if you do microservices development.

Forem Open with the Forem app