Foreword
Many people like to argue about what programming language is good, and I think this topic is meaningless if it does not limit the scope of application.
Each programming language must have its advantages and disadvantages, which also determines that it has suitable application scenarios and unsuitable application scenarios. In the modern software industry, it is unrealistic to think of a programming language. This status quo has also caused a phenomenon where a programmer often has to master multiple programming languages.
The first question you will face when you study any programming language is: How do you learn this language?
Today we don't talk about what we read, learn, write more, practice more, and so on. Is there anything difficult to do in the world? Without him, the only hand knows.
It is necessary to talk about: how to learn from a shallow programming language? Is there a relatively uniform learning method for learning all programming languages?
Once upon a time, when I was a little novice, I always admired the gods to master multiple programming languages. Later, during many years of programming work and learning, I have been in contact with a lot of programming languages: C, C++, Java, C#, Javascript, shell, and so on.
Every time I learn a new programming language, the degree of mastery is either deep or shallow, but the learning curve is almost similar.
Below, I summarize according to my personal learning experience and learn the basic steps of a programming language.
Steps to learn programming languages
Basic grammar
The first is of course to understand the basic syntax of the language.
Console output, such as C's printf, Java's System.out.println, and so on.
The first line of code for an average programmer is usually outputting "Hello World".
Basic data types
The basic data types of different programming languages ​​are different. The application data space for basic data types is convenient and standardized.
variable
The way variable variables are declared in different programming languages ​​is very different. Some such as Java, C + + need to explicitly specify the variable data type, this is called strong type definition language. Some languages ​​(mainly scripting languages), such as Javascript, Shell, etc., do not need to explicitly specify data types. This is called a weak type definition language.
Another point to note is the scope and life cycle of the variable. The scope and life cycle of different language variables are not necessarily the same. This needs to be understood in the code, and sometimes it will be mine.
Logical control statement
The programming language will have logical control statements, even if it is assembly language.
Master conditional statements, loop statements, break loop statements (break, continue), and select statements. The only difference is that the keywords and syntax are slightly different.
Operator
Master basic operators, such as arithmetic operators, relational operators, logical operators, assignment operators, and so on.
Some languages ​​also provide bit operators and special operators, depending on the circumstances.
Comments (nothing to say)
function
Basically, programming languages ​​have functions. Pay attention to the syntax format: whether to support exporting parameters; what data is supported as an input parameter, some languages ​​allow functions to be passed as arguments (ie callbacks), return values, and how to exit functions (eg Java, C++ return, ).
Arrays, enumerations, collections
Enumeration is only part of the programming language, such as Java, C++, C#.
But arrays and collections (some languages ​​are called containers) have general programming languages, but some programming languages ​​provide a rich set of collections. The method of use is basically similar.
Commonly used
More commonly used classes (of course not called classes in some languages, called objects or something else, this is not important, understand the spirit) please understand its API usage, such as: string, date, mathematical calculations and so on.
Language features
This special character of language features reflects the "unique personality" of each programming language. This involves more points and simply lists some.
Programming mode
The more popular programming modes are:
Object-oriented programming is mainly encapsulation, inheritance, and polymorphism; functional programming is mainly application of Lambda; procedural programming can be understood as a specific step of implementing required functions.
Each programming model has some truth, and I never think that only object-oriented programming is king.
Java is an object-oriented language, starting from Java 8 also supports function programming (introducing Lambda expressions); C + + can be regarded as semi-object-oriented, semi-procedural language.
Language characteristics
Each language has its own important characteristics that need to be understood. For example, to learn C and C++, you must understand the application and release of memory and understand pointers and references.
To learn Java, you need to understand the JVM, garbage collection mechanism. To learn Javascript, you need to understand DOM operations and so on.
Code organization, module loading, library management
A program generally has many source code files. This will introduce these questions: How to organize code files? How to choose to load some modules when they are started, and some modules use lazy loading (or hot load)?
The most basic reference files are not mentioned, such as C, C++'s #include, and Java's import.
Different languages ​​have different solutions for the problems of code organization, module loading, and library management.
For example, Java can use maven and gradle to manage project dependencies and organize code structures; Javascript (including Nodejs, jquery, react, etc. libraries) can use npm and yarn to manage dependencies and use webpack and other tools to manage module loading.
Fault tolerant processing
There is always a bug in the program.
So for the sake of code robustness, in order to facilitate the positioning problem, the code needs to be fault-tolerant. Common means are:
abnormal
assertion
Logs
debugging
unit test
Input and output and file processing
This piece of knowledge is more complicated. It is recommended that you learn the basics and understand basic concepts such as input and output streams, pipes, and so on. As for the API, check it again when it is used.
Callback mechanism
Each language implements callbacks in different ways, such as .Net's delegate (largely used in WinForm programs); functions in JavaScript naturally support callbacks: Javascript functions allow you to pass another function as an input parameter, and then call it in a method . The callbacks of other languages ​​are not listed one by one.
Serialization and deserialization
The first thing to understand is that the purpose of serialization and deserialization is to transfer objects between different platforms.
Second, you need to know that there are many ways to serialize, and different programming languages ​​may have multiple solutions. According to the serialization of the application, selective understanding is sufficient.
Advanced features
The following learning content is advanced content. You can learn and master according to your development needs. It should be noted that the attitude of learning these characteristics should be not learning, learning is dead. Because it is not understandable, it is particularly easy to introduce problems.
For a student with half a bucket of water, I would like to say: Have you let yourself go and let others pass? Is it not good to live?
Concurrency programming: There are many benefits, and it's very important, but concurrent code is error prone and errors are difficult to locate. To learn or to spend a lot of energy, you need to understand a lot of knowledge, such as: processes, threads, synchronization, asynchronous, read-write locks and so on.
Reflection: Allows you to dynamically program (use with caution).
Generic: The cornerstone of a collection (or container). Proficient in generics can greatly increase your code efficiency.
Metadata: Data describing data. Called annotations in Java.
Libraries and frameworks
Learning a programming language will inevitably require the use of libraries and frameworks built around it. The scope of knowledge in this area is too large to learn based on the actual field of application. For example, if you engage in Java Web, you will definitely need to use a lot of development frameworks such as Spring, Mybatis, Hibernate, Shiro, etc. If you do Javascript front end, you may use libraries or frameworks such as React, Vue, Angular, jQuery, etc.
summary
To sum up, the road to programming language learning is long-term and the future is bright.
The last sentence was shared with the king: The road is long and arduous, and I will seek it up and down.
Car Accessories,car audio player,car MP3 player,car FM transmitter
Jiangmen soundrace electronics and technology co.,ltd. , https://www.soundracegroup.com