当前位置:网站首页>About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness

About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness

2022-07-06 22:00:00 Alibaba Amoy technology team official website blog

fce8f0246b1135b059720cd0a3a76936.gif

《 The way of craftsmanship and neatness 》 It's uncle Bob's neat new book series . This book mainly focuses on discipline 、 standard 、 Three aspects of ethics describe how software practitioners should demand themselves , Improve R & D quality 、 efficiency 、 Moral standards , This article focuses on 《 The way of craftsmanship and neatness 》 Part three -- integrity , Talk about how our programmers should self-discipline 、 Self improvement .

Why programmers need professional integrity ?

   The strength of the industry Big

This problem also has to start with the development of the software industry . The software industry was born (1935) so far (2022), It has a history of more than 80 years .

b59fba615542216193de297c1d9030a9.png

in the meantime , The whole software industry has made great progress :

  1. The number of employees has exceeded 100 million

  2. Computer / The number of electronic devices exceeds that of human beings

  3. Software monitors and coordinates the operation of the whole society



Public awareness of computers and software , From the early years, it was mainly machine , Up to now, the programmers behind the machine are the main . In the early 《 Star Trek 》、《 Space Odyssey 》 Wait for the machine / Computers play an important role . With the advent of personal computers ,《 The matrix 》、《 War games 》 Wait for the movie to gradually take programmers as saviors , Programmers are lifting the veil of mystery , Be understood and accepted by society .

b404e617b1de2a3457cf4961b65a2ee8.png--->482acc7579d76b16b383040d8e64d01e.png

  The influence area expands



As a programmer , Although we are not the makers of various rules , But we wrote code to run these rules , And in the machine that comprehensively monitors and coordinates our lives . let me put it another way : Programmers rule the world .

The software we write , Record the schedule 、 Transportation of goods 、 Trade in goods , Controlling the steering wheel of the car 、 Rocket satellite , It can even affect the promulgation or enforcement of laws .

The tragedy caused by software errors , There are cases in all walks of life :

  1. scientific research : Ground software error , Wrong unit used , As a result, the Mars Climate probe fell too deep in the Martian atmosphere , Torn to pieces .

  2. Medical care :Therac-25 Accident of radiotherapy machine . Due to process conflict ,Therac-25 Use high-energy electron beams to cause 3 Human life lost , Also burned another 3 people .

  3. business : Because of the wrong identifier , Dead code left in the system is activated , As a result, Knight capital group is 45 Lost... In minutes 4.6 Billion dollars .

  4. traffic : Toyota's stack overflow vulnerability , It may cause the car to accelerate out of control , It may eventually lead to up to 89 People have been killed .

When something happens , Someone will be responsible for this , Programmers will be asked to clarify how to prevent this error from happening again .

therefore , We as programmers , There is an urgent need for clear professional ethics to self-discipline , In order to make the software industry have greater development , Also for our own better career development .



reflection :

Have you ever had trouble , What is the worst impact ? Whether it has affected the society ?



What is professional ethics ?

  Definition of professional ethics

WIKI The definition of professional ethics in is It refers to the lowest moral bottom line and industry norms that people must abide by when engaging in professional activities .



In professional activities , There are some recognized professional ethics , Such as :

  1. The values of honesty

  2. Make work reports honestly

  3. Don't divulge secrets to your competitors



meanwhile , Each industry also has its own breakdown of professional ethics , Such as :

  1. Doctor : Heal the wounded and rescue the dying , I love my job

  2. The magician : Don't disclose the secret of magic

  3. The public security police : Pay attention to investigation and Research , Handle cases without making assumptions , Subjective assumption

  4. Legal workers : Be loyal to the Constitution and the law , Stick to facts

  5. Teachers' : be a model for others , Caring for students

  6. ...



stay 《 The way of craftsmanship and neatness 》 in , Uncle Bob Put forward 10 The professional ethics of software developers .

   Professional ethics of software developers

The following is an excerpt from 《 The way of craftsmanship and neatness 》 :

To defend and maintain the honor of the computer programmer profession , I promise , To the best of my ability and judgment :

I don't write harmful code .

The code I produce will always be my best work . I don't intentionally let code that has behavioral or structural defects accumulate .

I will provide a quick at each release 、 Definitive and repeatable evidence , Prove that every element of the code works .

I will often make small releases , Do not hinder the progress of others .

I will fearlessly 、 Mercilessly use every opportunity to improve my creation . I will never let it change .

I will try my best to improve the productivity of myself and others . I won't do anything to reduce productivity .

I will always make sure that others can fill my place , I can also fill seats for others .

I will give an estimate that is reliable in order of magnitude and accuracy . I will not make an uncertain promise .

If my fellow programmers have enough integrity 、 standard 、 Discipline and skills , Can win my respect . No other attribute or feature will be a factor in my respect for my fellow programmers .

I will never stop learning and improving my skills .



Professional ethics of programmers ?

Uncle Bob proposed this 10 The oath can be divided into three types : damage 、 Integrate 、 The team cooperation , Let's talk about these three types respectively .

   About injury

I don't write harmful code .

The code I produce will always be my best work . I don't intentionally let code that has behavioral or structural defects accumulate .

I will provide a quick at each release 、 Definitive and repeatable evidence , Prove that every element of the code works .

  • What is injury

The software we write has an impact on this society all the time . Any unintentional behavior of us , May bring unexpected harm to this society .

for example People found that programmers at Volkswagen wrote some code , Deliberately obstruct EPA Emission test , Affect the assessment of environmental hazards by relevant departments , It has damaged the health of all people driving these cars .



If we let ourselves , You will treat yourself , Or people around you , Even cause harm to the whole society , Include :

  1. Harm to society

  2. Harm to your colleagues

  3. Harm to future programmers

  4. Function to / Damage caused by structure

  • Face the injury

The harm caused by the above Volkswagen programmers , Who is responsible for this ?

We as programmers , You might say that :" I'm just doing my job , This is not something I can control ."

however , If you know it will bring bad consequences but continue to do so , Then you need to bear part of the responsibility for the consequences . Please don't forget , One of the important reasons for the company to hire you as a software development engineer , You should be able to identify when the software may go wrong , You need to find it before it gets into trouble , And have the responsibility to say it out loud .

Avoid harm , Do my best

reflection : The following two systems , Which system is more valuable ?

  1. The job is perfect , But it can't be modified

  2. Can't do anything right , But it is easy to modify



The above two systems , It embodies the two values of software :

  1. Behavioral value : Let the program work correctly

  2. Structural value : Make the program easy to adjust

If a software system cannot be changed , Even if it works correctly , Finally, I can't get rid of the fate of being eliminated :

deefb5280307c6cbd22d4caff9b3f62e.png



If a software system wants to provide long-term value , It must be able to respond to changes in demand . therefore , Except for the most urgent situation ( in personam 、 Company 、 A situation that causes disaster to society ), We should give priority to the second system . Even if we need a little time and money , But after that , It will continue to work forever .

Stick to the structure , It is related to our interests

In order to enable software to provide long-term value , No, current colleagues 、 Future colleagues cause harm , It requires that the software we write should have a good structure , The value of a good structure is :

  1. Easy to test

  2. Easy to modify

  3. Easy to reuse



Write a good structure , It often takes us more time . We often encounter such scenes :

An urgent need comes , We are required to complete and go online within the specified time , But these times are often only enough for us to complete our needs , At the same time, your boss also requires you to complete this urgent need as soon as possible . If it's you , How to deal with this situation ?



The first thing to remember is : A project / Software success , For our career 、 Reputation has a direct impact , It is closely related to our interests . therefore , As a stakeholder , We have a say in the development and structure of the system ; meanwhile , We are also engineers , The company hires us , Because we know how to build software systems , How to build the structure of these systems , And enable it to provide long-term value , We need to ensure that the system will not be damaged by bad behavior and bad structure .



Look back to this problem , Does our boss know the structure ? Or is the boss's understanding limited to behavior ? If the boss clearly tells you to ignore the structure , Full attention should be paid to behavior , What should we do ?

We have to refuse , Because we are engineers , It's the stakeholders . There may be a fight 、 against , But our profession does not allow us to retreat . Maybe you think you'll be fired if you refuse , But most of the time not . Because most managers also expect to fight for what they need and believe , And they respect those who are willing to do the same thing ( Otherwise, there will be so many technology salons 、 Technology sharing and exchange meeting ?).

  About Integration

I will often make small releases , Do not hinder the progress of others .

I will fearlessly 、 Mercilessly use every opportunity to improve my creation . I will never let it change .

I will try my best to improve the productivity of myself and others . I won't do anything to reduce productivity .



  • Why should we focus on integration

Concurrency in software refers to : Multiple users may read and write the same data at the same time .

Software integration , There is also concurrency . As our projects continue to become complex 、 huge , When more developers participate in this project , Everyone is changing their functional modules at the same time , The problem of software integration conflict will become more and more prominent , It will eventually become a bottleneck .



The long ( Integrate ) Cycles hinder the progress of the team . therefore , We need to focus on integration , Pay attention to its cycle . It's about iteration , It works with editors / compile / The test cycle is related . Only by improving the efficiency of these steps , We won't hinder others' progress 、 Team progress .



  • Continuous integration

After so many years of development in the software industry , There are already many solutions . among , Continuous integration is a good means .

Continuous integration can bring the following benefits :

  1. Find mistakes quickly

  2. Prevent branches from diverging from the trunk

Continuous integration does not allow us to eliminate Bug, But it can make them very easy to find and correct ; It allows our software to iterate quickly at the same time , Still able to maintain high quality , Don't hinder others' progress .

  • Random acts of goodwill

Uncle Bob is 《 Clean code 》 The boy scout regulations mentioned in : Code is cleaner when checked in than when checked out .

If every time the code is checked in , The code is cleaner than when it is checked out , Then the code will not be corrupted . We can check the code every time , Conduct random acts of goodwill to achieve . Any act of goodwill , No matter how small , Will not be wasted .



We can increase the coverage of the test ( But it should not become a management indicator ), To help us improve our code , Help us write more robust code .

Another effective random act of goodwill is simple cleanup -- Refactoring for improvement . We can start with some simple means , Such as :

  1. Optimize the naming of fields , Make code more readable

  2. Clean up useless code , Reduce the cost of understanding

  3. Adjust the code structure , Keep the code flexible

  About The team cooperation

I will always make sure that others can fill my place , I can also fill seats for others .

I will give an estimate that is reliable in order of magnitude and accuracy . I will not make an uncertain promise .

If my fellow programmers have enough integrity 、 standard 、 Discipline and skills , Can win my respect . No other attribute or feature will be a factor in my respect for my fellow programmers .

I will never stop learning and improving my skills .

The above points are mainly about the oath related to teamwork , To sum up, the main points are as follows :

  1. Team spirit , Can be filled , Avoid team paralysis due to knowledge gap

  2. Estimate honestly and reasonably , It's not easy to promise

  3. Only respect professional skills 、 Discipline 、 Standards and ethics , Do not discriminate against each other for other reasons

  4. Never stop learning , Keeping up with changes in the industry is respect for the profession , Is also responsible for their own career

  • Estimate honestly and reasonably , It's not easy to promise

How long does it take to tie a pair of shoelaces ? Maybe you can say it quickly :20 About seconds . Because tying shoes is done almost every day , You can be quite fast 、 Give a reasonable estimate accurately .

If you want to write a tutorial on tying shoes , How long will it take? ? Are you unable to make an estimate quickly and accurately ? You need to consider the audience of this tutorial 、 Whether you need pictures and texts 、 Space limit ……



This is the problem we often encounter as programmers : Estimated hours of work . The users we face may be novices , They may know nothing about software , We have to write software that is simple enough to use , And have enough detailed instructions ……

When a manager comes to you and says :“ I need this before Tuesday .” You are trapped by this problem , Because you don't know whether you can finish it by Tuesday . Maybe you have done something similar , It takes twoorthree days to finish ; Maybe there is a technical difficulty that is different from what you have done before , You don't know whether you can finish it on time .

So when you are asked to estimate something , You can't give a specific time , Because that's a lie , You don't know whether you can finish it at a specific time , You need to consider the best and the worst . If you do give a precise time , It's better to finish it by gritting your teeth . Because you are making a promise , So you'd better finish it on time , Don't have any excuses .



Give a reasonable estimate , You can do that :

  1. Don't give a specific time easily , Be honest

  2. The estimation of the project cannot be just a delivery date , It's a time frame

    Disassemble the work items , Find out the hidden fuzzy factors ( Uncertainties )

    Communicate with the manager , Spend more time refining blur factors , Such recursive operation back and forth

  3. For the best case 、 The worst 、 In general , Estimate the probability of its possible occurrence , For this 3 Estimated date range for each case

  • Never stop learning

Our industry has been in the past few decades , Experienced rapid changes , And this change continues , We have to keep up with . This means that we must continue to learn , Keep reading books 、 Blog 、 Participate in technical exchange meetings, etc . Our employer has no responsibility to train us , We need to be responsible for our own business . Learning is one's own business , We need to figure out what to learn , How much time do you spend learning . therefore , In addition to working hours , Put in every week 10~20 Hours to cultivate and maintain our career , This is to maintain our professionalism .

At the end

“The simplest way to describe craftsmanship is pride of workmanship. It is the mindset that you are working on something important and you are going to do it well."

Programmer is a highly skilled profession , But it must also be bound by non-technical concepts ( Standards and ethics ). Only through the constraints of these standards and ethics , Will make our industry better and better . It binds our behavior , Put forward higher requirements for us , While enhancing our competitiveness , It will also bring us more sense of achievement .



Let's try our best together , Make a 『 Conscience 』 The programmer !

Reference Content

《 The way of craftsmanship and neatness 》  author :Robert C·Martin

team introduction

Welcome to Taobao mobile technology center , Team members Daniel gathered , There are the founders of Alibaba mobile middleware 、 Core members of eagle eye full link tracking platform 、 There is also a group of people who love technology , Small partners who expect to use technology to promote business .

Taobao mobile technology center , Promote Amoy system ( TaoBao 、 Tmall, etc ) Architecture upgrade , Committed to Amoy 、 The whole group provides basic core competence 、 Products and solutions :

  1. Business highly available solutions and core competencies ( Applications are highly available : Provide adaptive current limiting for business 、 Flexible high availability solution for isolation and fusing , The site is highly available : Fault self healing 、 Multi machine room and remote disaster recovery and fast cut-off recovery );

  2. A new generation of business R & D model FaaS( One stop function development Gaia platform );

  3. Next generation network protocol QUIC Implementation and landing ;

  4. Mobile middleware (API gateway MTop、 Domain name scheduling AMDC、 news / push 、 Upload files AUS、 Mobile configuration push Orange wait ).

We look forward to participating in the construction of Amoy basic platform ~ Resume delivery method  :[email protected]

*   Expanding reading

24c398fef1348971048838d8011e85fe.jpeg

84b27e13ad9ff3f9dd7ac06995af0838.jpeg

author | Wu Xinwei ( Storage ang ) 

edit | Orange King

b7f027b6ce9a0d004d403786bc16a1d2.png

原网站

版权声明
本文为[Alibaba Amoy technology team official website blog]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061339203337.html