This article comes from the programming guide , The author's programming points to the north
Why suddenly want to write about this topic ？
There are a lot of new readers recently , Ask backstage ： University studies Java and C++ Which one is easy to find a job , Is it better to serve the students before or after school , The science Vue still React......
It's as if I saw what I was like , So I think it is necessary to write a separate article , Just talk about it as a computer graduate , I think four years of College , What should computer science students learn , What's the point .
The same four years of College , Why some students can become big factories after graduation Offer harvester , Various SP、SSP To get the soft , Some students have written a lot of websites in school , The project is full of experience , Experience the spring and autumn movement , It's hard to find a job .
We can't say that the latter didn't study hard , Maybe it's in the wrong direction .
Don't talk much , Go straight to the point .
The boundary of human knowledge is constantly expanding , As the saying goes, there is no end to learning , It's also true of computers , The computer itself is an artificial science , It's not a natural science .
Every year, , Even new programming frameworks come out every month , You can't finish learning baldness , There's no need to learn one by one .
And you will find , Most of the things used in the first and second tier factories are basically self-made , Like service discovery 、RPC、KV、DB、 Message queue 、 journal 、 Monitoring, etc. .
Therefore, the recruitment of these large factories will not be hung up because they have not learned a certain framework , Anyway, a lot of things need to be learned again .
They will pay more attention to your basics 、 The experience of problem solving and the more general ability of intelligence .
Instead, it's small companies , You may be required to be able to Spring、Vue、Redis... These frameworks or components .
Some outsourcing JD
Above are Tencent 、 Ali 、 Recruitment of an outsourcing company JD（job description）, obviously , Tencent Ali is interested in solid basic programming skills and fast learning ability , It means there is potential for cultivation .
And outsourcing companies require you to xx database 、Spring And so on . Don't judge which is better , But if you want to go BAT, Is that at least against them JD To improve your ability , It's a shortcut .
ad locum , I have roughly divided the knowledge of computer programming into three parts ：
- Basic knowledge of
- Domain specific knowledge
- Framework and development skills
Basic knowledge is what software engineers in any direction should master , For example, data structure 、 Algorithm 、 operating system .
Specific domain knowledge is the knowledge you need to master when you are engaged in a certain subdivision direction , For example, the game engine needs to master graphics ; Do front-end need to master the principle of browser rendering 、 Three big pieces in the front end ; Algorithm Engineers need more mathematical knowledge .
After all, there are many kinds of computers , We need to select a subdivision direction to study it , Learn everything but know nothing （ Except for the big guy .
One 、 Basic knowledge of
Now the general environment is more impetuous , Few people are willing to spend their time on the basis of , I like to learn directly Python Machine learning 、 Write second kill 、 To be a mall .
When looking for a job, I always want to see my face 、 Quick summary .
But as an excellent computer student, how can you become a programming framework （ Except for framing ）, Entanglement studies SpringBoot still SSH Well ？
Spend time on Algorithms 、 He doesn't smell good in basic subjects ？ To be more utilitarian , The payoff will be even greater .
And in the field of computers , Many basic theories are not very profound , If we work hard, we can master the core knowledge .
First of all , The math is not listed here to be high-end , But I have suffered from math .
If you're a self-taught programmer , I certainly don't recommend math , Because the probability of changing careers is to learn Java、 The front end , There's no need for math .
But this article is mainly for students who are still in University , This part of the students may do algorithms in the future （CV、NLP And so on ）、 The game engine 、 Information security coding, etc
These directions have a high demand for mathematics , In the field of computer , Lineage 、 probability theory 、 Statistics, these branches of mathematics, are relatively important , Computers are essentially discrete .
For example, linear algebra is often used to reduce the data dimension in machine learning or data mining , Many problems can eventually be reduced to solving linear equations .
So in order to avoid getting stuck in mathematics when you want to go in these directions , In my freshman year 、 When I was a sophomore, I would like to have a good study of it .
Book to time side hate less , Don't stop learning because it's useless now , When you need it , I know I regret it .（ Silently shed tears of ignorance ┭┮﹏┭┮
what ？ You said that in the future, I will definitely do the development direction ？
That would really put math first a little bit later , It's really not used much , But when you have a math class, you should listen carefully , It's no harm to get a high GPA . It's not sure that you want to join the army of algorithm involution one day ？
1.2 C Language
You may be wondering , The basic knowledge is clearly stated here , Why list a programming language separately ？
Because it seems to me , There's nothing like C Language is more suitable for understanding computer systems .
The operating system we'll talk about later 、 Architecture These things are perfect for use C Language to understand or practice .
also C Language itself has very few linguistic features , But it's not easy to learn well , A lot of people think C Language is difficult , Where is the difficulty ？ I think about how I felt when I was a freshman ：
- A crude Library of standards , There are few data structures and algorithms available , You have to do everything yourself
- Pointers are hard to understand and use
- Need to know about assembly 、 link 、 load 、 Memory and so on C Use language well
unfortunately , These things are part of the knowledge of computer systems , So use C Language is the most efficient way to learn computer system knowledge .
It's really hard to imagine using Java or Python To explain memory to others , Because these languages are more abstract than C High language , It means the further away from the computer system .
stay TIOBE Programming language ranking ,C Language almost always occupies the top three , There is no doubt about its status .
TIOBE-2020 Ranking List
And almost all of the things you use in your development are C language-written ,Linux、Nginx、Redis、MySQL、Git...... Maybe you want to explore the principle , Read the source code of these open source software , that C Language is also your necessary Swiss Army knife .
Learn more C Language , Be able to understand the underlying execution principle of the computer , It's a great language to understand how programs work , Have no equal .
ad locum , Have to quote to C The most classic summary of language ：
Anything more than C Language, lower language , It's not enough to completely abstract a computer system ; Anything more than C Advanced language , Both can be used. C To achieve .
It's a very high and pertinent assessment ！
So for the computer science class , Whether you're doing the front end or the back end , Algorithm or development ,C Language suggests you study hard . It's a language that has nothing to do with direction , It's the foundation ！
1.3 operating system
We programmed IDE、 All written programs need to run on the operating system , It is not too much to say that the operating system is the cornerstone of computer software .
To run a program, you need to create a process , This involves the process management of the operating system ; To write a program, you need to define variables 、 Store data , It's about memory , Corresponding to memory management ; Sometimes we need to read and write files , It's all about dealing with file systems ; You need to learn to use locks 、 Condition variables, 、 Critical area to ensure that the concurrent execution of the program will not be disordered .
And reading and writing files 、 Memory allocation is inseparable from system calls （System call）.
And when you actually start a project, you'll find that , Many problems are closely related to the operating system , Do not understand the operating system , You can't even analyze the cause of the problem .
For example, some time ago, we showed up in the process based on collaboration (libco) Under the framework of , Using multithreaded locks to do synchronous mutex occasional deadlock , Later analysis found out the reason ：
Because coprocessing is implemented by application layer , Multiple coroutines in a thread are imperceptible to the operating system :
Co process model
So when it's a synergetic A Launch the network after locking IO request , This time it will be switched to another coroutine B, And cooperation B Ask for the lock again .
At this time, the operating system will think that the lock has been locked , So it's going to be a collaborative process B The corresponding thread is suspended to the waiting queue , In this way, it will lead to collaborative process A Never run , You can't release the lock , Lead to a deadlock .
The solution is simple , Is to set the lock to be reentrant , Reentrant means that multiple requests for the same lock by the same thread do not cause a hang . It's like this B When I ask for the lock again , The operating system will think of the coroutine as B The thread already holds the lock , Go straight back to , Carry on .
All in all , We write programs that interact with the operating system all the time , There is no reason not to learn well .
1.4 Compiler principle
The principle of compiling is probably the least we have ever been exposed to , You may feel like you don't have to build a new programming language , What to do with compiler principles .
What's the use of learning compiler principles ？
You will look at these programming languages from a higher perspective , What you see is no longer superficial grammar , I think of the implementation behind the grammar .
This feeling is very thorough , It's like understanding the operating system 、 Architecture you'll see that a program starts with a double-click mouse , How it works , This kind of mastery of all the details , A thorough feeling , It's really amazing , If you don't believe me, try .
Say something reasonable. ！
What can you do with the compiler ？
When you finish Finite state machine in the future , You'll find that you used to think that regular expressions can be used by themselves DFA、NFA It's realized . The idea of state machine can be used in many places in programming .
For example, parse HTTP agreement , If you haven't learned the state machine idea , You may be able to do it line by line if/else To do the analysis , The trouble here is ,if/else It is necessary to advance HTTP All the header fields are received before judging , And we know that HTTP be based on TCP, and TCP It's streaming , So you're likely to receive it in groups of characters , Use this time if/else It's hard to read when you write it out .
And the code written with state machine will be very elegant . State transitions are rule driven , When you receive a character, you judge a character , Very convenient .
Continue to learn grammar analysis , You will master Recursive descent analysis Such a very important thought , You can use recursive descent to quickly implement four arithmetic calculators .
If you don't need recursive descent, you may need to first infix expression to suffix , And then evaluate , This is from our freshman data structure class , It was written in a stack , A little bit of a problem . After learning the principles of compiling , I rewrite it with recursive descent again , Just dozens of lines of code .
There is also a class of scenarios that are used in actual development , For example, Taobao. 、 E-commerce like Jingdong , They have a lot of marketing rules , Such as full reduction 、 Direct reduction 、 Cross shop and so on , Such rules can't be written in code .
How is that done ？
Generally, a configuration system will be implemented , And design a DSL（ Domain specific language ） To express these rules , Configure rules directly into the system , This can be very convenient to modify , So how to parse in the code DSL What about the defined rules ？ This needs to be done for DSL Write a grammar parser , Here we will use the method of syntax analysis .
DSL（Domain Specific Language）, Is a programming language for a specific field . This domain specific is relative to C、C++、Python In terms of this universal language , Common language can be used in various fields , Most of the programming languages we are familiar with are universal languages , They are Turing complete .
As we usually use JSON、SQL、HTML These are all kinds of DSL, You can even try to write one with recursive descent JSON、XML Parser , This is more valuable than writing e-commerce websites .
Go on and you'll learn about the abstract syntax tree AST How to generate 、 How to translate it into intermediate code 、 How to optimize the intermediate code 、 Finally, how to generate machine instructions .
You will see the application of greedy algorithm in register allocation , We will also see how reachability analysis in graph theory can eliminate dead code .
IDE The green compile button above is no longer black magic for you .
Why can I generate executable programs in one click ？
How the English letters you write become binary instructions ？
After learning the principles of compiling , These are not problems , Mom, don't worry about your study anymore ~
Of course, complete a project like GCC、Clang Such a compiler is too difficult , The purpose of learning compiler principles is not to build such a wheel , But to better understand and use programming language .
1.5 Architecture & How it's made up
It's all about software , Architecture is about how computers work , You'll learn how a typical stored program computer works .
I remember a teacher at NTU said “ We don't learn to use computers , It's about learning how to build computers ”, It's a bit of an exaggeration to build a computer , But at least we need to understand how computers work , Find out how code can be CPU It's implemented ？ Otherwise, you will be confused , A bunch of English letters , How the CPU This kind of circuit runs , I learned C Language is a puzzle , Until later I learned the principles of composition and digital logic .
We say everything in a computer is 0、1,0、1 It's also expressed through high and low levels , Through and with 、 or 、 Unequal logic gate circuit to express binary numerical operation , These simple circuits are then integrated together , Formed ALU A processor with computing power .
You'll see how an instruction is CPU Executive ,CPU From memory or Cache Take out instructions from , Place in instruction register , And decode the instruction . Decoding is according to the coding rules of instructions , Splitting instructions into a series of micro operations and operands . And then send out all kinds of equipment control commands , Perform micro operations . This completes the execution of an instruction .
Let's finish learning compiler principles , Be able to understand how written English code is transformed into binary instructions , After learning the operating system, you can understand how binary programs are linked together , How is it loaded by the operating system 、 Executive . The composition principle will tell you how the binary instruction controls CPU Running , Our operating system is essentially a binary program .
When you understand the computer storage hierarchy , Understand the multilevel Cache, You can write faster programs by optimizing the way you access data .
You'll learn about the underlying architecture, right C These languages support stack frames and parameter passing , How parameters are passed to another function ？ How to get the return value of the function .
This is the meaning of learning composition principles for writing code .
What's the point of learning this ？
You'll see how the written code turns into binary instructions , How to control all kinds of gate circuits , Finally, it becomes a colorful program on the screen （ Of course, you may also need to learn the principle of the display ）, This is what we often say “ Basics ” and “ principle ”.
And a lot of ideas in Computer Architecture , It can be widely used in modern software development , such as CPU The multistage of Cache thought , It is the cache technology commonly used to improve concurrency in server development , Including cache replacement strategy and so on .
When computers are no longer black boxes to you , You know every step from writing code to execution , And this will become your core competitiveness in the future , As a graduate, you should not only be able to use Java、Redis、Mysql、Spring To write all kinds of websites .
If some of the readers are on the way to a career or come out of a training class , I hope you can spare time to supplement these basic courses , This will allow you to go further and more steadily along the way of programming .
1.6 Data structure and algorithm
Why put the algorithm at the end , It doesn't matter ？ contrary , It's so important , That's why we let it press the shaft .
If you want to ask me what I regret most in College ？ It must be that I didn't learn algorithms well since I was a freshman , Go fight ACM.
I'm still a freshman 、 I don't take advantage of the second chance , Don't wait until later to regret . Of course , Don't play ACM, We can also learn data structure and algorithm well .
Data structures and algorithms you can see in any computer field , For example, in the compilation principle, the allocation of registers will use greed , Dead code detection and elimination will use the unreachable knowledge in graph theory ; Operating system processes 、 Thread scheduling uses multi-level queues and scheduling algorithms ; In the principle of composition Cache The replacement of will use LRU、FIFO And so on ; The development of the necessary database is also inseparable B+ Trees 、LSM Such as data structure and search algorithm .
Most of the time, the algorithms we need are encapsulated in the basic library of programming language , So many students think the algorithm is too far away from us , It's not .
If you don't learn algorithms , When can I use it Map（ Red black tree implementation ）、 When to use HashMap Do not know .
So the learning algorithm helps us to choose the most appropriate data structure according to the application scenario .
In daily development, algorithms are indispensable , For example, some kind of nesting involved in Xiaobei's recent work TLV（Tag-Length-Value） Analysis of structure coding , You need to use recursion 、 Knowledge such as multi tree . If you don't learn algorithms , So the program can only see a lot of if/else、while/for...
It can be said that an engineer who does not know algorithms is not an excellent engineer .
1.7 Why don't I talk about Jiwang 、 Database etc.
Many people like to put the computer network 、 Database principle these also belong to the computer foundation , I certainly agree with , Because a computer science class student with complete knowledge structure , You should know this knowledge .
But I personally feel that the computer network 、 A database is nothing more than an operating system 、 Compiler principle 、 Application layer software based on the principle of composition .
What is a database ？ Before you have a database, you use files to store data , But it's not easy to find 、 Modify etc. , The database just improves the efficiency of the process .
What does the Internet do ？ Network is to let programs not on the same computer communicate with each other , It's essentially a means of communication between processes .
If you're just developing stand-alone industrial software , It's not even possible to learn from the Internet , It's just that most programmers now work for Internet companies , So regardless of the front and back end , They can't do without and HTTP Waiting for network protocol to deal with .
Reiterated ： It's not network planning 、 The database doesn't matter , It's just that I think they belong to software built on top of the operating system , Not on the list of Basics .
Two 、 Domain knowledge
I can't say too much about it , Because I don't know much about every field . Just a little , Just throw a brick to attract jade .
If you want to go to Tencent 、 NetEase does game engine development , Then graphics must be the knowledge you can't get around , In addition, you have to learn to render pipelines 、 Shaders 、 Physics 、 Light and so on .
If you want to go PingCap Such companies do distributed storage , Then the knowledge of distributed theory must be the key point you can't get around , Include CAP Theorem 、Paxos Algorithm 、Raft Algorithm 、ZAB Protocol, etc .
If you want to write a database , So you need to know about disks 、 The index to achieve 、SQL analysis （ Compiler principle ）、 Business 、 How to use MVCC Solve the conflict between reading and writing and so on , You have to know a lot about programming language , Like locks 、 Semaphore 、 Concurrent programming skills , It has to be said that building a database is a dirty job and a hard work .
Further, you want to do distributed database , You may have to learn about data fragmentation , Query how the task is done , It's focused on , Or push the logic down to the nodes , How to implement distributed transaction and so on .
You said you just want to go to the big factory CRUD？ No problem , Buddy ！
Then you have to be familiar with a compiler language （C/C++、Java、Go）, Understand the underlying principles of language , such as C++ You have to see STL、 Look at the object model , You don't know anything about virtual function tables 、 Smart pointer also wants to go to Tencent to write C++? Java You have to carry your back JVM, What kind of garbage collection algorithm , You don't look at ConcurrentHashMap I mean, you do Java Of ？
We CRUD Is the object of database ？ You have to learn how to use the database well . User pass HTTP To visit us we have to serve , You have to understand HTTP Well ？ By the way, don't look at TCP Three handshakes 、 Wave your hands four times. You mean it's computer science ？
Users put money 、 Let's put the information here , You have to keep your data safe ？ that XSS、SQL Inject 、CSRF These are common Web You have to understand the means of attack ？HTTPS、RSA、 Signature 、 Digital certificate, these security means, must know .
The traffic on November 11 is too big , The boss also told you to stand up , Then you have to know about caching 、 asynchronous 、 Message queue 、NoSQL These tens of millions of QPS It's a must-have killer ？
have a look ！ If you want to do well CRUD It's not that easy .
（ The above paragraph just changes a way to write out the knowledge that the back-end students need to learn , Not Tucao, not make complaints about , It's pure entertainment .
That's a lot , Include VSCode、Jetbrains The whole family can do this IDE, Documentation Markdown、Git And version management tools .SSH Remote login 、 Port forwarding ,Ngrok Intranet penetration and other tools to improve your development efficiency , It's all skills , There's nothing to say about this , It's good to use more study and accumulate more at ordinary times .
I just mentioned a little , Use as soon as possible Linux、 class Unix（Mac） As the main force in developing computers . When I was a sophomore , I just saw Wang ying That article 《 Use it completely Linux Work 》, I bought one directly SSD Put on U Disk shell , Made a startup disk , It was used for nearly a year Ubuntu, Only in the course selection 、 Submit homework, etc IE Only when the browser opens Windows（ I have to make complaints about the old antique website ！）
Yes, of course , I'm not crazy either Linux lovers , I just feel that if I do development , It is necessary to install in various environments 、 Use of the command line , This is the above class Unix The system has a natural advantage , Who knows ！
I didn't realize until I finished , This article is full of pages 「 Basics : Domain knowledge : Skill 」 near 7 : 2 : 1.
This is also the proportion that I recommend that you allocate your study time in college , At least the time to learn basic knowledge is not less than 50%, Of course , After you have learned all these things, you can go to find the direction of interest and study it specially .
Never be a freshman 、 When you come up as a sophomore, you plunge into Java Web、Python Reptiles are things , These can be learned , But not the point .
This article is limited in length , I didn't write about how to learn , What good information is there , I'm going to write this alone with another 《How piece 》, Keep an eye on me ~
So how to test how well you learn ？
You must have heard of this interview question ：“ from URL Input to the page to show exactly what happened ？“
In other words, the problem is 「 How a packet is sent to another computer 」.
If you can tell the whole process completely , So you must have learned ！ That's why interviewers like to ask this question so much .
So let's follow the example of a gourd
“ From the time the code is written down to when the program is running ？”
The more detailed the answer, the better , It's basically clear , You understand the principle of compiling 、 operating system 、 Composition principle these three big three .
This problem is also put here , Summary of the follow-up article , Please continue to pay attention to the programming guide .
alas , If there had been such a close schoolmaster to tell me these , It's not as good as Andorid Development 、Java Web、Python Reptiles play these for half a year ...
But fortunately, I realized the importance of the foundation later , Start learning assembly 、 Relearning C、 To make mini os、 see Linux Kernel implementation principle , Finally, I successfully lost one of my hair ...
Finally, I would like to give you a word that I like very much ：
Ten thousand Zhang tall buildings rise from the ground , Don't build a platform in the sand .