Skip to main content

All Questions

1 vote
3 answers
220 views

Approach for rewriting a large, mission-critical method

Context: I am a new hire out of university at a large software company tasked with either refactoring or re-writing a large legacy method (~500 lines, ~2000 lines expanded with private method calls) ...
hpabst's user avatar
  • 133
2 votes
2 answers
938 views

Large method with nested switch case(s) refactoring (Java)

Essentially I've got a bunch of formulas in two giant methods in a class designed to do math transformations and evaluations to multiple inputs. Where the inputs are actually lists of inputs (as there ...
Akumaburn's user avatar
  • 131
1 vote
1 answer
171 views

How to add supporting information to the existing java object?

Is there a way or design pattern to add supporting information to the existing java object? Example I have a model class Parent and it has child models. Its nothing but hibernate entities with parent-...
Javee's user avatar
  • 19
1 vote
1 answer
451 views

Refactoring Password Validation Utility

Given a password, I am trying to validate if it passes all validation rules such as Be at least 6 characters long Contain at least one letter (a-z or A-Z) Contain at least one number (0-9) Contain ...
Sachin's user avatar
  • 119
18 votes
8 answers
4k views

Refactoring a long method which is based on large number of switch cases [duplicate]

We are using Java as a backend development language. One year back, we wrote a method which uses switch cases based on Enums values. Since we are continuously adding enum members and according adding ...
Free Coder's user avatar