UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 16)
Q17. A software design pattern often used to restrict access to an object is ___________ .
(1) Adapter
(2) Decorator
(3) Delegation
(4) Proxy
Answer : (4) Proxy
Reason :
In software engineering, a
design pattern is a general repeatable solution to a
commonly occurring problem in software design. A design pattern isn't a
finished design that can be transformed directly into code. It is a
description or template for how to solve a problem that can be used in
many different situations.
Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns.
Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns.
These design patterns are all about Class and Object composition.
Structural class-creation patterns use inheritance to compose
interfaces. Structural object-patterns define ways to compose objects to
obtain new functionality.
-
Adapter
Match interfaces of different classes -
Bridge
Separates an object’s interface from its implementation -
Composite
A tree structure of simple and composite objects -
Decorator
Add responsibilities to objects dynamically -
Facade
A single class that represents an entire subsystem -
Flyweight
A fine-grained instance used for efficient sharing - Private Class Data
Restricts accessor/mutator access - Proxy
An object representing another object
A Proxy can also be defined as
a surrogate. In the real work a cheque or credit card is a proxy for
what is in our bank account. It can be used in place of cash, which is
what is needed, and provides a means of accessing that cash when
required. And that's exactly what the Proxy pattern does - controls and manage access to the object they are "protecting".
0 comments:
Post a Comment