JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech IV DESIGN PATTERNS Previous Question Paper (September - 2021 - R15)
Answer any Five Questions. All Questions Carry Equal Marks.
Main
Draw a diagram to show relationships among design patterns? How to select a design pattern? How to use a design pattern?
Answer
Design patterns are categorized by their purpose (Creational, Structural, Behavioral) and scope (Class, Object). The relationships among them are defined by how they interact to solve recurring software design problems. Creational patterns handle object creation, Structural patterns deal with object composition, and Behavioral patterns focus on communication between objects. For example, a Factory Method (Creational) might be used to create objects that are then organized by a Composite (Structural) pattern and controlled by an Observer (Behavioral) pattern.
To select a design pattern, follow these systematic steps:
- Analyze the problem: Identify the specific design challenge, such as object creation complexity, class hierarchy issues, or communication decoupling.
- Review the Intent: Consult the 'Intent' section of various patterns to see which ones address your specific problem.
- Examine Consequences: Evaluate the trade-offs, such as memory usage, flexibility, and complexity, associated with each candidate pattern.
- Consider Relationships: Look for patterns that are often used together or are alternatives to one another.
- Prototype: Implement a small-scale version to verify if the pattern effectively solves the problem without introducing unnecessary overhead.
To use a design pattern effectively, follow this implementation process:
- Understand the structure: Study the participants (classes and objects) and their collaborations as defined in the pattern's class diagram.
- Identify participants: Map the abstract roles in the pattern to the concrete classes in your application.
- Define interfaces: Establish the necessary interfaces or abstract classes to ensure loose coupling between components.
- Implement the logic: Write the code for the specific pattern, ensuring that the interaction between classes adheres to the pattern's design principles.
- Refactor: Integrate the pattern into the existing code base, refactoring where necessary to ensure the design remains clean and maintainable.
Explain the following with respect to LEXI's design:
Establishing the user interface
Answer
In the Lexi document editor, establishing the user interface involves creating a flexible structure that balances the needs of the document representation with the requirements of the display. Lexi uses a recursive composition pattern, where document elements like characters, rows, and columns are treated as Glyphs. This allows the interface to treat simple elements and complex compositions uniformly. The user interface is established by nesting these glyphs to form a hierarchical structure, enabling the system to manage complex layouts, such as wrapping text or inserting graphics, by simply manipulating the tree of glyphs. This design decouples the document's logical structure from its visual representation, allowing for dynamic updates to the interface as the document is edited.
Supporting multiple Window systems.
Answer
Sign in to view the complete answer paper.
Discuss about creational patterns.
Answer
Sign in to view the complete answer paper.
Explain about sample code and uses of Bridge pattern.
Answer
Sign in to view the complete answer paper.
Discuss about implementation and related patterns of Composite pattern.
Answer
Sign in to view the complete answer paper.
Write and explain sample codes of Decorator and Flyweight patterns in detail.
Answer
Sign in to view the complete answer paper.
Discuss in detail about Chain of Responsibility pattern.
Answer
Sign in to view the complete answer paper.
Describe applicability, collaborations and sample code of Memento and Strategy.
Answer
Sign in to view the complete answer paper.
Explain the following:
Alexander's pattern languages
Answer
Sign in to view the complete answer paper.
History of design patterns
Answer
Sign in to view the complete answer paper.
A common design vocabulary.
Answer
Sign in to view the complete answer paper.