I know that design patterns are time tested solution to a particular type of software problems.
But how would I know that I am overusing a design pattern? How much is too much ? What things should I keep in mind while using design patterns to avoid overusing?The only possible way I can think of is to get a real grip on the design pattern before you even think of using it.
Before using the design pattern you must know what exactly it is meant for?
What may be the advantages/ disadvantages of using it ?
Start with your own idea and see if the design patterns fits along the way.
You can even make slight modifications in the pattern if it makes your code better.
If you are a beginner just don't worry to make some mistakes because it is the way we all learn.
Design patterns are really great but can make your code unnecessarily complex and bulky if not used wisely.
Hope this helps.
I would give you some analogy. Every pattern has a certain boundaries it enforces on your software architecture. You can think of geometrical shape. One pattern adds a triangular shape to your pattern, other more square-like, the third one might be a hexagon. it makes no sense to try inscirbe a square inside a line but it makes more sense to inscribe it inside some hexagon but the ideal way is to inscribe it only into squares.
I totally aggree with @EMM. The understanding of these boundaries comes with studying what it is meant for, advantages/disadvantages of it, etc. But you should never NEVER force an unsuitable pattern onto your software because it is like forcing an ellipse inside a square or even worse. Pattern should be added only if it is real natural place.
精彩评论