U
U
Urukhayy2017-08-17 12:36:54
Programming
Urukhayy, 2017-08-17 12:36:54

Planning and optimizing early or redoing later?

Perhaps the situation below is not related to the lack of premature optimization.
There is a web application, the client part of which sends asynchronous HTTP GET and POST requests in the background to the server to receive any data. Suppose these HTTP requests are sent by the
http.get and http.post functions . There are many places in the code that require receiving data via HTTP on the client. For example: getAccounts, getStatistics, getUsers, etc. For each HTTP, a function is made:

function getAccounts() {
    return http.get("SERVER-URL/get-accounts") // ......запрос на сервер
}

And it turned out that there are a lot of such functions. And suddenly, during the development of the application, it became necessary that service information be sent in each HTTP request from the client to the server. It turns out that if you do not initially select an abstract method for sending requests, you will have to insert code that sends service data into all the many functions that work with HTTP?
function getAccounts() {
    return http.get("SERVER-URL/get-accounts?special=1") // ......запрос на сервер
}

When should abstract methods be introduced?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Karavaev, 2017-08-17
@Quieteroks

There is an opinion that when working through a library that can be updated and changed, you should always use a facade. In addition, the facade makes it possible to simplify some of the points required by the library.
In the development process, everything depends on the deadlines and requirements. In our office, it is promoted that we do what is set in the task, without adding a lot of superfluous. The need will change, the code will change. Or maybe tomorrow you will have to completely rewrite the entire section of the site, because it does not bring the necessary conversion.
So, if you have time for serious planning, do it, but you still won't save yourself from some situations that you didn't foresee at the time of planning. At best, save yourself from something global, IF the right choice was made at the planning stage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question