当前位置:网站首页>Are these old system codes written by pigs?

Are these old system codes written by pigs?

2022-06-25 06:36:00 Little sister taste

c15333ceac83054ffbd11cf5f03fb2b1.gif

original : Taste of little sister ( WeChat official account ID:xjjdog), Welcome to share , The official account is reproduced. .

Xiao Wang has joined a new company , This company is a little old , So even Shishan is fermented , It tastes very strong .

Like most unlucky programmers , In this company , Most of the work done , Is to repair these shit mountains , Add bricks and tiles to it to create a bigger Shishan . Every time I am exhausted by tossing , I can't help the turbid air in my nostrils :“ The people who designed this system , It's really rubbish ”!

Of course , The people who designed this system , May have left long ago , It could also be your immediate boss . If you are lucky enough to get a gentle - tempered elder , He will tell you with great regret :“ The system is really riddled with holes , If only we had designed it in the right way ”!

feab0d30893c1ad2af8b68435503675a.gif

No programmer has ever regretted , It's like people who lose money regret buying stocks , People who grow up regret coming to this world .

Many people see bad code , That's all in hindsight . At the moment the code runs ,“ Can run ” That's what matters . Rotten code can enter the warehouse and be put into production , It must be caused by the lack of some links .

Bad code has its own background .

Rush for construction period

There are countless managers , Want to quantify the work of programmers , And out of that came KPI、OKR Such a tool . At some time , It may be useful , But this way of working, measured by deadlines , It will cause a large accumulation of technical debt .

Under the pressure of construction period , Few people can think about the rationality of the demand , And subsequent extensibility . Bad code before Review Under the circumstances , Lack of refactoring 、 Limited testing , They rushed to the online operation . Some designs , It can be said that it is unreasonable from the source , However, due to the need for rapid implementation , The plan has to be compromised .

Most of the time , Code that lives and dies doesn't cause much problems . But there are always some projects , Very long life cycle , There is still a lot of need for repair . Build a building in a place where the foundation is unstable , There will always be a day of collapse .

But whatever it is , As long as it's not in your own hands .

Hand training program

I even found a very interesting phenomenon . Many departments want to train new people , Some very important modules and functions , Let new people do it .

Due to lack of experience , The newcomers have many defects in the scheme design . But in terms of time cost , It is not much different from the old bird . A lot of hands-on projects , Inadvertently, it will grow into a big mac , Then the defects left by it will be magnified .

Contrary to what most people think , The newcomers are in the technical scheme , Will adopt more new technologies and exotic skills , The old bird is good at using the most basic and simple tools to complete the design . This may be a kind of utilitarianism that wants to put what we have learned into practice and vanity that pursues fashion .

Unfortunately , The code that pursues skill , There will be many conventions and specifications in it , If the project is not under unified control , Such conventions and specifications will be contrary to other conventions and specifications in the project , The code style is not uniform , Debugging difficulty , Can't expand .

Self starting stove

Many programmers are very confident , Think of yourself as english Level and coding level are particularly high , In the code, the Dragon flies and the Phoenix dances , Self starting stove .

They don't care about the conventions and norms of the entire technology community , Name the interface , foreign API I put too much effort into my work , We usually call these people brother wheel who imitates others .

such as /health Interface , I don't call health, My name is /server_status.

Another example is the error code , I must have one called success_200, A place called fail_500. The subsequent entry correction Emperor sees such an error code , Scoff but dare not change , So he made his own set 200 and 500.

Such agreement and Amendment Agreement , Will accumulate more and more under the erosion of years , So that no one knows what it is .

therefore , If you see a project with very bad code , Don't rush to revise , Be sure to follow its rotten logic . believe me , It must be more secure than your correction .

copy emperor

In many companies , You go to see their products and codes , There will be a sense of deja vu .

you 're right , They copied it .

In the absence of product design and funding , The boss gave the ultimate order .

“ According to xxx Give me a copy One , Don't let go of a button ”.

copy One and design one are two concepts ,copy It usually means simple thinking , It is much worse than the mold in terms of details and functions .

What's worse , The mold is changing . If you're not lucky , A team just copy There is a product , The next day, I opened other people's products , good heavens , They have all changed their editions .

Si Xiang and UN designed code come from this .

Of course copy Emperor also means cv The engineer , But their destructive power is limited , The initial intention is also good , It can't cause much damage .

What do I do ?

regret , At least it's good .

This is relative to people who never regret . Regret shows that he knows what is right , It is only in some special circumstances that such consequences have been caused .

If the same reincarnation is given to people who have regret experience , He will think more about the time and personnel allocation of the project . The man who never regrets may be a stubborn donkey , Or maybe he really thinks he is right , This is a very sad thing .

If you are unlucky enough to maintain these shit mountains , Remember to do what you can , Don't venture in , And don't over correct . Unless your team gives real time and people , To really shovel this shit .

These codes , Of course it wasn't written by a pig , It's just putting people in a pigsty .

Author's brief introduction : Taste of little sister  (xjjdog), An official account that does not allow programmers to take turns. . Focus on infrastructure and Linux. Ten year structure , 10 billion traffic per day , Discuss the world of high concurrency with you , Give you a different taste . My personal wechat xjjdog0, Welcome to add friends , Further communication .

Recommended reading :

1. Get along well with Linux
2. What's the taste

3.  Bluetooth like a dream
4.  Kill a machine !
5.  The lost architect , Just leave a script
6.  The architect wrote BUG, Extraordinary
7.  Some programmers , The essence is a flock of sheep !

原网站

版权声明
本文为[Little sister taste]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250413348964.html

随机推荐