Questions tagged [refactoring]
Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.
756 questions
2
votes
2
answers
281
views
How to design extensible data aggregation code to avoid manual updates in multiple places?
I have a data aggregation function that collects statistics from multiple sources. The problem is that whenever I add a new metric, I need to manually update the code in three different places, which ...
1
vote
1
answer
154
views
What is the difference between Vertical Slice Architecture and Feature-Based Architecture
I am refactoring my monolithic application, in which the code is organized based on layered architecture.
I want to implement Modulith (Modular Monolit) in my app, but I've run into a problem: I haven'...
17
votes
7
answers
4k
views
Is there a reason "replace conditional with table" isn't a standard refactoring?
I'm preparing a lecture where I will start with a many-branched conditional statement and replace it with a table. For example, I could start with:
function getMonthName(monthNumber) {
if (...
1
vote
1
answer
125
views
I have a system that's part of an event-driven architecture. Need some advice on refactoring
I have a system that was built 5 years ago. It's part of a multi-system event driven architecture. And each system is owned by a different team with varied responsibility.
When the system was ...
2
votes
2
answers
2k
views
Refactoring a legacy codebase with a god Repository and incomplete Clean Architecture [duplicate]
I'm currently working on a large legacy project that tried to implement Clean Architecture combined with MVVM, but unfortunately didn't fully adhere to the principles.
One major problem:
The ...
12
votes
7
answers
1k
views
Techniques to do continuous refactoring
I've come to believe that continuous refactoring is a good way to maintain the health of a system that is in continuous development. That is, a system for which new features are always in the pipeline....
4
votes
1
answer
287
views
Refactoring a codebase from manual memory management to RAII
Edit: @Ben Cottrell's comment said this was similar to a question about spaghetti code. While both questions involve large codebases, mine addresses a specific technical pattern: manual memory ...
2
votes
5
answers
2k
views
Rewrite or Transpiler - How to move away from a proprietary SAAS solution
We are using a Software as a Service platform that allows to create custom code which integrates in the platform and all its features (dialogues for common objects like Account, Customer, Address, and ...
3
votes
5
answers
1k
views
What is the root cause of a proliferation of "null checks"?
I work with a lot of Groovy code. One feature of the language is the "safe navigation operator" (?), which I think of as an inline null check. There are many things about Groovy that I like, ...
2
votes
3
answers
2k
views
Is refactoring scattered functions into a class always a good idea?
Straight to the point, here's the original code:
integer = input(...)
size = len(integer)
# Created three dicts for matching numbers as keys to corresponding words
dic_ones = {...}
dic_tens = {...}
...
0
votes
4
answers
273
views
Refactoring the application with correct SemVer approach
Suppose I have an application with version 1.2.3.
If I refactor my application to remove deprecated calls while maintaining the same functionality and API as in version 1.2.3, what version number ...
-1
votes
1
answer
588
views
ReactJS hook vs utility function
Should we use utility functions in react or should everything be components and hooks?
I had this scenario:
Utility function for formatting money.
const formatMoney = (value) => value == null ? '' :...
2
votes
3
answers
227
views
Is it still "feature envy" if the state to make decision or the action to take after asking the state involves other classes to participate?
According to https://softwareengineering.stackexchange.com/a/212130/432039, if a class asks another class for the state, and then call methods of that class, it is called "feature envy", eg:
...
2
votes
1
answer
155
views
Refactoring Processor classes
I am writing some python 3 bioinformatics software and was wondering about the best way to write it in an OOP format. I am pretty sure a lot of my classes are violating the SRP principle, but I'm not ...
0
votes
1
answer
213
views
Our php codes base has 6 different ways to do INSERT … ON DUPLICATE KEY UPDATE, how do I fix it?
Our php codes base has 6 different ways to do INSERT … ON DUPLICATE KEY UPDATE. It happened over years because the php framework is evolving and my team members come and go, although I won't say we ...