A. From the tree
Basically everyone knows the concept of tree.
Dig a little deeper. NET essence of people will understand that. NET has an object tree.
People who learn asp.net will surely know that there is a control tree on the web.
Even college students who have only studied data structures to cope with exams will know the concept of tree.
Two. Expand the demand into a tree
Give us an example of the most commonly used Photoshop.
In Photoshop, there are many graphical tools, such as the stars, such as squares, circles, and so on.
In Photoshop, there is no need to say, there are a lot of colors for us to choose from.
So there was the Red Star, the Green Star. Red Square, Green square and so on.
Look at the resulting tree:
Now it's three graphs, three colors, so we're going to declare nine classes, and of course we're not counting the secondary parent classes in the middle process.
If we are now 18 graphics, 12 colors, then we need to write 18*12 class, then add 12 color classes and a total parent class, altogether we need to 12*18+12+1=229 class.
Let's remember that number.
I hope you do not argue with me, we can write color and then dynamically introduced. We are here to assume that there is no color this attribute, but we need to implement it ourselves.
Three. Object explosion
I've already mentioned the word in two design patterns.
Of course, the explosions here are not as scary as the one in the last article.
But we should also improve him in pursuit of perfection.
Then let's start thinking.