As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.
Design Patterns Defined
As BlackWasp explains, Design patterns provide solutions to common software design problems. In the case of object-oriented programming, design patterns are generally aimed at solving the problems of object generation and interaction, rather than the larger scale problems of overall software architecture. They give generalised solutions in the form of templates that may be applied to real-world problems. Design patterns are a powerful tool for software developers. However, they should not be seen as prescriptive specifications for software. It is more important to understand the concepts that design patterns describe, rather than memorizing their exact classes, methods and properties. It is also important to apply patterns appropriately. Using the incorrect pattern for a situation or applying a design pattern to a trivial solution can over-complicate your code and lead to maintainability issues. A group of developers, the Gang of Four, publicized these 23 design patterns.
|1. Abstract Factory||Creates an instance of several families of classes|
|2. Builder||Separates object construction from its representation|
|3. Factory Method||Creates an instance of several derived classes|
|4. Prototype||A fully initialized instance to be copied or cloned|
|5. Singleton||A class of which only a single instance can exist|
|6. Adapter||Match interfaces of different classes|
|7. Bridge||Separates an object’s interface from its implementation|
|8. Composite||A tree structure of simple and composite objects|
|9 .Decorator||Add responsibilities to objects dynamically|
|10. Facade||A single class that represents an entire subsystem|
|11. Flyweight||A fine-grained instance used for efficient sharing|
|12. Proxy||An object representing another object|
|13. Chain of Resp.||A way of passing a request between a chain of objects|
|14. Command||Encapsulate a command request as an object|
|15. Interpreter||A way to include language elements in a program|
|16. Iterator||Sequentially access the elements of a collection|
|17. Mediator||Defines simplified communication between classes|
|18. Memento||Capture and restore an object’s internal state|
|19. Observer||A way of notifying change to a number of classes|
|20. State||Alter an object’s behavior when its state changes|
|21. Strategy||Encapsulates an algorithm inside a class|
|22. Template Method||Defer the exact steps of an algorithm to a subclass|
|23. Visitor||Defines a new operation to a class without change|
Design Patterns for Unity 3D / C#
C# is a robust language, and all popular design patterns are possible. However, which design patterns are most appropriate to Unity3D and game development?
1. Which patterns above are ‘built-in’ to the Unity3D experience?
I’m curious of your help here. Please add a comment below.