当前位置:网站首页>90% of programmers don't use too many threads and locks. How can they become architects?

90% of programmers don't use too many threads and locks. How can they become architects?

2020-12-07 10:56:21 Little brother Fu


author : Little brother Fu
Blog :https://bugstack.cn
Github:https://github.com/fuzhengwei/CodeGuide/wiki

precipitation 、 Share 、 grow up , Let yourself and others have something to gain !

One 、 Preface

Do you only work and study ?

If programming is simply to undertake product requirements and develop system functions , So basically, program development can be simply understood as according to requirements PRD, Defining attributes Create method Call show , These three steps .

Especially in some big companies , It will be easy to use 、 Perfect 、 Standard architecture and operation and maintenance services , for example :RPC、MQ、Redis colony 、 Distributed tasks 、 Configuration center 、 Sub database sub table component 、 Gateway and other system architecture . Therefore Let programmers only care about business function development

Let programmers only care about business development , There is a mature system architecture 、 There is a standard development process 、 There is a general functional design , It's a great thing for team effectiveness . But some programmers just because of this Good deed , Let day after day do the same thing , Finally become a tool man .

If it's the existence of frameworks and middleware , Yes, let programmers only care about business development . So why are you asked about the design and principles of the core components in your interview ? In this era , Don't give up learning is almost the only way to survive .

Two 、 Multithreading and locking have never been used ?

Interview must ask Multithreading lock , It may even be a deep question , such as :AQS、CAS、CLH、MCS、 Lock escalation 、 Head and so on . But in actual business development , Did you use it ? Maybe this is what most students say , Interview the place where the rocket was made !

Some business scenarios are developed in Internet applications , It's really rare to use multithreading , You don't have to lock it . Even if you can use multithreading, you can handle it in a better way , It's like you need multiple threads to drop data into the database , Then you can use asynchronous MQ The way , Spread the pressure on each application . And the evolution of this way of development , Because the current application development and deployment are based on the idea of distributed , So it's rare to have to use threads to squeeze a single instance CPU.

Based on RPC+MQ+ Database routing + gateway , And various matching components , Distributed applications built out of , In some cases, it has changed our development model . Maybe it turns out that we need to use multithreading in a single instance , After using the distributed architecture , We need to change this idea , Therefore, the use of multithreading and locking will be reduced at any time .

chart 14-1 Distributed simplified application deployment

 chart  14-1  Distributed simplified application deployment

but , It's not that there is no business scenario without multithreading and locking , For example, in our core components , Database connection pool 、 In distributed tasks , Both involve multithreading and the use of locks . There are also some scenes similar to the second killing of commodities , You also need to use locks .

that , Use multithreading to maximize the use of resources and improve efficiency , Locking is to ensure the correctness of the business process in the case of competition for the same resource . It's like : Database connection pool is used to allocate database resources reasonably 、 The second kill of goods is for the competition of inventory .

But , Without the need to compete and allocate resources , Generally, multithreading is not used in distributed scenarios . Suppose we do a single count of user resources , So the original application is a single instance or can lock the cumulative count . But now it's distributed application deployment , That is, you may be at this moment A Examples provide your needs , When you refresh the page again, what you may visit is B example . At this time, I want to accumulate some examples , It's not that convenient .

This is also in the application of distributed application framework , There are not many reasons why you can use multithreading and locking . But if you need to understand the design of some middleware or core components , You need to know the relevant core knowledge .

A lot of paper technology , That is, you make wheels 、 Building rockets 、 The foundation of being an architect ! If you want to run this way, you can go further , You need to keep learning .

3、 ... and 、 Your growth goals ?

 chart  14-2  Your growth stage

As far as programming is concerned , The goal of each growth stage will have its along with the difficult to conquer difficult .

  • School stage , To the strange knowledge that came suddenly , Want to run it on your own computer , It's hard .
  • Work 1~3 year , What I used to master was fur , Next, there needs to be deep learning , And after going deep into it, they will have a hard encounter with mathematics .
  • Work 3~5 year , It's not so hard to look at the theoretical knowledge before , But how to actually solve some complex projects , Or focus on the brainstem .
  • Work 5~7 year , Salary and position will become the bottleneck which is very difficult to break through at this stage , The accumulation is insufficient 、 Not enough precipitation , Dissatisfaction with the status quo !
  • Work 7~10 year , I used to find it hard to learn anything , Now it may be difficult for you to have free time . It's not necessarily age , That's where it comes in .

With age , Every stage has difficulties that are difficult to cross . And those seem to break through the bottleneck , People who have reached the height you want . In fact, every stage , They're all running ahead .

But in terms of pure technological growth , In fact, theoretical knowledge is not difficult , As long as you learn, you can still , It's just that the time cost is different . But after passing the theoretical knowledge level , The next thing to face is creativity , That's why you feel like you know so much about technology , But in actual development, I always feel that I can't write good code .

Know the core technology, but can't write good code , It's like : He knows Chinese characters but can't write poems and poems Understand color, but can't draw mountains and rivers Can jump, but can't dance swaying posture .

therefore , More practical project code , Look at more design patterns , It will give you a better understanding of how the code should be used , It can also improve and break through the current stage barrier . It's recommended for brother Fu 《 Relearning Java Design patterns 》, official account :bugstack Wormhole stack , reply : Design patterns , download .

Four 、 How to grow into an architect ?

 chart  14-3  Architect knowledge system

When it comes to architects , It's really hard, because you can become an architect after signing up for a course . The growth of an architect depends more on whether your R & D team needs an architect , At the same time, you need to play a proper role in this position .

If you're not an architect yet , But want to be an architect . It also depends on whether your boss is willing to train you as an architect , And whether you have many abilities . in addition , Advanced development is not necessarily inferior to the architect . Advanced development is sometimes more specific than what architects do 、 More central .

Well, except for the picture 14-3 For the architect's competency profile , What are the specific matters ?

  1. The standard has been set 、 The architecture is designed .
  2. There is a certain depth and breadth of Technology , It's changed bug、 Deal with the accident .
  3. With the team to promote the project landing , Can also cooperate with other groups .
  4. Understand operations and business planning , Get involved in the product development stage in advance .
  5. Understand business and operations , Understand the data indicators and the items ROI.
  6. Architecture is more of a combination of experience and experience , Instead of a single channel of single content .
  7. It's not that there is no architecture without architects , Sometimes it's a company or a group that doesn't undertake that big project , Use the molding architecture pattern .
  8. But if you have a very complex scene design , It's all about the development of more than ten systems in groups , Provide services , Support tens of thousands of seconds , Hundreds of thousands of days , Expanding to millions DAU, We need architects to control it .
  9. Another example : Order from 、 To deal 、 To pay 、 To settle accounts 、 To the event 、 To play 、 How to support . The complexity of this volume requires architectural tradeoffs .
  10. There is no absolute right or absolute wrong , It's just when it's better . Learn more , Don't set boundaries for yourself , It's better to break through !

Structure well , From a distance, it's the efficiency of the Department , A closer look is to solve bad code ! It's a lot of time , It could ruin the whole project . More and more rotten , It will eventually affect business development . So how did all this bad code come from ?

  1. bug Most of the time, it is the bad code that has been taken over or the ideas of others have not been inherited .
  2. Business requirements are written from the beginning without scalability , There's a lot of accumulation behind it .
  3. There's no good structure and nomenclature 、 And never format .
  4. We don't expect the future of business , There is no way to design a reasonable extensible system .
  5. Flaunt technology is greater than overall planning and Design , The introduction of a new skill , But there's a lack of matching .
  6. There is no design , The functions are all flow type , Write whatever you need ifelse.
  7. Always think of a shuttle , Irrespective , There are complaints in my heart , The Department is eager for quick success , Don't give you a long time of bedding , No one brought , Can't write good things .
  8. There is no corresponding process specification and review in the group , Design review 、 Code review , There is no benchmarking project to refer to .
  9. How many jdk Source code is never a good code, just basic skills . Like an old carpenter with an axe , The new carpenter used a chainsaw , But the things that come out of it , It's good to have some , Some are not good .
  10. There is no always good code , If it's better like code , It needs to be maintained all the time , Always reinventing .
  11. There is no corresponding volume of business , Not to mention QPS、TPS、TP99、TP999, Service health , A lot of empty talk is playing rogue .

bad , From many aspects , And it's not something you can learn by signing up for a course . Business 、 product 、 Research and development , The three parties work together to better reduce the occurrence of rotten , And these are the directions that every R & D should strive for , It's almost the only way to become an architect .

5、 ... and 、 summary

  • I wrote so much, mainly to help those who like me continue to struggle on this road , Maybe everyone is confused at these stages : How to learn technology at school 、 How to write a resume when looking for a job 、 How to grow at work and so on . So a lot of times, it's more about self-restraint and choice !
  • 2020 It's been 12 month , There's the beginning of the epidemic 、 There is also a year of mask belt 、 Some people get rich in stocks 、 There are also people who can't pay their mortgage 、 Some people are impatient and aimless 、 Some people have learned a lot . What's the matter , Time soon !
  • You use the sword 、 I use a knife 、 They all have goals 、 It's very windy ! Continue refueling !

6、 ... and 、 Series recommendation

版权声明
本文为[Little brother Fu]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207105535800r.html

随机推荐