Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 2 - Vehbi Dragaj
What are the differences between creational, structural, and behavioral patterns?
Creational Patterns – deal with rules of creating and instantiating the objects in ways that would best fit the situation. Creational patterns simplify the design of objects and make the programs more flexible on deciding what object to create on different scenarios. However, structural patterns describe how we can combine many different objects on creating a large structure such as interfaces. Structural patterns have to do with both inheritance of objects and the ways they relate to each other. Finally, behavioral patterns are patterns that help a programmer set up a way for the objects to communicate with each other. So the structural patterns control the flow of info from one object to next.
Describe one design pattern or pattern language in your own words. Again, reference your sources. Explain what interests you about this pattern. Does it make sense to you? Can you see using it in your coding? If so, what for? If not, why not?
One design pattern that interested me was singleton. Singleton is a design pattern that restricts the instantiation of a class to a certain number of times (usually one but could be more). Usually, singleton is created by creating a class that has a constructor that creates the new instance and if the class has already been instantiated once it returns a pointer to the first instance. This pattern interested me because it is very common when we are dealing with server – client games. For example if we are implementing a multiplayer game, we wouldn’t want to instantiate the server multiple times, because if two players want to play with each other, they could one get connected to one instance of the server and the other to the other instance. Thus, they would not be able to play each other. So we need singleton design to restrict to one instance of the server. I think this pattern totally makes sense and I have used it in cs 2335 projects and most probably I will use it again in future.
Link to this Page