Login With Github

How To Master All Programming Languages

Well, what I want to talk about here is not how to master a single programming language, but all languages.

Many beginners are still writing to me to ask me for which programming language to learn and how to learn languages. At first I always felt that the questions were so low level. But gradually, I discovered that not only beginners but also many senior engineers of well-known technology companies actually couldn't figure out the problem.

Today I will pay time to respond to this "low-level" problem which has been on hold for a long time. I also hope to share my ideas with more developers.

If you have the following kinds of confusion, this article may help you:

  • You are a beginner and do not know what language to choose for getting started.
  • You are a senior programmer or team leader who is confused about emerging languages ​​and do not know which language to invest in.
  • Your team is arguing over which language to use.There are even unnecessary conflicts happened in your team.
  • You adopted some fashionable programming languages. Then you found you were suffering in the trap two months later.

Personally, for any language I haven't seen before, I use it directly without learning for a long time. After reading this article, maybe you will understand why I can do this. Knowing the language features, every programmer should be able to achieve this goal like me. Well, at least I hope so.

Language Features, Not The Language Itself

Many developers care much about whether they or someone else proficients in some languages, and often they make endless arguments about the pros and cons of different languages. However, none of these problems exist for me. Although I have written articles criticizing the flaws of many languages , I rarely argue about them in practical work. The most fundamental reason I found was that I valued language features rather than language itself. I can write good code in any language, even a bad one.

Any language is a combination of various language features. For example, a programming language is like a computer. Its brand may be "IBM" or "Dell" or "Apple." So, can you say that Apple must be better than IBM? No, you can't. You must first understand the configuration of this computer, such as the model of the processor, the number of cores, CPU Clock Speed, L1 cache,L2 cache..., the memory and the hard disk, the display resolution, the graphics card, the network card, and so on. Sometimes you have to know the compatibility of each hardware.

Relative to programming languages, these computer configurations are referred to as language features. Here are some examples of language features:

  • variable definition
  • arithmetic operation
  • for loop statement, while loop statement
  • function definition, function call
  • recursion
  • static type system
  • type Inference
  • lambda
  • object oriented
  • garbage collection
  • pointer arithmetic
  • goto statement

Language features are similar to computer configurations. When choosing a computer, no one would say that Dell must be the best, but they would say that the CPU of this computer is an Intel i7 processor, which is better than i5, the DDR3 memory is much faster than DDR2, the read-write speed of SSD Disk is much faster than regular disks, and the graphics card performance of ATI is poor...and so on.

The same is true of programming languages. There must be a set of universal features in each language, such as variables, functions, conditional statements, and loop statements. As long as you learn them in one language and master the basic concepts, you can apply this knowledge to any other language at any time. Therefor, it is better to grasp the features of any language instead of wasting time in choosing languages.

When a clever programmer begins to embrace a new programming language, he or she often does not spend a lot of time reading the manuals or books of the language, but directly uses this language to solve a practical problem. For example, I have a problem of performing some complex calculations of R language. First I will take a few minutes to look through the R Language Manual to learn about some of the features of the language. Then, I will find a R program which is related to the problem from the network, and modify it until it solves my problem. During the problem-solving process, you will master the language soon.

Choose a Proper Introductory Language

For beginners, you should choose a proper programming language with no obvious flaws. You should master the language features first,and then apply these language features to other languages. Which are the proper introductory languages? I personally think that the languages below ​​can be used to get started:

  • Scheme
  • C
  • Java
  • Python
  • JavaScript

In contrast, Here are the languages I do not recommend using:

  • Shell
  • PowerShell
  • AWK
  • Perl
  • PHP
  • Basic
  • Go

In general, you should not use the so-called scripting language as an introductory language, especially those that originated from earlier Unix systems. Although PowerShell has improved over the Unix shell, it still doesn't get rid of the fundamental problem of scripting languages - their designers don't know what they are doing.

It's a very serious problem that learners can't grasp the key points when using scripting languages ​​to learn programming. Scripting languages ​​often add the knowledge of some system tools (e.g. Regular Expressions, Web) to the syntax, which will make beginners not only waste too much time, but also actually do not understand the most crucial concepts of programming: variables, functions, recursion, types, etc. .

Master Key Features, Ignoring Minor Features

Beginners should focus on the most critical features of a programming language and not be distracted by the minor content. I have found that students are often taught to use the "printf" function to print "Hello World!" and asked to remember many complex formatted outputs of the "printf" function, such as %d, %F, %. 2f, in many programming courses at the very first.

However, as everyone knows, the input and output operations are not really the main part of a language. Compared to the core features, this is secondary. Some beginners are still annoyed with the "printf" function, though they have been learning Java for several weeks. They wrote a few hundred lines of the "printf" function, but they didn't understand what variables and functions were, and they even didn't know how to use arithmetic statements and loop statements! One of the biggest reasons why many beginners feel that programming is so difficult is that they think that since they can't remember the meaning of %d, %f, %.2f, learning deeper must be an impossible thing!

Implement Language Features Yourself

After learning basic language features and using them to write code, the next step is to implement them. Only if you have implemented different language features yourself can you master them completely.

A programming guru once said that the best way to fully understand a programming language is to implement it yourself, which means that you'd better write an interpreter to implement its semantics. But I think this sentence could be slightly modified here: The best way to fully understand one feature of a language is to implement it yourself. You don't need to implement the entire language because we end up using language features. As long as you have implemented one feature of a language yourself, you will understand how this feature is implemented and used in any language.

For example, when learning SICP, many of you may choose to use Scheme to implement an object-oriented system. The Scheme syntax of the object-oriented system is very different from other languages, such as Java, C++, Python, and so on.  However, it can help you understand the concept of object-oriented in any of these OOP languages. It can even help you to understand the differences among various object-oriented implementations.

You won't achieve this from learning OOP language directly , because when you are learning languages ​​like Java, C++, Python, you are just a user, and after using Scheme to implement OO system by yourself, you become a creator.

Summarize

No matter being a beginner or a senior programmer, you should always focus on language features rather than on which language to use. Only then can you quickly master a new language and write high-quality code.

1 Comment

temp

For beginners, learning language features is indeed a very effective method. I think the syntax of a programming language is not difficult, and most people can grasp it through books and tutorials in a short time. But only after long-term project practice can you improve your ability to solve problems (except for a few geniuses).