📜 ⬆️ ⬇️

What is cheaper: new hardware or developers?

This article was inspired by the following post “How to improve your programming style?” Plus a recent argument among colleagues.

Imagine such a dialogue:

Admin : Gentlemen, developers, your code on the server began to eat a lot of RAM. The server is already starting to swap. You understand, everything can get a stake!
Representative of developers (for example, timlid) : Damn, trouble. Now we will deal with the problem.
Hey, team, admins are ashamed of us here for the non-optimal code. We urgently need to drop everything and optimize the old code.
Project Manager : Hey, where are you going? What is optimization? Let admins buy more memory in the server and there is no problem. And you won a bunch of new features need to be developed. No optimization! Focus on the new functionality. We need to get ahead of competitors with new features. Then somehow optimize your code.
')
And who are you right? What should be done? Do I upgrade iron or do optimization?
At the end of the article will be a vote.

I propose to discuss in the comments on the designated topic. But let's not assume that the problem is only in RAM. The question is actually more general: where to spend the money? Yes, yes, everything is in them the most. Those. money can be spent on new equipment or on man-hours (salary) which will be spent on code optimization.

It is difficult for me to visit all four participants who may be involved in the discussion of this issue. But I will try to explain what each of them thinks.

Admins thoughts

These developers do not know how to program anything at all. Their code is increasingly gluttonous. Constantly buy more equipment. It eats electricity. Yes, and breaks and becomes obsolete. Some problems. Let them learn how to program and their creation will work on one server. There will be happiness!

Thoughts of developers

Tortured already with this new functionality. When will they give time to refactor? Vaughn, admins are already looking askance at us. The code must be optimal. Easy to read. Fast and consume little memory. We can program this way. We only need 30-50% more time for this.

Thoughts of the project manager

The project is already running and makes a profit. And here is a list of new features that need to be finalized. And you need to do it as quickly as possible to get ahead of competitors. Suppose I single out one developer to optimize the old code, which began to consume a lot of memory. In total, I will spend N rubles on salary for this month for optimization. Plus we will lose in pace, because This developer will not participate in the creation of new functionality.
On the other hand, for (N * 2) rubles, I will purchase a pile of memory in the server.
And if, in a month, scripts (possibly re-written) that will eat up memory are still evolved, then most likely it will not be so critical if there is more memory in the servers. And the pace of development will not fall, because everyone will do their work: admins upgrade servers, and developers create new functionality.
And what do you need to do so that programmers write more optimal code? They do not write this way out of evil: they either lack knowledge or time for optimization.

How to increase knowledge? Spend time learning. Or to dismiss these and hire more intelligent, but the salary is 50% (and maybe 100%) more. Those. if the team is not engaged in sabotage now, then to achieve a more optimal code at the output is an additional cost, either for money or for development time. I feel that it is easier to buy more memory in the server.

Thoughts of a business owner (fourth character comes into play)

So, the project manager asked to choose:

In this case, the manager made it clear, not a fact that the time spent on optimization will lead to the goal. But additional equipment will definitely solve the problem for the next couple of years.
The manager also explained that investing in a development team is more likely a long-term investment. Excellent, the optimal code will “pay dividends” in the future.
And the investment in the equipment will return immediately.
The same equipment is the property of the company. Under it in perspective, for example, you can get a loan. Or (God forbid) to sell, even if it is cheaper, if suddenly things go wrong and you have to curtail business.
(Then everyone himself thinks that he chose the Boss).



When discussing in the comments, I suggest building on the following prerequisites:

These prerequisites are a situation where flaws (thanks for the comment by lolmaus ) the need for refactoring is in fact cheaper to “plug” with new iron. Do I need to do this?
Do I need to optimize the code and lick it, or is it easier to develop an architecture that supports horizontal scaling and simply buy more equipment or raise new instances in the cloud?

I didn’t make the option “buy some equipment and give time for optimization”, because in fact, this is still the first option.

PS In the comments I will spur the discussion and support the position of each of the four virtual characters of this post. So do not assume that I have a calculation of identity.

PPS Here is a post-continuation of this topic from Cord

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


All Articles