Skip to main content

All Questions

9 votes
2 answers
1k views

Should function names describe their parameter types?

If you wish to perform the same action using different parameters, you can either make differently named functions: public Apple findAppleById(long id){ return repo.findById(id); } public Apple ...
Bar Akiva's user avatar
  • 217
8 votes
6 answers
5k views

What is more important? SOLID or KISS?

What is more important? SOLID or KISS? To be consistent with SOLID I would have to inject Decorator and Footer classes and create interfaces for them. public class HelloService { String name; ...
cimlihor's user avatar
7 votes
5 answers
8k views

What to do with long variable names?

First example: countryRepository.getCountriesFromAsiaWhereAreTheMostPlanesAndBoats(); countryRepository.getCountriesFromAfricaWhereAreTheMostCars(); Are these names too big? How else do we call these ...
paulbooker's user avatar
84 votes
8 answers
73k views

Is modifying an incoming parameter an antipattern? [closed]

I am programming in Java, and I always make converters sort of like this: public OtherObject MyObject2OtherObject(MyObject mo){ ... Do the conversion return otherObject; } At the new ...
CsBalazsHungary's user avatar
8 votes
3 answers
10k views

Ordering if conditions for efficiency and clean code [closed]

This is purely a design question and the example is simple to illustrate what I am asking and there are too many permutations of more complex code to provide examples that would cover the topic. I am ...
user avatar