Someone who has come to teach you how to quickly master all programming languages [Methodology + Dry Goods Summary]

With Java/C/C++/Machine Learning/Algorithms and Data Structures/Front-End/Android/Python/Programmers must-read books list:

Book list navigation page (click on the right side of the Geek Man Zhan to open a personal blog): Geek Man Zhan[Java] The most complete 50+ books on the road to learning from introductory to advanced (collector's edition):[Algorithm data structure + acm] 50+ books for sorting out blood from entry to advanced (collector's edition):[Database] 18 technical books that must be read from entry to advanced.[Web front-end] From HTML to JS to AJAX to HTTP, from framework to full stack, help you take fewer detours (collector's edition):[python] The most complete book has been organized (from entry to advanced) (collector's edition) :



  

[Machine learning] + python finishing technical book (from entry to advanced has been sorted out) (collector's edition):
[C language] Recommended books take you on the road of Daniel from entry to advanced (collector's edition):
[Android] Getting started to advanced recommended books sorting pdf book list sorting (collector's edition):

[Architect] The epic must-read list on the road to vomit blood and organize 80+ books in four dimensions series (collector's edition):

[C++] Hematemesis organizes the recommended book list from entry to advanced 100+ books (collection):

 

Many beginners in programming are still asking, what programming language should I learn and how to learn it. Today, we're not talking about how to master a programming language, but all...

Since I know how to master "all" programming languages, I always feel that the question of which language to learn "one" is relatively low-level, so I haven't had time to reply to them.

But gradually, I discovered that it was not only the novice who had this problem, but even many senior engineers in large companies didn't understand it.

Today, I am motivated and want to answer this long-standing "primary question" in a unified way. A similar topic seems to have been written before, but now I want to write it again. Because after communicating with many people, I have a more precise expression of the thoughts in my head (not translated into words).

If you have any of the following confusions, this article may help you: You are a beginner in programming and don't know which programming language to choose to get started. You're a seasoned programmer or team leader, confused by the new languages ​​that are emerging, and don't know which language to "invest" in. Your team argues over which programming language to use, and there are all kinds of religious battles. You follow a trend and use a fashionable language, only to find yourself stuck in a quagmire after two months... Programmer jobs often require you to be familiar with certain languages, and even some weird companies require you to "understand OOP or FP Design Patterns". For working programmers, programming languages ​​are still a red-faced religious topic. It's so religious that when I criticize and ridicule certain languages ​​(like Go), some people instinctively think I'm a fan of another language (like Java). Obviously I can't be a fan of any language, and for any language I've never seen, I just pick it up and use it without going through the learning process. After reading this article, maybe you will understand why I can achieve this effect. Understanding what's in here, every programmer should be able to do this. Well, I hope so.

Focus on language features, not language

Many people care about whether they or others "know" a certain language. They worship the person who "invented" a certain language, and they fight over the merits of various languages. None of these issues exist for me.

Although I have written articles criticizing many language flaws, in practice I rarely argue with people about them. If there are other people arguing by my side, I even put on headphones and don't bother to listen to what they have to say;

Why? The bottom line is that I value "language features" rather than "language" as a whole. I can write good code in any language, even the worst language.

Any "language" is a combination of various "language features".

For example, a programming language is like a computer. Its brand might be called "Lenovo," or "IBM," or "Dell," or "Apple." So, you can say that Apple must be better than IBM?

You can't, you have to see what type of processor is installed in it, how many cores, how many main frequencies, how many L1 cache, L2 cache..., how much memory and hard disk, how big the display resolution, graphics card What is the GPU, the speed of the network card, and so on various "configurations". Sometimes you also have to look at compatibility between components.

These configurations correspond to the programming language, which is the so-called "language feature".

To give some examples of language features:

Variable Definition Arithmetic Operation for Loop Statement, While Loop Statement Function Definition, Function Call Recursive Static Type System Type Deduction Lambda Function Object Oriented Garbage Collection Pointer Arithmetic Goto Statement

These language features, like when you choose a computer, look at what configuration it has.

When choosing a computer, no one will say that Dell must be the best, they will only say that this model is equipped with Intel's i7 processor, which is better than i5, DDR3 memory is so much faster than DDR2, and SSD is faster than Disks are much faster, ATI's graphics cards are crap... and so on.

The same is true for programming languages. For beginners, there is no need to struggle with which language to learn first and which one to learn later.

Someone once wrote me this question and struggled for weeks without learning a single language. With this tangled time, in fact, he can master all the languages ​​he has struggled with.

Beginners often don't understand that each language must have a set of "universal" features. Such as variables, functions, integer and floating-point arithmetic, and so on. These are must-haves in every general-purpose programming language, and none of them can be missing.

You can apply this knowledge to any other language at any time, as long as you have learned these features in "a language" and grasp the underlying concepts of these features. The time you put into it will hardly be wasted.

So beginners are struggling with "which language to learn first". This kind of time is not worth it. It is better to pick a language and jump into it.

If you can't write good code with the basic features in one language, it won't help you to switch to another language. You will write just as bad code.

I often see people who write pretty messy, pretty bad Java code, call it bad, and are ambitious to switch to Go.

These people don't understand that it's up to people, not languages, to write good code. If you don't have a clear and simple mental model in your mind, you will be a mess in any language. If your Java code is bad, then your Go code will be just as bad, if not worse.

Many beginners do not understand that if a clever programmer starts to use a new programming language, he often does not read the tome manual or book of the language, but has a problem that needs to be solved first.

With a problem at hand, he can browse the manual for the language in two minutes to see what the language looks like.

Then, he directly picked up a piece of example code and started to modify it, thinking of changing the code to the problem he was trying to solve. In this brief process, he quickly mastered the language and used it to express his thoughts.

Along the way, as needs arise, he may ask questions like:

What is the syntax of "variable definition" in this language, does it need to "declare the type", or can I use "type deduction"? What is the syntax for its "type"? Does it support "generics"? How to express the "variance" of generics ? What is the syntax of "function" in this language, what is the syntax of "function call", and can "default parameters" be used?  …

Noticed? The content inside each quotation mark above is a language feature (or concept).

These concepts can exist in any language, and although the syntax may be different, their essence is the same. For example, in some languages ​​the parameter type is written before the variable, some after the variable, some with a colon in between, and some without.

These practical problems are naturally brought out as the actual code is written and the problem at hand is solved, instead of reading the language manual carefully at the beginning.

Because people who have mastered language features know that the features they need must have corresponding expressions in any language. If there is no direct way to express it, then there must be some kind of "bypass".

If there is a direct way to express it, it's just a slightly different syntax. So, he is looking for features with problems, like looking up a dictionary, rather than being submerged in a tome manual, sleepy for a month before starting to write code.

After mastering the general language features, only some language "specific" features are left.

Anyone who studies languages ​​knows that it is very difficult to design new, good, innocuous features. So generally speaking, a good language will never have more than one or two new features unique to it.

If a language claims to have more than 5 new features, then you have to be careful, because they may not bring advantages, but disasters!

In the same way, the best language researchers are often not the designers of a language, but the designers (or proponents) of some key language features.

for example

The famous computer scientist Dijkstra is a strong proponent of "recursion". There is recursion in modern languages, but you may not know that recursion is not supported in early programming languages.

This didn't change until Dijkstra urged the Algol 60 committee to add support for recursion. Tony Hoare is also a language feature designer.

He designed several important language features without designing any language. In addition, don't forget that there is a language expert named Wang Yin. He is the supporter and implementer of the early union type, as well as the supporter of the checked exception feature. In his blog post, he pointed out the difference between the checked exception and the union type. relation.

Many people blindly worship language designers. As long as they hear that someone has designed (or "invented") a language, their blood will boil and they will fall in admiration.

They didn't understand that, in fact, all programming languages ​​are just "assemblers" like Dell and Lenovo. The designer of language features is the creator of core technologies like Intel, AMD, ARM, and Qualcomm.

Reasonable introductory language

So if beginners want to do more with less, they should start from a "reasonable" language with no obvious serious problems, master the most critical language features, and then apply these concepts to other languages. What are reasonable starter languages?

I personally think these languages ​​can be used to get started:

Scheme C Java Python JavaScript

So in contrast, which languages ​​would I not recommend getting started with?

Shell PowerShell AWK Perl PHP Basic Go

In general, you shouldn't use so-called "scripting languages" as entry languages, especially those that originated from early Unix systems.

PowerShell is an improvement over Unix Shell, but it still doesn't get rid of the fundamental problem with scripting languages ​​- their designers don't know what they're doing.

Using scripting language to learn programming, a very serious problem is that learners can't grasp the key.

Scripting languages ​​often add some system tools (such as regular expressions, Web concepts) to the grammar, causing beginners to waste too much time for them without understanding the most critical concepts of programming: variables, functions, recursion, types ...

Go is not recommended for similar reasons. Although Go is not a scripting language, its designers obviously don't understand what they are doing. So to learn programming in Go, you can't focus on the most critical, best language features.

Master key language features, ignore minor ones

In order to achieve the cohesiveness I mentioned earlier, beginners should focus on the most critical features of the language, rather than being distracted by lesser ones.

Take an exaggerated example

I found that many programming training courses and the introductory programming courses of Yeji University often teach students how to use printf to print "Hello World!", and then ask them to memorize the meaning of various "format characters" of printf, and ask them to implement various Printouts of complex formats, even require printing to a text file, and then read it out...

But as everyone knows, such input and output operations are not part of the language at all, and are secondary to mastering the core concepts of programming.

Some people's Java classes are going on for weeks and they're still assigning various printf assignments. Students write hundreds of lines of printf without understanding what variables and functions are, or even how to use arithmetic and looping statements!

This is why many beginners find programming difficult, I can't even remember the meaning of %d, %f, %.2f, how can I learn programming!

However, the title of "professor" of these pheasant universities is so brainwashed that the students they have taught come to me to ask for advice, and they actually scold me for teaching some useless things, and they can't even complete the homework of printf.

Don't tell me about for loops, functions, etc... Can I wait a few months and learn how to use printf after memorizing them?

So you find that once taught by a bad teacher, the programmer is basically ruined. Even if they meet a good teacher, it is difficult for them to correct it.

Of course this is an exaggerated example, since printf is not a language feature at all, but this example illustrates the problem of secondary, superficial language features in the same way.

Here are some examples of minor language features:

In a statement block in C language, if there is only one statement in it, curly braces can be omitted. If the function parameter types of the Go language are the same, they can be combined and written together, such as func foo(s string, x, y, z int, c bool) { ... }. Perl uses regular expressions as a special syntax of the language. JavaScript statements can sometimes omit the semicolon at the end of the sentence. currying in languages ​​like Haskell and ML.

Do-it-yourself language features

After you have basically learned various language features and can use them to write code, the next step is to implement them.

Only by implementing various language features can you fully own them and become their master. Otherwise you're just a user of them, and you'll be led by the designers of the language.

A master said it well, the best way to fully understand a language is to implement it yourself, that is, to write an interpreter to implement its semantics.

But I think this sentence should be slightly modified: the best way to fully understand a "language feature" is to implement it yourself.

Note that I changed "language" to "language feature" here. You don't need to implement the entire language to achieve this, because we end up using language features. As long as you have implemented a language feature yourself, you can understand how that feature is implemented and used in any language.

for example

When learning SICP, everyone will use Scheme to implement an object-oriented system.

Object-oriented systems implemented in Scheme are far from the syntax of languages ​​like Java, C++, Python, etc., but it can help you understand the concept of "object-oriented" in any of these OOP languages. It can even help you understand Differences in various object-oriented implementations.

This effect is something you cannot get by directly learning OOP languages, because when learning languages ​​such as Java, C++, and Python, you are just a user, but after implementing the OO system yourself with Scheme, you become a creator .

Similar features include type deduction, type checking, lazy evaluation, and so on. I have implemented almost all language features, so any language in front of me is a toy that can be disassembled and assembled at will, and is no longer a sacred place above me.

Summarize

Having written so much, the important words are repeated three times: language features, language features, language features! Whether you are a beginner or a senior programmer, you should focus on language features, not the entire "language brand". The only way to achieve mastery, pick up any language and use it almost immediately, and write high-quality code.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324133864&siteId=291194637