Java Common Mistakes and Best Practices Flashcards

1
Q

Thinking about optimization even before implementation starts.

Best start with a simple solution, then optimize and refactor

A

Premature Optimization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

Bikeshedding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Too much analysis leading to paralysis

Similar with Premature Optimization, start with a simple solution and adjust and refactor as necessary

A

Analysis Paralysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Classes with too many responsibilities and dependencies

Design your code to be more modular and keep DIP in mind

A

God Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Better to break large classes into smaller, more manageable ones

A

Fear of Adding Classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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.

A

Inner-platform Effect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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.

A

Magic Numbers and Strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Reliance on “numbers” for deceision making

Can be observed in bigger companies and workplaces. 

“Numbers” should serve as a guide

A

Management by Numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Restructure code to get rid of these.

A

Useless (Poltergeist) Classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly