How to learn all programming languages, yes “all”.

How to learn all programming languages, yes "all". 1

Last Updated on

master skills to learn all programming languages

 

“Which programming language should I learn first?”

Many beginners will come with this common question when they start to learn to code.

“Which is the best programming language?”

Many developers will ask this question after they have learned some languages.

In this post, I will not answer these questions directly. Instead, the more important thing I want to share with you is: How to master the skills of learning a new language.

I will not just give you a fish, but teach you to fish.

Learning new programming should be easy for skilled programmers. It’s normal for them to write code in a new 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.

learn programming language is not hard

source: tenor.com

Yes, it’s true, but you need to learn is “how to learn new programming languages”, but not a specific programming language. Master the skills of learning “all languages” does not need talent, it needs the core knowledge of PL and practices.

Let me explain this in detail.

If Programming languages were cars

Remember programming languages are tools, they are invented by programmers. There are thousands of programming languages in the world, only about 20 of them are widely used in the IT industry. If we think a little bit more, we will find out these languages share many common basics.

if programming languages ware cars

source http://crashworks.org

Let take car for example, there are many brands of car 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 brands of 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

A programming language is a tool for expressing, it contains two sides:

  • Express ideas with other programmers, so other people can understand our code, and maintain code base with us.
  • Transfer our ideas to computers(by compiler or interpreters), so that machine runs instructions as designed steps.

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

the history of programming languages

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. With the computer used more widely, more problem domains need involving computers, different programming languages are invented for specific different domains.
  3. Different Programmers have different kinds of thinking styles.

Languages have many 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.

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.

The basics of programming languages

2019_09_25_learn-pl.org_20190928_152434.png

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

There are also many common concepts/paradigms in programming languages(the term “paradigm” is a little bit different, it’s more about engineering practice). The reason why we can master all programming languages is: There is a limited number of language concepts, 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, but 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

A good understanding of these language concepts will not just help us learn a language quicker, it will also help us write better code. For example, functional languages have different coding styles and paradigms with structural languages, if you didn’t get the differences between them, you will write bad code.

Focus on language concepts, not syntax

programming languages jokes

source: twitter @slidenerdtech

So we want to learn language concepts, but how to? My suggestion is to understand the problem solved by this concept or feature, it’s benefits and drawbacks, sometimes it needs to know how it’s 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, write code with GC will be easier since we don’t need to handle memory manually. But the cost is performance. When you are using a programming language with GC, pay attention to how GC handles memory for you.

After some practices, we need to know how GC works, what algorithms used? There are also many kinds of GC, and it is still evolving.

It’s a good opportunity for you to learn new language concepts when you learn a new language. For example, if Ruby is your first OO language, then it is a good chance for studying the pro and cons of OO seriously. A good understanding of OO will help very much when you learn another OO language.

Create or implement a programming language

Don’t be fear, 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?

make a Lisp with programming is good way for learning

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 very clean syntax, which is easy to parse and commonly adopted for programming language education.

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

There are also some very good books about programming languages:

The steps of learning a new language

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

#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

Hmmm, let’s have a more check: 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: Do you know your goal for learning programming?

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.

Got it?  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?

how to choose programming languages

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 very 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. As I elaborated above, you should not focus on learning more and more languages, you should try to learn more language concepts or design principles. If you are using a structural language in work, why not try to learn a functional language, if you are using a language with dynamic types, why not try to learn a language with static types.

K.lee Wikimedia

That is my guide for choosing the next language.