The following characters are made up. If there are coincidences, they are purely similar.
Once upon a time, there was a programmer named A Xing, who worked in a small company for 2 or 3 years. After fighting for many rounds of technical interviews, he finally succeeded in joining Banana Company, which is a famous technology factory. The department that A Xing joined was a mid-taiwan team responsible for the company’s payment business.
Chare period
In the first few months of Banana company, A Xing mainly did some scattered small requirements, and had no chance to get started on the development of some core systems, but occasionally she would read some old systems, and consult her old colleagues if she did not understand or felt different from her own ideas.
Sometimes, old colleagues will have a catchphrase, this is the history of the code problem, I do not know what the impact of this section, will increase the cost of regression, this period will be added like this, later see.
Every time he heard such a conclusion, a Xing, being a newcomer, would agree with his old colleague that such consideration was reasonable.
But a xing heart always faint feeling wrong…
Break or Repair?
Because of his good performance during his entry period, the leader walked behind a Xing, patted him on the shoulder and said, “A Xing, recently we are going to contact with a new payment company, pay if you are good. Please ask your old colleague to know how to contact with other payment companies, and you can do this.
Star inner OS: “It’s great to finally participate in the development of the core process”
A Xing found out with his old colleague that a new payment manufacturer needs to add a corresponding function of opening payment, connecting payment and processing of opening information callback.
A Xing La selects the system mainly used for docking payment, mainly by defining a standard interface to the upstream system. Internally, through the display Id distributed by the upstream, the display Id is converted into the manufacturer Id that can be identified by the system to enter the main process of each system.
A star is coming to the new vendor interface documentation, the above three functions are added a new branch to implement, and added upstream display Id and pay for the conversion between vendors code.
Entering the test phase, A Xing found that the direct payment function worked, but the opening function did not work. After checking the code carefully, it was found that the opening and payment had maintained a conversion relationship between the display Id and the manufacturer respectively.
In order to avoid the deployment of the code, or impassability, A xing carefully looked up the whole system, found such conversion relationship, maintenance of 7 places in the system.
A xing looked at the implementation of old colleagues, are used when a new function, the original conversion code directly taken over, added a new branch.
A Xing thinks that such conversion logic should be maintained in a unified place, otherwise, when a new or modified manufacturer is added, each change of a manufacturer needs to modify these 7 places, and with the addition of functions, there may be more.
A Xing asked his former colleague, who said that when he implemented it, he also saw the previous code was written in this way. Indeed, he did not think it was reasonable, but history is written in this way, so he continued to add later.
A Xing was in doubt whether he should optimize this feature or continue with the old usage and fix it when it was too late.
What would you do? Think, can leave a message to answer ~
Do the right thing, not the easy thing
A Xing thought, if I also continue to do so, then the next person may continue to do so, so this unreasonable treatment will continue forever, never end the day, also can not become a good code, this is my dream to join the company ~
But change so many places, will it affect a lot, A Xing took the initiative to find a senior colleague, explained their ideas, colleagues also recognized their own practice, before the opening of a hole, now more and more big, it should be repaired.
Come on, watch my pegasus meteor! (Sorry, Star has some middle 2’s)
A star will be all responsible for the conversion of logic, are extracted, unified to a place, increase the notes, and the original everywhere call, are gathered up to a place, although for this star overtime test a lot of not his demand function, but a star heart is satisfied, he did a right thing.
After repairing the hole in a star, and then docking several new manufacturers, we no longer need to modify 7 places, a star has a deep sense of power and name.
Broken window
When a Xing was fixing the problem before, he wondered why everyone had seen this problem before, but no one had fixed it after discovering it in the first time.
Until one day, Xing learned about this theory – the broken window effect.
The broken Window effect Broken Windows Theory is a theory of criminology developed by James Q. Wilson and George L. Kelling, And an article in The March 1982 edition of The Atlantic Monthly titled “Broken Windows.”
The theory is that undesirable phenomena in the environment, if allowed to exist, will induce people to imitate or even exacerbate them. Take a building with a few broken Windows. If those Windows are not repaired, vandals will probably destroy more Windows. Eventually they will even break into buildings and, if they find them empty, perhaps settle there or set fire to them. One wall, if some graffiti has not been cleaned off, soon, the wall is full of messy, ugly things; A few scraps of paper on a sidewalk, and soon there will be more, and eventually people will take it for granted and throw it on the ground. This phenomenon is called the broken window effect in criminal psychology.
Star after finish see, in software development is also there is a broken window, when an unreasonable development, not in the first place in the broken window, the next person might waver between and trim, a probability make the window bigger, make the window becomes harder to repair.
Let’s fix the window together
A Xing finally realized that, whether small or large factories, the code is to rely on everyone to maintain, only we have the consciousness to repair the window, will let the system become better and better, otherwise it will only be dumped on the historical problems, but who caused the historical problems?
Well, this is programmer small cen characters a star’s first adventure, if you feel good, support, my public number is programmer small cen growth record.