How to Choosing the Initial Domain Object?
Choose as an initial domain object a
class at or near the root of the containment or aggregation hierarchy of domain
objects. This may be a facade controller, such as Register, or some other
object considered to contain all or most other objects, such as a Store.
How to Connecting the UI Layer to the Domain Layer?
initializing routine (for example, a Java main method) creates both a UI and a
domain object, and passes the domain object to the UI.
UI object retrieves the domain object from a well-known source, such as a
factory object that is responsible for creating domain objects.
Mention the Interface and Domain Layer Responsibilities.
The UI layer should not have any domain
logic responsibilities. It should only be responsible for user interface tasks,
such as updating widgets. The UI layer should forward requests for all
domain-oriented tasks on to the domain layer, which is responsible for handling
A pattern is a named problem/solution
pair that can be applied in new context, with advice on how to apply it in
novel situations and discussion of its trade-offs.
How to Apply the GRASP Patterns?
The following sections present the first
five GRASP patterns:
- Information Expert
Define Responsibilities and Methods.
The UML defines a responsibility as
"a contract or obligation of a classifier" [OMG01]. Responsibilities
are related to the obligations of an object in terms of its behavior.
Basically, these responsibilities are of the following two types:
Doing responsibilities of an object
something itself, such as creating an object or doing a calculation
action in other objects
-controlling and coordinating activities
in other objects
Knowing responsibilities of an object
about private encapsulated data
about related objects
- knowing about things it can derive or
Who is creator?
Solution Assign class B the
responsibility to create an instance of class A if one or more of the following
. B aggregates an object.
. B contains an object.
. B records instances of objects.
. B closely uses objects.
. B has the initializing data that will
be passed to A when it is created (thus B is an Expert with
respect to creating A).
B is a creator of an object.
If more than one option applies, prefer
a class B which aggregates or contains class A.
List out some scenarios that illustrate varying degrees of functional cohesion.
-Very low cohesion
Define Modular Design.
Coupling and cohesion are old principles
in software design; designing with objects does not imply ignoring
well-established fundamentals. Another of these. Which is strongly related to
coupling and cohesion? is to promote modular design.
What are the advantages of Factory objects?
-Separate the responsibility of complex
creation into cohesive helper objects.
- Hide potentially complex creation logic.
- Allow introduction of
performance-enhancing memory management strategies, such as object caching or
Designing for Non-Functional or Quality Requirements.
Interestingly—and this a key point in
software architecture—it is common that the large-scale themes, patterns, and
structures of the software architecture are shaped by the designs to resolve
the non-functional or quality requirements, rather than the basic business
Abstract for Factory (GoF) for Families of Related Objects.
The Java POS implementations will be
purchased from manufacturers.
// IBM's drivers
(implements jpos.CoinDispenser) // NCR's drivers
What is meant by Abstract Class Abstract Factory?
A common variation on Abstract Factory
is to create an abstract class factory that is accessed using the Singleton
pattern, reads from a system property to decide which of its subclass factories
to create, and then returns the appropriate subclass instance. This is used,
for example, in the Java libraries with the java.awt.Toolkit class, which is an
abstract class abstract factory for creating families of GUI widgets for
different operating system and GUI subsystems.
What is meant by Fine-Grained Classes?
Consider the creation of the Credit
Card, Drivers License, and Check software objects. Our first impulse might be
to record the data they hold simply in their related payment classes, and
eliminate such fine-grained classes. However, it is usually a more profitable
strategy to use them; they often end up providing useful behavior and being
reusable. For example, the Credit Card is a natural Expert on telling you its
credit company type (Visa, MasterCard, and so on). This behavior will turn out
to be necessary for our application.
The degree to which components depend on
one another. There are two types of coupling, "tight" and
"loose". Loose coupling is desirable for good software engineering
but tight coupling may be
necessary for maximum performance.
Coupling is increased when the data exchanged between components becomes larger
or more complex.
1. Explain Grasp: designing objects with
responsibilities. -Responsibilities and Methods (RDD)
-Responsibilities and Interaction
-creator -information expert -Low
2. Explain GRASP: Patterns of General
Principles in Assigning Responsibilities.
-The UML Class Diagram Notation
-Information Expert (or Expert) -Creator
-low coupling -high cohesion -controller
-object design and CRC CARDS
3. How to Determining the Visibility of
the Design Model?
-Visibility between Objects
Explain about Patterns for Assigning Responsibilities.
-Pure Fabrication -Indirection
Designing the Use-Case Realizations with GoF Design Patterns.
-Analysis" Discoveries during
Design: Domain Model -Factory
-Conclusion of the External Services
with Varying Interfaces Problem 3 -Strategy
-Composite -Facade –Adapter
consists of guidelines for assigning responsibility to classes and objects in
Creation of objects is one of the most
common activities in an object-oriented system.
Information Expert is a principle used
to determine where to delegate responsibilities.
Low dependency between classes
The Controller pattern assigns the
responsibility of dealing with system events
High cohesion means that the
responsibilities of a given element are strongly related and highly focused.
It defines the variation of behaviors.
A pure fabrication is a class that does
not represent a concept in the problem domain.
The Protected Variations pattern
protects elements from the variations on other elements
Creational design patterns are design
patterns that deal with object creation mechanisms.
Singleton pattern deals with situations
where only one instance of a class must be created.
The Factory Method pattern deals with
situations where at runtime one of several similar classes must be created.
Proxy pattern deals with situations
where you have a complex object or it takes a long time to create the object.
Decorator is a subclass.