DEV Community

Cover image for How to learn all programming languages, YES! ALL!
Nic
Nic

Posted on • Edited on • Originally published at coderscat.com

How to learn all programming languages, YES! ALL!

origin post: https://www.coderscat.com/how-to-learn-all-pl

“Which programming language should I start with?”

Many beginners will ask this question when they start to learn to code.

“Which is the best programming language?”

Developers will come with this question after they have got actually development experiences.

The questions about programming language probably will raise endless argument and you will never get a final answer.

Instead, the more important thing I want to share is How to master the skills of learning a new language.

Learning new programming should be easy for skilled programmers. It’s normal for them to write code in a new programming language after a weekend study, or even several hours. The more skilled programmer just have a glance at the manual, and learn the language by finishing the related tasks.

umm-really.gif

Figure 1: Source: tenor.com

Master the skills of learning “all languages” does not need talent, it needs the core knowledge of programming language and practices.

Of course, we do not need to learn all kinds of languages but learn more programming languages will help us choose appropriate language for any given task.

If Programming Languages Were Cars …

There are thousands of programming languages in the world, only about 20 of them are widely used in the IT industry.

If we dig up a little bit, we will discover the truth that all languages share a few features.

from Quora

Figure 2: Source https://www.slideshare.net/cyber_jso/ocaml-13036522

Let take car for example, there are different cars in the world. Some cars are compact and powerful, some are slow and bulky, Different brand of cars stand for different kind of driving experiences.

If someone knows how to drive one car, he will know how to drive most other cars, even the new car is a different brand.

Why? Because different cars share many common things, they are fundamentally built with engines and tires. They were designed for the same purpose: driving you to the target.

Programming languages are designed for the purpose: express programmer's ideas.CLICK TO TWEET

Why Are There So Many Programming Languages

In computing world, programming languages are serving two roles:

  1. Give command to machines, tell them what we need and get what we want.
  2. Convey ideas to other programmers, share our experience and vision.

So code is “message” for programmers, and also for the machine. This involves the trade-off in programming language design and implementation.

2019_09_25_learn-pl.org_20191115_180723.png

Figure 3: https://www.youtube.com/watch?v=Pn5znSOGHcs

The main reasons should be:

  1. The hardware and computing theory is evolving. Generally speaking, programming languages are designed more easy to use and more expressive power.
  2. Computers are applied into many domains and corresponding languages may be invented.
  3. Different Programmers have various design methodology and phyilosphy

Languages have different kinds of syntax or features, but essentially they are the same in a formal mathematical end, they are all Turing complete. This means in plain words: all languages can be used to implement arbitrary algorithms.

The Basics Of Programming Languages

2019_09_25_learn-pl.org_20190928_152434.png

Figure 4: the-basics-of-programming-languages

Almost every programming language contains these categories of elements, they are all about “abstraction” actually:

Data types and data abstraction
Control flow and control abstraction
Abstractions on low level
Supplement and abstraction for the specific domain

The reason why we can master all programming languages is: The language concepts are limited., let’s say less than 15 which commonly used.

Procedural

Recursive

Static type

Dynamic type

Type inference

Lambda function

Object oriented

Garbage collection

Pointer

Continuation

Meta programming

Macro

Exception

And language concepts tend to be constant, like design principles.

Programming language designers borrow ideas or concepts from each other, maybe with a different implementation. So sometimes we may say PL_C is the son of PL_A and PL_B, and PL family tree would be like this:

2019_09_25_learn-pl.org_20190928_153540.png

Understanding of these concepts will not just help us learn a language quicker, also helps alot to write better code. For example, functional languages have different coding styles and paradigms with OOP languages, if you didn’t understand the differences between them, bad smell of code will be unavoided.

Focus On Language Concepts, Not Syntax

https://twitter.com/slidenerdtech/status/637622001633505280

Figure 6: source: twitter @slidenerdtech

So we want to learn language concepts, but how to?

We should fully understand the questions, why the concept is invented and what is the problem is it solved, what is it benefits and drawbacks and sometimes how is it implemented.

Let’s take GC for example, the first question should be, what’s GC?

A quick search on Google, we will redirect to the Wikipedia GC page. GC was invented to solve the problem of memory management, it will reduce memory errors in a program, writing code with GC will be easier since we don’t need to manage memory manually.

The cost is performance, since there will be extra code to allocate and free memory. When you are using a programming language with GC, pay attention to how GC affect your performance.

After some practices, we need to know how GC works, what algorithms are used? There are many kinds of GC implementations, with its own pros and cons.

It’s a good opportunity for you to learn new language concepts when you learn a new language.

For instance, if Ruby is your first OO language, then it is a good chance for studying the pros and cons of OO seriously. A good understanding of OO will help a lot when you learn another OO language.

Create Or Implement A Programming Language

Don’t be afraid, interpreter and compilers are just another programs, their input is your code, it’s output is running your code or compiling code into byte-code or binary, that is simple, right?

http://f.hatena.ne.jp/t-sin/20160429103306

Figure 7: source: f.hatena.ne.jp

Implementing a language does not need too much work if your language’s syntax is not complicated. Have a look at this project: Make a Lisp, any language can be used to implement a Lisp. Lisp/Scheme has a clean syntax, which is easy to parse and widely adopted for programming language education.

8cc is a compiler for C programming language, it’s a good reference if you want to write a compiler.

There are also some books about programming languages:

The Steps Of Learning A New Language

With the target of “learn all languages”, if you follow these steps, it will help you learn efficiently:

**#1 Understand this language’s design philosophy and general language features**

For example, if you begin to learn Ruby, let’s find what’s special for Ruby?

2019_09_25_learn-pl.org_20190929_120327.png

Figure 8: source: www.ruby-lang.org

Hmmm, let’s dig deeper: http://www.ruby-lang.org/en/about/

Summarize the main points you need to understand begin you start to learn it:

  • Focus on simplicity and productivity, code is easy to read
  • With an interpreter, so you have GC, which also means performance may be a problem for some tasks.
  • Everything is an Object, Ok, a language with OOP, and even “pure OOP”.
  • Flexibility, Great! we can redefine many parts of the language.

Knowing the most important features of the language, including its benefits and drawbacks. This will help you much when you start coding in this new language, it seems like a road-map for you.

**#2 Learn syntax and practices with tutorials or books**

You need to master the basic syntax of a language, basic IO, the debugger tools, the unit test tools, etc.

If you are a starter, find the definitive books, like the book written by language creators, or just search on Amazon with language names, find the books with good comments.

If you are a language guru, just find some simple guides for this language or even some sample code in this language. Take a look at learnxinyminutes.com.

Remember you need to write code with your hand when you learn syntax, don’t just copy code. Practice the new language with exercism.io, there are mentors to review your code, give you suggestions for free, it’s wonderful.

**#3 Read and write more code with the new language**

Ok, it’s time to start a project with the new language, with the knowledge of related ecosystems, tools or libraries. You could start with a simple one, like a game of guessing the number, like a simple book store or to-do apps. There will be many similar projects on Github.

#4 Understand more details of language implementation

This is not necessary for every language. As I said in To Be a Programmer, an aspiring programmer will be interested in the details and implementation of their languages. And sometimes, bug even comes out because we don’t have good knowledge of language implementation.

2019_09_25_learn-pl.org_20190929_190334.png

So, Which One Should I Start First?

Ok, finally we need to answer this question. It depends on many factors, the simple guide is:

1: Do you have a mentor in a specific language, or do you need to learn a specific language in class?

That’s simple if the teacher told you it needs to learn C for exercises. OK, C is your first programming language, because you have a mentor(your teacher) and classmate, it’s more easy to getting started with this help.

2: What is your goal ?

This is also simple, if you want to build Web application, it’s OK to learn Javascript/Python/Ruby, if you want to build games, suitable choose is C++, if your goal is processing data, good choose is Python/R, if you want to create an Android App, Java/Kotlin is your choice.

Just pick the language mostly used in your chosen domain. Ask the experienced developers.

3: Do you want to apply for a job that requires a specific language?

Emm, you should just follow the Job Description, learn it now.

Don’t spend too much time choosing the first programming language. Get on the board quickly, after you have more experiences, it is not hard to transfer to another one if you don’t like it or your problem domain changes.

So, Which Language Is The Best?

http://turnoff.us/geek/java-family-crisis/

Figure 10: source: turnoff.us

This also depends on your domain, every language has its pro and con. There is no such language suitable for every task. If it exists, we just need to learn this one, right? Remember No Silver Bullet.

For personal taste, my favorite languages include C/Ruby/Lua/OCaml, I am productive with them. It’s maybe not your taste, you should try different language and find the favorite of yours.

Someone said don’t consider yourself a serious programmer until you know at least 5 programming languages.

K.lee Wikimedia

Figure 11: K.lee Wikimedia

As I elaborated above, you should not focus on learning more and more languages, you should try to learn more language concepts and design principles.

If you are using a procedural programming language in daily work, why not learn a object oriented one, if you are using a language with dynamic types, why not learn a new one with static types.

That is my tips for choosing the next programming language.

Top comments (5)

Collapse
 
azeem2793 profile image
Agha Azeem

Good article!

Collapse
 
elmuerte profile image
Michiel Hendriks

Maybe for some things, but in programming practice just makes less terrible.
The best programmers are just less terrible at writing software. But we are still quite bad at it.
You should always ignore all claims that of programming languages concerning productivity increase, elegance, or other subjective topics.
Every solution we have introduced so far has resulted in other problems, often new one problems we have not observed before.
Take for example automatic garbage collection. It did not solve memory leaks. It did make memory handling easier and thereby people lazier resulting in memory leaks. It also introduced "stop the world" application pauses when the GC became active. A lot of effort has been put into solving this problem, and for various runtimes (E.g. Java) this has been mostly solved.
A similar thing with OOP, It solved some issues and introduced a bunch of new problems. AOP tried to solve some of them, and again introduced new problems.

Collapse
 
snj profile image
Nic • Edited

Agreed, we should try to find suitable language for tasks.

Collapse
 
rifaimartin profile image
Rifai Martin

Thanks

Some comments may only be visible to logged-in visitors. Sign in to view all comments.