This is How You Can Learn All Programming Languages, Yes – “all”

“Which programming language should I learn first?”

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

“Which is the best programming language?”

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

In this post, you will get my answers for these questions. But the more important thing I want to share with you is: How to master the skills of learning new language.

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

Learning new programming language should be easy for a skilled programmer. It’s normal for them to write code in new language after a weekend study, or several hours. And good programmer will just pick up any language which task demand, language is a tool.

(Image Credit: tenor.com)

Yes, it’s true, but you need to learn is “how to learn new programming languages”, but not 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 details.

If Programming Languages Were Cars

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

(Image Credit: 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 car stands for different kind of driving experiences.

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

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

Programming languages are designed for the purpose: express your ideas.

Why Are There So Many Programming Languages

Programming language is a tool for expressing, it contains two side:

  1. Express your ideas with other programmers, so other people can understand your code, and maintain code base with you.
  2. Transfer your ideas to computers(by compiler or interpreters), so that they run commands as you will.

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

The main reasons should be:

1. The hardware and computer language theory are evolving, generally speaking, programming languages are designed more easy to use and more expressive powerful.

2. With computer used more widely, more problem domains need involving computers, different programming language are invented for specific different domains.

3. Different Programmers have different kind of thinking style.

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

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

The basics of programming languages

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

  • 1. Data types and data abstraction
  • 2. Control flow and control abstraction
  • 3. Abstractions on low level
  • 4. Supplement and abstraction for specific domain

There are also many common features in programming languages. The true reason why we can master all programming languages is: There are limited number of languages 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 languages designers borrows ideas or features from each other, but with different implementation. So sometimes we may say PL_C is son of PL_A and PL_B, and PL family tree would be like this:

Good understanding of these language concepts will not just help you learn language quicker, it will also help you write better code. For example, functional languages have different coding style and abstraction practices with structural languages, if you didn’t got the point of it, you will write bad code.

Focus on Language Concepts, Not Syntax

(Image Credit: 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’s need 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 redirected to Wikipedia GC page. GC was invented for solve the problem of memory management, it will reduce memory errors in program, write code with GC will be easier since we don’t need handle memory manually. But the cost is performance. When you are using a programming language with GC, pay attention to how GC handle memory for you.

After some practice, you 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 new language. For example, if Ruby is your first OO language, then you have a good chance for you to study the good and bad of OO seriously.

Good understanding of OO will helps very much when you learn another OO language.

Create or Implement a Programming Language

Don’t fear it, interpreter and compilers are just another program, their input is your code, output is run your code or compile your code into byte-code or binary, that is simple, right?

(Image Credit: f.hatena.ne.jp)

Implement a language do 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. 8cc is a compiler for C programming language, if you want to write a compiler, it’s a good reference.

There are also some books for you:

The Steps of Learning a New Language

With the target of “learn all language”, if you follow these steps, it will help your 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?

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

  • Focus on simplicity and productivity, code is easy to read
  • With a interpreter, so you have GC, also means performance maybe a problem for some task.
  • 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 language, including it’s benefits and drawbacks. This will help you much when you start coding in this new language, it’s seems like a road-map for you.

#2 Learn syntax and practices with tutorials or books

In step 2, you need to master the syntax part, basic IO, the debugger tools, the unit test for this new language.

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 languages. 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, you need to start a project with new language, with the knowledge of related ecosystems, tools or libraries. You could start with a simple one, like a guessing number games, like a simple book store or to-do apps. And you can find many similar projects on Github.

#4 Understand more details of language implementation

This is not necessary for every languages. As I said in To Be a Programmer, aspiring programmer will 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.

So, Which One Should I Start First?

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

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

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

2: Do you know want you want to build?

This is also simple, if you want to build Web application, you need to learn Javascript/Python/Ruby, if you want to build games, choose C++, if you want to processing data choose Python/R, if you want to write Android App, choose Java/Kotlin.

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

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

Got it?  Just pick the language mostly used in your chosen domain, don’t spend too much time for choosing the first programming language. Get on the board quickly, after you have more experiences, transfer to another one if you don’t like it or your problem domain changes.

So, Which Language Is The Best?

(Image Credit: turnoff.us)

This also depends on your domain, every language has it’s own pros and cons. There is no such a 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 serious programmer until you have knowledge of 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.

That is my guide for choosing next language.

read original article here