madhavrao… » 2008 » February
GRASP stands for General Responsibility Assignment Software Patterns. It is used as guidelines for assigning responsibility to classes and objects in Object Oriented Design. GRASP describes fundamental principles of object design and responsibilities assignment, expressed as patterns.
There are nine patterns defined in GRASP
- Information Expert
- Creator
- High Cohesion
- Low Coupling
- Controller
- Polymorphism
- Indirection
- Pure Fabrication
- Protected Variance
Information Expert(221): Assign the responsibility to the information expert - the class that has the information necessary to fulfill the responsibility.
It answers following question in design:
- What is the general principle of assigning responsibility to objects?
Creator(226): Assign Class B the responsibility to create an instance of Class A if one or more of the following is true:
- B aggregates A objects
- B contains A objects
- B record instances of A objects
- B closely uses A objects
- B has the initializing data that will be passed to A when it is created.
It answers following question in design:
- Who should be responsible for creating a new instance of some class?
Low Coupling(229): Assign a responsibility so that coupling remains low.
It answers following question in design:
- How to support low dependency, low change impact and increased reuse?
To know more about coupling and types of coupling Click here
High Cohesion(232): Assign a responsibility so that cohesion remains high.
It answers following question in design:
- How to keep complexity manageable?
To know more about cohesion and types of cohesion Click here
Controller(237): Assign the responsibility for receiving or handling a system event message to a class representing one of the following choices:
- Represents the overall system, device, or subsystem (facade controller).
- Represents a use case scenario within which the system event occurs, often named <Use Case Name>Handler, <Use Case Name>Coordinator, or <Use Case Name>Session (use case or session controller)
It answers following question in design:
- Who should be responsible for handling an input system event?
Polymorphism(326): When related alternatives or behaviors vary by type (class), assign responsibility for the behavior - using polymorphic operations - to the type for which the behavior varies.
Corollary: Do not test for the type of an object and use conditional logic to perform varying alternatives based on type.
It answers following question in design:
- How to handle alternatives based on type?
- How to create pluggable software components?
Pure Fabrication(329):Assign a highly cohesive set of responsibilities to an artificial or convenience class that does not represents a problem domain concept - something made up to support high cohesion, low coupling and reuse.
It answers following question in design:
- What object should have responsibility, when you do not want to violate high cohesion and low coupling or other goals, but solutions offered by Expert are not appropriate?
Indirection(332): Assign the responsibility to an intermediate object to mediate between other components or services so that they are not directly coupled. The intermediary creates an indirection between the other components.
It answers following questions in design:
- Where to assign a responsibility, to avoid direct coupling between two (or more) things?
- How to de-couple objects so that low coupling is supported and reuse potential remains higher?
Protected Variations(334):Identify points of predicted variation or instability; assign responsibility to create a stable interface around them.
It answers following questions in design:
- How to design objects, sub-systems and systems, so that the variations or instability in these elements does not have un-desirable impact on other element?
Patterns of Enterprise Application Architecture
Martin Fowler’s Patterns of Enterprise Application Architecture, is classified as
- Domain Logic Patterns
- Data Source Architectural Patterns
- Object Relational Behavioral Patterns
- Object Relational Structural Patterns
- Object Relational Metadata Mapping Patterns
- Web Presentation Patterns
- Distribution Patterns
- Offline Concurrency Patterns
- Session State Patterns
- Base Patterns
Domain Logic Patterns
Domain Logic Patterns addresses how to implement domain layer (Business Layer). Its been separated into three primary patterns
- Transaction Script
- Domain Model
- Table Module
In case if we use Domain Model(116) or Table Module(125) Pattern than Domain Layer can be split in two. Service Layer(133) is placed over underlying Domain Model(116) or Table Module(125). This is not done with Transaction Script(110), since Transaction Script(110) isn’t complex enough to require a separate layer. Presentation Logic interacts with domain purely through Service Layer(133) which act as API for the application.
Transaction Script (110): Organizes business logic by procedures where each procedure handles a single request from the presentation.
Domain Model (116): An object model of the domain that incorporates both behavior and data.
Table Module (125): A single instance that handles the business logic for all rows in a database table or view.
Service Layer (133): Defines an application’s boundary with a layer of services that establishes a set of available operations and coordinates the application’s response in each operation.
Data Source Architectural Patterns
This pattern is further classified into:
- Table Data Gateway
- Row Data Gateway
- Active Record
- Data Mapper
Table Data Gateway(144): An object that acts as a Gateway(466) to a database table. One instance handles all the rows in a table.
Row Data Gateway(152): An object that acts as a Gateway(466) to a single record in a data source. There is one instance per row.
Active Record(160):An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.
Data Mapper(165): A layer of Mappers(473) that moves data between objects and a database while keeping them independent of each other and the mapper itself.
Object Relational Behavioral Patterns
This pattern is further classified into:
- Unit of Work
- Identity Map
- Lazy Load
Unit of Work(184): Maintains a list of objects affected by a business transaction and co-ordinates the writing out of changes and the resolution of concurrency problems.
Identity Map(195): Ensures that each object gets loaded only once by keeping every loaded object in a map. Looks up object using the map when referring to them.
Lazy Load(200): An object that doesn’t contain all of the data you need but knows how to get it.
Object Relational Structural Patterns
This pattern is further classified into:
- Identity Field
- Foreign Key Mapping
- Association Table Mapping
- Dependent Mapping
- Embedded Value
- Serializable LOB
- Single Table Inheritance
- Class Table Inheritance
- Concrete Table Inheritance
- Inheritance Mappers
Identity Field(216): Saves a database ID field in an object to maintain identity between an in-memory object and database row.
Foreign Key Mapping(236): Maps an association between objects to a foreign key reference between tables.
Association Table Mapping(248):Saves an association as a table which foreign keys to the tables they are linked by the association.
Dependent Mapping(262): Has one class perform the database mapping for a child class.
Embedded Value(268): Maps an object into several fields of another objects table.
Serializable LOB(272): Saves a graph of objects by serializing them into a single large object (LOB), which it stores into database field.
Single Table Inheritance(278):Represents an inheritance hierarchy of classes as a single table that has columns for all the fields of the various classes.
Class Table Inheritance(285): Represents an inheritance hierarchy of classes with one table of each class.
Concrete Table Inheritance(293): Represents an inheritance hierarchy of classes with one table per concrete class in the hierarchy.
Inheritance Mappers(302): A structure to organize database mappers that handle inheritance hierarchies.
Object Relational Metadata Mapping Patterns
This are further classified as:
- Metadata Mapping
- Query Object
- Repository
Metadata Mapping(306):Holds details of object-relational mapping in metadata.
Query Object(316): An object that represents a database query
Repository(322): Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.
Web Presentation Patterns
This are further classified as:
- Model View Controller
- Page Controller
- Front Controller
- Transform View
- Two Step View
- Application Controller
Model View Controller(330): Splits user interface interactions into three distinct roles. Model represents data, View represents presentation of data and controller handles Views events and co-ordinate with various services.
Page Controller(333): An object that handles a request for a specific page or action on a web site.
Front Controller(344): A controller that handles all request for a web site.
Transform View(350):Renders information into HTML by embedding markers in a HTML page.
Two Step View(365):Turns domain data into HTML in two steps: first by forming some kind of logical page, then rendering the logical page into HTML.
Application Controller(379): A centralized point for handling screen navigation and the flow of an application.
Distribution Patterns
This are further classified as:
- Remote Facade
- Data Transfer Object
Remote Facade(388): Provides a cross grained facade on fine-grained objects to improve efficiency over a network.
Data Transfer Object(401): An Object that carries data between processes in order to reduce number of method calls.
Offline Concurrency Patterns
This are further classified as:
- Optimistic Offline Lock
- Pessimistic Offline Lock
- Cross Grained Lock
- Implicit Lock
Optimistic Offline Lock(416): Prevents conflicts between concurrent business transactions by detecting a conflict and rolling back the transaction.
Pessimistic Offline Lock(426): Prevents conflicts between concurrent business transactions by allowing only one business transaction at a time to access data.
Cross Grained Lock(438): Locks a set of related objects with a single lock.
Implicit Lock(449): Allows framework or layer supertype code to acquire offline lock.
Session State Patterns
This are further classified as:
- Client Session State
- Server Session State
- Database Session State
Client Session State(456):Stores session state on client
Server Session State(458):Keeps the session state on a server system in a serialized form.
Database Session State(462): Stores session data as committed data in the database.
Base Patterns
This are further classified as:
- Gateway
- Mapper
- Layer Supertype
- Separated Interface
- Registry
- Value Object
- Money
- Special Case
- Plugin
- Service Stub
- Record Set
Gateway(466):An object that encapsulates access to external system or resource.
Mapper(473): An object that sets up a communication between two independent objects.
Layer Supertype(475):A type that acts as the supertype for all types in its layer.
Separated Interface(476):Defines an interface in a separate package from its implementation.
Registry(480): A well known object that other object can use to find common objects and services.
Value Object(486): A small simple object, like money or a date range, whose equality isn’t based on identity.
Money(488): Represents a monetary value.
Special Case(496): A subclass that provides special behavior for particular cases.
Plugin(499): Links classes during configuration rather than compilation.
Service Stub(504): Removes dependency upon problematic services during testing.
Record Set(508): An in memory representation of tabular data.
The Open Group Architecture Framework (TOGAF) is a framework - a detailed method and a set of supporting tools - for developing an enterprise architecture.
What is framework?
As per dictionary its
- A hypothetical description of a complex entity or process
- The underlying structure
- A structure supporting or containing something
As per context we are going to discuss, I would like to make it more specific as "set of tools" + "set of guidelines" + "set of best practices" + "set of process"
What is an enterprise?
An enterprise is an organization created for business ventures. An enterprise can be government agency, a whole corporation, a single department or chain of geographically distant organizations linked together with common ownership.
What is an architecture?
An architecture means structure. As per TOGAF architecture has two meanings depending its contextual use:
- A formal description of a system, or a detailed plan of the system at component level to guide its implementation
- The structure of components, their inter-relationships, and the principles and guidelines governing their design and evolution over time.
What is an architectural description?
An architectural description is a formal description of an information system, organized in a way that supports reasoning about the structural properties of the system. It defines the components or building blocks that make up the overall information system, and provides a plan from which products can be procured, and systems developed, that will work together to implement the overall system. It thus enables you to manage your overall IT investment in a way that meets the needs of your business.
What is an architectural framework?
An architectural framework is a tool which can be used for developing broad range of different architectures. It should
- describe a method for designing an information system in terms of a set of building blocks, and for showing how the building block fit together.
- contain a set of tool and provide common vocabulary.
- include set of recommended standards and compliant products that can be used to implement the building blocks.
What is an enterprise architecture?
Enterprise Architecture is the description of the current and/or future structure and behavior of an organization’s processes, information systems, personnel and organizational sub-units, aligned with the organization’s core goals and strategic direction. Although often associated strictly with information technology, it relates more broadly to the practice of business optimization in that it addresses business architecture, performance management, organizational structure and process architecture as well.
What is business architecture?
Wikipedia definition of business architecture is: The grouping of business functions and related business objects into clusters (“business domains”) over which meaningful accountability can be taken as depicted in the high level description of the related business processes
Business architecture is an architecture that structures the accountability over business activities prior to any further effort to structure individual aspects (process, data, functions, organization, system, application etc). It arranges accountability accountability around the most important business activities and economic activity in the domain. (This definition needs to be supported with heavy dose of explanation, will try some time later)
What is performance management?
Performance measurement is the process of assessing progress towards achieving predetermined goals. Performance Management is building on that process, adding relevant communication and the action on the progress achieved against these pre-determined goals. (One of the areas which is often ignored by most of the enterprises)
What is organizational structure?
The form of an organization that is evident in the way divisions, departments, functions, and people link together and interact. Organization structure reveals vertical operational responsibilities, and horizontal linkages, and may be represented by an organization chart. The complexity of an organization’s structure is often proportional to its size and its geographic dispersal. (Organization structure can be classified into different types. Will get into it some other time.)
What is process architecture?
Process architecture is the structural design of general process systems and applies to fields such as computers (software, hardware, networks, etc.), business processes (enterprise architecture, policy and procedures, logistics, project management, etc.), and any other process system of varying degrees of complexity.
While developing system, we often come across integration issues, when two systems interact. What are the possible ways two system can integrate? Lets try to understand same in this post.
Two system can integrate with each other
- to exchange data
- to consume service of one system, by other
To exchange data
Systems can integrate to exchange data in online or offline mode.
If its online mode, then its mainly by calling services of other system. What is most important in such scenario is how much loose coupling can be provided. Ideally, systems involved in such integration should have pre-defined endpoints/interfaces defined for integration. Any system, which satisfies this interface can be integrated with it. If system to be integrate do not satisfy this interface, then adapters can be developed to make it satisfy the required interface.
If system needs to integrate to exchange data, and if its to be done in offline mode, then its achieved by an application which is aware of both of this system. Purpose of this application is to extract data from source system in Batch Mode, do necessary conversion and supply it to destination system. Such applications are normally scheduled to run at specified time or event. Systems like BizTalk, SQL Server 2000 DTS, SQL Server 2005 System Integration Services can be used to accomplish this.
To consume service of one system, by other
Intention in such integration is to pass data, get it processed by another application to get finished output. Its often done, when accessing specialized feature like PDF creation, Document Type conversion. Very rare type of integration in Business application, often encountered in Product development.
Figure: Mind Map for Time Management
Everyone gets 24 hrs a day, but still not all are satisfied with it. Where do we loose time, how do we loose time, when do we loose time, how to manage our time. Do you have this questions in your mind, well there is a book which might help. I am been reading a book on Management by Omnibus, result of which is above mind map. Its beautiful book, which covers various topics like Time Management, Improving efficiency, Effective Decision Making, Successful Meetings. Actually there are series of books on this, and I am referring to "Management Pocketbooks - Management Omnibus Volume II". Currently I have just completed Time Management section of it.