mercredi 29 avril 2015

How to choose design pattern

I am learning Design Pattern and I have a question.

For example, here is the first design.
Shape
Shape->Red Circle
Shape->Blue Circle
Shape->Red Square
Shape->Blue Square
...

Second design
Shape
Shape->Circle
Shape->Square
Shape->Circle->Red Circle
Shape->Circle->Blue Circle
Shape->Square->Red Square
Shape->Square->BlueSquare
...

I know that different designs should fit different situations, and I would like to ask the strength and weakness for these two designs. For example, the complexity of code and the independence of different part of code.

Aucun commentaire:

Enregistrer un commentaire