Many people like to argue about what programming language is good, and I think this topic is meaningless if it doesn't limit the scope of application. Each programming language must have its advantages and disadvantages, which also determines the appropriate application scenarios and unsuitable scenarios.
In the modern software industry, it is unrealistic to think of a programming language fit all. This situation also creates a phenomenon in which a programmer often has to master multiple programming languages.
The first question you will face when learning any programming language is: How do you learn the language?
I don't want to say a lot of reading, learning, writing, practicing and the like nonsense. Is there anything difficult in the world? Without him, only hand-cooked. Who doesn't know the truth of practice makes perfect?
I think it is necessary to talk about: How to learn a programming language from the very first-class? Is there a relatively unified learning method for all programming languages?
Once upon a time, when I was a small rookie, I always admire the great gods master many programming languages. Later, in the years of programming work and learning, I continued to have been exposed to many programming languages: C, C + +, Java, C #, Javascript, Shell and so on. Each time you learn a new programming language, mastery is either deep or shallow, but the curve of learning is much the same.
Below, I summarize according to individual learning experience, learn the basic steps of programming language.
I. Steps to learn a programming language
Second, basic grammar
First of all, of course, the most basic syntax for understanding language.
Console output, such as C's Printf,java System.out.println.
The general programmer's first line of code is generally output "HelloWorld" bar.
III. Basic data types
Different programming languages have different basic data types. The basic data type is the application memory space becomes convenient and normalized.
Iv. variables
There are very different ways of declaring variables in different programming languages. Some such as Java, C + + need to explicitly specify the variable data type, which is called strong type definition language. Some languages (mainly scripting languages), such as JavaScript, Shell, and so on, do not need to explicitly specify the data type, which is called the type definition language.
It is also important to note that the scope and life cycle of variables are scoped. The scope and life cycle of different language variables are not necessarily the same, this need to be carefully understood in the code, and sometimes buried thunder.
V. Logical CONTROL statements
The programming language will have logical control statements, even assembly language.
Master conditional statements, loop statements, interrupt loop statements (break, continue), select statements. The general difference is that only the keywords and syntax formats are slightly different.
Vi. operators
Master basic operators such as arithmetic operators, relational operators, logical operators, assignment operators, and so on.
Some languages also provide bitwise operators, special operators, depending on the plot.
Note (Nothing to say)
Seven, function
Programming languages basically have functions. Note The syntax format: whether the parameter is supported, what data is supported as input, some languages allow the function to be passed as a parameter to another parameter (that is, callback), return value, how to exit the function (such as Java, C + + return,).
Eight, arrays, enumerations, collections
Enumerations are available only in some programming languages, such as Java, C + +, C #.
But arrays and collections (some are called containers) are available in general programming languages, except that some programming languages provide a richer set of collections. The use method is basically similar.
Nine, Common class
Compare commonly used classes (of course, some languages do not call classes, objects or anything else, this is not important, understanding the spirit) please understand its API usage, such as: string, date, mathematical calculations and so on.
X. Language characteristics
Language features This special word reflects the individual programming language itself "unique personality", which involves more points, simple list some.
Xi. Programming Mode
The more popular programming patterns are:
Object-oriented programming, mainly encapsulation, inheritance, polymorphism, functional programming, mainly the application of lambda, procedural programming, can be understood as the implementation of the requirements of the specific steps of the function.
Each programming model has a certain truth, I never think that only object-oriented programming is the kingly way.
Java is an object-oriented language that supports functional programming (introducing lambda expressions) starting with Java8, and C + + can be regarded as semi-object-oriented and semi-procedural language.
12. Characteristics of language itself
Each language itself has some important features that need to be understood. For example, to learn C, C + +, you must understand the application and release of memory, understanding pointers, references. While learning Java, you need to understand the JVM, garbage collection mechanism. To learn JavaScript, you need to understand DOM manipulation and so on.
13, code organization, module loading, library management
A program generally has a lot of source code files. This introduces these questions: how do you organize your code files? How do you choose to load some modules on startup, depending on your business needs, and some modules use lazy loading (or hot load)?
The most basic reference file will not mention, such as C, C + + #include,java import and so on.
Different languages have different solutions for the problems of code organization, module loading, and library management.
Such as Java can use MAVEN, Gradle management project dependencies, organization code structure, Javascript (including Nodejs, jquery, react and so on) can use NPM, yarn management dependencies, with tools such as Webpack Management module loading.
14, fault-tolerant processing
There will always be bugs in the program.
So in order to code robustness, in order to facilitate the positioning of the problem, the code needs to have fault-tolerant processing. The common means are:
Abnormal
Assertion
Log
Debugging
Unit Test
XV, input and output and file processing
This piece of knowledge is rather complicated. It is recommended to learn sketchy and understand basic concepts such as input and output streams, pipelines, and so on. As for the API, use the time to check again.
16. Callback mechanism
Each language implements callbacks differently, such as. NET's delegate (which is used for WinForm programs); JavaScript functions Naturally support callbacks: JavaScript functions allow incoming functions to be passed in as arguments, and then call it in a method. The callback methods in other languages are not listed.
17, serialization and deserialization
First, it is important to understand that serialization and deserialization are intended to transfer objects between different platforms.
Second, there may be multiple scenarios for different programming languages to know that there are many ways to serialize. Depending on how the application is serialized, selective understanding can be done.
18. Advanced Characteristics
The following learning content belongs to the advanced content. Can be based on the development needs to learn, master. It is important to note that the attitude of learning these traits should be not learning, and learning is dead. Because half understand and half do not understand, especially easy to introduce problems.
For half a bucket of water classmate, I want to say: let yourself, also let others, live not good?
Concurrent programming: A lot of benefits, very important, but the concurrency code error prone, and error difficult to locate. To learn or to spend a lot of effort, need to know a great deal of knowledge, such as: process, Thread, synchronization, asynchronous, read-write locks and so on.
Reflection: Allows you to dynamically program (with caution).
Generics: The cornerstone of a collection (or container). Being proficient in generics can greatly improve your code efficiency.
Metadata: Data that describes the data. In Java, it is called annotations.
19. Libraries and frameworks
Learning a programming language inevitably requires a technology ecosystem built around it-libraries and frameworks. The scope of knowledge in this area is too large, according to the actual application field to learn it. For example, Javaweb, you are certain to use the spring, Mybatis, Hibernate, Shiro and many other development frameworks, if you do JavaScript front-end, you may use react, Vue, Angular, jquery and other libraries or frameworks.
Summary
Summing up the above, the path of programming language learning is a long way, the future is bright.
The last words and June mutual encouragement: Road long XI Its repair far, I will go up and down and quest.
How to learn programming language well?