Error message here!

Hide Error message here!

忘记密码?

Error message here!

请输入正确邮箱

Hide Error message here!

密码丢失?请输入您的电子邮件地址。您将收到一个重设密码链接。

Error message here!

返回登录

Close

Computer students | to try to learn to read the source code, it can let you learn a lot!

Archangel Vega 2021-01-14 19:21:58 阅读数:7 评论数:0 点赞数:0 收藏数:0

Why read the source code

A lot of people must have this feeling : Is source code useful at work ? Is it useful ? For a long time, I also had such questions , Those who think there is nothing to do with the source code are just installing , It's just to improve their quality .

Then why should I read the source code ? At first, for the interview , Later, in order to solve the problems at work , And then it's personal preference . To put it mildly, I have the spirit of craftsmanship ; The euphemism is curiosity ( How is the underlying implementation done );

 


 

I'm not confident. I don't know how to use black box , I'm afraid of using it wrong ; The simple point is to improve self-worth , For higher pay ( I'm sorry for the real technophile ).

We can learn a lot from the source code , Learn from other people's efficient code writing 、 Learn from other people's skillful use of design patterns 、 Learn the layout of the whole architecture , wait . If you can still find out the shortcomings , So congratulations , You're going up !

It's important to know how to use it , But it's just as important to know why it's used that way . Learn from imitation , Innovation from imitation .

Reading the source code is not like besieging the city ( People outside want to come in , The people inside want to go out ), It's people outside who don't want to come in , The people inside don't want to go out ; When we step into the city , You'll find that ( It's better to be outside the city , skin !) The scenery of the city is boundless , We can roam in the ocean of source code !

How to read the source code

Content understanding

First of all, we need to understand our goals , I know what her characteristics are , What functions are there . I don't know each other yet , Just want to get into other people's inner world , That's not shameless , We want to be a gentleman with rogue heart ; I have a general understanding of her , You can launch an offensive , Take it with one stroke .

So how to understand , There are many ways , I'm here to offer several , For reference only

The best way is the official reference guide , Biological parents often know their children best , The description of the child is also the most detailed ; such as SpringBootReferenceGuide That's right springboot The most detailed description , How to use springboot、springboot Features, etc , Through this guide ,springboot In front of you ;

however ,springboot After all, it's the children of foreigners , If English is not good , I think it's a bit of a headache to read , But we have google Translation , You can see if you bite your teeth . Mother in law of the source world 、 My father-in-law is very generous !

Then there are books , There are many excellent ones abroad , There are also many good books in China , This method is recommended , Self system , Let's not have too much knowledge . It's like a friend of source code , I know the source code very well , The point is that it's very generous , We will try our best to help us understand the source code .

Again, blogs , Although you may think that the knowledge is scattered , But for a certain point of knowledge is particularly detailed , It's very helpful to have a thorough grasp of , There are many technical talents in the garden , The blog is also very good , Very valuable for learning .

And, of course, the community 、 Forum 、github、 Code cloud, etc . This is the source circle of friends , We can also get a lot of information about the source code .


 

Understanding of design patterns

Excellent framework 、 Technology never lacks design patterns ;jdk Many design patterns are used in the source code , such as IO Adapter mode and decoration mode in stream 、GUI Observer mode of 、 Iterator patterns in collections, etc ;

spring A lot of design patterns are used in the source code . What are the advantages of design patterns 、 What scenarios do they apply to , Not the content of this article , We all need to understand by ourselves .

We just need to have a general understanding of some common design patterns , It's better to read the source code ; There is no need to 23 Read through all the design patterns , There is no need to fully understand common design patterns ; For all read through , We have limited time , And there are some patterns that are really hard to understand 、 Less use , Low cost performance , There's no need to read it all .

Common design patterns : The singleton pattern 、 Factory mode 、 Adapter pattern 、 Decoration mode 、 Appearance mode 、 The proxy pattern 、 Iterator pattern 、 Observer mode 、 Command mode

Design patterns for source code , It's like shopping for women , Want to hook up with the source code smoothly , We need to master the design pattern .

coordination ide Do breakpoint tracing

Our understanding of the source code through the source code circle is only on the surface after all , After all, she didn't walk into her heart , Next, I'll share with you , How I got into her heart !

Then why do you want to break debugging to follow the source code , Instead of directly starting from the source code to talk about what we are concerned about ? Those who have tried should know , If we are not familiar with the source code , Directly follow through the source code ,

On the one hand, it's easy to get lost ( polymorphic , There will be many subclass implementations ), I don't know which one to follow , On the other hand, it's easy to lose , When we follow deeply , It's very likely that you'll forget where you followed .

If you want to be a programmer too , Want to master programming quickly , Pay close attention to Xiaobian and join the learning Penguin circle !

There are senior professional software development engineers , Answer all your doubts online ~ Introduction to programming language “so easy”

The information contains : Introduction to programming 、 Game programming 、 Curriculum design, etc .

Free learning books :


 

Free learning materials :


 

quartz How to operate the database

We follow by stopping the timed task quartz Operation on Database


 

Be clear about our purpose , Find the right entry point , It's easy to go into breakpoint debugging trace .

Whatever I say , You're still indifferent , It's just my wishful thinking , Only the players in the game can understand the secret !

summary

As long as we start to read the source code , Slowly will form their own way to read the source code ; Everyone's way is different , What suits you is the best . action , Capture her in the right way !

 

Copyright statement
In this paper,the author:[Archangel Vega],Reprint please bring the original link, thank you