📜 ⬆️ ⬇️

Modify or rewrite

The main idea of ​​this article: rewrite from scratch a working and implemented project only at gunpoint.



Next, imagine that you work alone, and do not share cookies with anyone.

Situation # 1: small project


Imagine you are a student. You write your first student project — more than a laboratory project, but less than a real commercial project. The size is approximately 1000 lines of code.
You wrote it and wanted to improve it. But suddenly they discovered that you had a mistake in the architecture, and the correction was problematic. Rewrote. Then again. Will you rewrite it for the fourth time? Maybe.
Small projects can be rewritten indefinitely, until they are brought to perfection. But the problem is: where is the line between perfection and madness?
I think that at least a little average project can not be brought to perfection, because today it seems to you that some methods are perfect, and tomorrow - others. And time will be lost. In the end, you can pass a half-working project that is stuck on the third rewriting stage (you are a student, and in the first project you decided not to use VCS, because this is the mainstream).
')

Situation 2: free swimming


Now you are already an advanced student, and you want to use it. Or maybe just create your project, your game, your auction with blackjack and ... well, you understand.
There is a great idea, you described it, programmed it, made it, optimized it. Gave testers testers. It would seem that nothing foreshadowed trouble.
But here you find that it is becoming more and more difficult for you to build in new opportunities, and somewhere in the depths of your soul the rewriting worm gnaws you.
Think about whether you value your time and the results of your work to rewrite your wonderful project with a size of 5000 lines of code. If you do not appreciate, then please start from scratch. Remember that in this case, your project is unlikely to be completed.

Situation number 3: someone else's code



This is the most dangerous path, slippery, vile and dirty track. So, imagine that you have somehow surrendered your student project, abandoned your personal project (sorry, of course they were postponed to return when there will be time!).
And so, someone else’s code of 10-15 thousand lines gets to you. Govnokod. According to you. The introduction of updates is tantamount to shooting oneself in the leg. Rewrite?
Do not hurry. First, evaluate your capabilities. How long will it take you to rewrite it? How will it be paid? Is it the right time?
Rewriting someone else's code is fraught with several problems.
The first problem : the code is most likely already implemented and working. In this case, you will not only need to re-develop all its functionality, but also take into account all the crutches that the former govnoder has stumbled upon.
The second problem : you can not pull the project, start prokrastirovat, and ultimately, completely fill up the project.
The third problem : why are you so sure that you will not write the same shit code?

Situation 4: Outdated Project or Specific Tools


Perhaps this is the only partial justification for the complete rewriting of the project. It is known that now many working programs are as old as mammoth shit, but people continue to use them. Because they are working, debugged, and errors in them arise where it is known. Such a project can really be rewritten from scratch, taking into account rigidly and clearly formulated requirements, a sea of ​​tests and many hours of debugging. However, remember that even in this case there are no guarantees that the project will work as soon as necessary. Perhaps this is why there are still programs that are old as ... well, you understand.



So, when you do not need to rewrite the project :
1) When you value your time and the time of other people that they have invested in the project;
2) When you are not sure that you can accurately repeat the functionality of the project;
3) When you are not fully understood the project, do not know its features;
4) When you govnoderov;
5) When no one threatens your favorite hamster.
6) The size of the project exceeds 10,000 code, excluding tools and frameworks. Even this will be much to assess whether the game is worth the candle.

When it may be worth rewriting a project :
1) When the implementation of improvements takes an extremely long time and / or a lot of money due to the excessive complexity of the system;
2) When you have studied the project thoroughly and know every detail of it;
3) When it is your pleasure to rewrite your favorite calculator for the 50th time;
4) When the customer came to your home and insistently asserts that your or someone else's govnokod works very poorly, and he wants you to do everything great the first time;
5) When you are offered an unimaginable pile of money for a small project.

And also remember that serious people believe that rewriting projects from scratch is a sign of lack of professionalism.
Good luck.

Source: https://habr.com/ru/post/140680/


All Articles