Questions tagged [Refactoring] (53)

1
answer

How to refactor nested if else?

A class with a set of States. In this class there are N functions. Each function should do one or the other depending on the current state, simultaneously checking the input. In the end, every function that looks like private void FuncN(string[] params) { if (CheckFuncNParams(params)) if (state == State.StateX) if (colle...
wilmer66 asked April 8th 20 at 10:12
3
answers

How in php to organize the storage of the temporary table data to the time of the script?

Writing exchange for a site with an external service. Write on the side of the site to service only requests via its API. Each entity which is exchanged, is: 1) id's on the website (mysite_id) 2) external id on the website (mysite_ext_id) 3) external id in the external service (service_ext_id) 4) id on the external service....
Cornell asked April 7th 20 at 11:08
1
answer

Reliable way to find unused files and code?

Classes, methods, files, css and so on and so forth. It is also worth to note that there are for example files that are used by the API. Comes to mind is to intercept the request and record the unique files that are used. What packages, plugins, analyzers, methods?
everardo70 asked April 7th 20 at 09:06
2
answers

How to convince the client that it is time to redo the project?

Often the situation. Start to do the project for a new client. Initially not clear what the result of our cooperation. Possible after completion of the project, we will say goodbye to this client. And perhaps the project will continue to improve and work on this project will grow into a long-term cooperation, the original f...
Zane_Fahey1 asked April 7th 20 at 08:51
1
answer

How best to implement localization?

We had such a code...loc namespace { const wchar_t* get(const char* key); } It turned out such a thing. For languages that we don't know and are forced to take English, and the rules of the plural other, displays something like "5 day remaining" — simply because Japanese does not have these rules. Okay, so here corrected.s...
xavier.Muller asked April 1st 20 at 16:23
4
answers

Does it make sense to pass $_POST as a parameter?

Does it make sense to do so:function process($request_data) { } process($_POST); Or is it better to use $_POST directly in a function process, if it is still superglobal?
estefania_Thompson asked April 1st 20 at 15:52
2
answers

What is meant by reavtoringa code in js and how I did it correctly for the proposed code?

Have to do a test. You need to do refactor the code:Journal function(date) { this.date = date; this.formatDate = function(date) { return date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear(); }; this.getTitle = function() { return "Output from" + this.formatDate(this.date); }; } Journal.compare = ...
Catharine.Batz31 asked March 24th 20 at 12:14
3
answers

How best to optimize and make my JavaScript code shorter?

I have the following JS code:if (floors.value == 1) { if (area.value <= 120) { a1 = 1.26; } else { a1 = 1; } if (area.value >= 120.001 && area.value <= 140) { a2 = 1.24; } else { a2 = 1; } if (area.value >= 140.001 && area.value <= 160) { a3 = 1.23; } else { a3 = 1; } if (area...
henderson37 asked March 23rd 20 at 18:34
2
answers

How to formulate a legal description of the refactoring code and requirements to the contractor of carrying out of refactoring before submission of an information system?

Within the company there was a Department of web development at some point the head of the Department left the company and organized its web-Studio, at the moment I need to take from them developed an information system (website and content management system based on the decision of 1C Bitrix). I don't want to accept the jo...
felix_Nitzsche asked March 21st 20 at 13:53
2
answers

How to compactly write this code?

Guys, in js is very poor. There is here such script:$('#cont-one').on('click', function(event) { $("#one-cont").addClass("activecont") $("#two-cont").removeClass("activecont") $("#three-cont").removeClass("activecont") $("#four-cont").removeClass("activecont") event.preventDefault(); }); $('#cont-two').on('click', functio...
Jan_Lehner asked March 21st 20 at 12:47