Java Common Mistakes and Best Practices Flashcards
Thinking about optimization even before implementation starts.
Best start with a simple solution, then optimize and refactor
Premature Optimization
Spending too much time on debating or deciding trivial matters.
Be aware of the time spent on decision making and try to reduce it to acceptable bounds.
Bikeshedding
Too much analysis leading to paralysis
Similar with Premature Optimization, start with a simple solution and adjust and refactor as necessary
Analysis Paralysis
Classes with too many responsibilities and dependencies
Design your code to be more modular and keep DIP in mind
God Class
Better to break large classes into smaller, more manageable ones
Fear of Adding Classes
Re-implementing features that are already built in to the platform
Be knowledgeable of the features that your platform has. This takes time and mastery.
Inner-platform Effect
Using unnamed Strings or Literals in your code that seem to come out of nowhere.
Better use constants or variables to avoid this anti-pattern. It results into more readable code and more flexible program.
Magic Numbers and Strings
Reliance on “numbers” for deceision making
Can be observed in bigger companies and workplaces.
“Numbers” should serve as a guide
Management by Numbers
Restructure code to get rid of these.
Useless (Poltergeist) Classes