CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE JAN2016 ASSESSMENT_CODE BT9303_JAN2016 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 36862 QUESTION_TEXT Explain the benefits of prototype patterns. Benefits: (5×2=10 marks) ● Adding and removing of the prototype at tun time ● Specifying new objects by varying values ● Specifying new objects by varying structure ● Reduced subclassing ● Configuring an application with classes dynamically SCHEME OF EVALUATION QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 36863 QUESTION_TEXT Explain the applicability, advantages of façade pattern and who are its participants. SCHEME OF EVALUATION Applicability: (3×2=6 marks) ● A façade can provide a simple default view of the subsystem that is good enough for clients. ● A façade decouples the subsystem from clients and other subsystems, promoting subsystem independence and portability ● Use a façade to define an entry point to each subsystem level. Participants: (1 mark) ● Facade ● subsystem classes Advantages: (3 marks) ● It shields clients form subsystem components. ● It promotes weak coupling between the subsystem and its clients. ● It doesn’t prevent applications from using subsystem classes if they need to. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 36864 QUESTION_TEXT Explain the benefits and drawbacks of mediator pattern. SCHEME OF EVALUATION ● It limits subclassing ● It decouples colleagues ● It simplifies object protocols ● It abstracts how objects cooperate ● It centralizes control (2 marks each) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 125950 QUESTION_TEXT What is iterator pattern? Explain its applicability and its consequences. Iterator pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. It is also known as ‘cursor’. (2 marks) Applicability: (3 marks) SCHEME OF EVALUATION Use the Iterator pattern to access an aggregate object's contents without exposing its internal representation. to support multiple traversals of aggregate objects. • to provide a uniform interface for traversing different aggregate structures (that is, to support polymorphic iteration). Consequences: (6 marks) The Iterator pattern has three important consequences: 1. It supports variations in the traversal of an aggregate. Many ways can traversed by compelx aggregates. For example, code generation and sematic checking may traverse the parse trees. The pre order or in order may be used in code generator. Traversal algorithm can be made eassy under iterators. It is just by replacing iterator with different one. New traversal can be defined by iterator subclasses. 2. Iterators simplify the Aggregate interface. The need is obviates the interface in Aggregate by iterator’s traversal interface. So that simplified aggregates interface is available. 3. More than one traversal can be pending on an aggregate. The each state of iterator will be kept as a track of its own traversal state. So that user will get more than one traversal in with one progress. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 125951 QUESTION_TEXT Explain the consequences of memento pattern. SCHEME OF EVALUATION The Memento pattern has several consequences: 1. Preserving encapsulation boundaries. The confidential information are known only to originator and memento always avoids for exposing. The pattern protects other objects from originaotrs internals, so that preserves the encapsulation of boundaries. 2. It simplifies Originator. The encapsulations are kept as backup which is nothing but designs, so that various versions are available from internal sates so that whenever client requested these need to be provided. These back up keeping is one big burden, which is putted on originator. Whenever the client asks for simplification then originator notifies when it happens. 3. Using mementos might be expensive. Mementos are overloaded if lage aount of information’s are stored or if client creates and returns the mementos to originator is also possible. If encapsulation and restoring the originator state is easy and less costing then the pattern may not be appropriate. 4. Defining narrow and wide interfaces. In some languages ensure about access of memento’s from originator. 5. Hidden costs in caring for mementos. If cares are taken by mementos then caretaker is having the rights for deletion. But caretaker does not have any information about how many number of states are existing in memento. Or caretaker also can store large information with large storage devices which stores all the memento’s. (2 marks each) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 125953 QUESTION_TEXT What do you mean by a Design Pattern? Explain the four essential elements of a Design Pattern. i. SCHEME OF EVALUATION ii. Definition: Each design pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. In general a pattern has four essential elements 2 marks Pattern Name: it is a handle we can use to describe a design problem, its solutions, and consequences in a word or two. It lets us design at a higher level of abstraction. It makes it easier to think about designs and to communicate them and their trade-offs to others. Finding good names has been one of the hardest parts of developing our catalog 2 marks iii. iv. v. Problem: The problem describes when to apply the pattern. It explains the problem and its context. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern 2 marks Solution: The solution describes the elements that make up the design, their relationships, responsibilities, and collaborations. The solution doesn’t describe a particular concrete design or implementation, because a pattern is like a template that can be applied in many different situations. Instead, the pattern provides an abstract description of a design problem and how a general arrangement of elements solves it. 2 marks Consequences: The consequences are the result and trade-offs of applying the pattern. Though consequences are often unvoiced when we describe design decisions, they are critical for evaluating design alternatives and for understanding the costs and benefits of applying the pattern. The consequences for software often concern space and time trade-offs. They may address language and implementation issues as well. 2 marks