Below steps will show you how to use a design pattern after selecting one of them for solving a problem.
Read the pattern once through for a overview:
Give importance to the applicability and consequences sections to ensure that the pattern is right for your problem.
Study the structure, participants and collaborations sections:
Make sure to understand the classes and objects in the pattern and how they relate to one another.
Look at the sample code section to see a concrete example of the pattern in action:
Studying the code helps us to implement the pattern.
Choose names for pattern participants that are meaningful in the application context:
The names in the design patterns are too abstract to be directly used in the application. Include the participant name into the name that appears in the application which makes the pattern implementation explicit. For example, if you use strategy pattern for developing UI, use UIStartegy or GridStrategy as class names.
Define the classes:
Declare their interfaces, inheritance relationships and instance variables, which represent the data and objet references. Identify the effected classes by the pattern and modify them accordingly.
Define application-specific names for the operations in the pattern:
Use the responsibilities and collaborations as a guide to name the operations. Be consistent with the naming conventions. For example you can always prefix an operation with “Create-” to denote a factory method.
Implement the operations to carry out the responsibilities and collaborations in the pattern:
The implementation section provides hints to guide us in the implementation. The examples in the sample code section can also help as well.
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Leave a Reply