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.
There are many Unit Testing Tools available for .Net Framework. This post will be updated with list of Unit Testing Tools as and when I come across any new tool and cover each of them in detail in separate posts
|
|
|
|
|
NUnit
Website: http://www.nunit.org/
Description: NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.4, is the fifth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages. It uses attributes to identify test cases, test fixtures and test suites.
dotUnit
Website: http://dotunit.sourceforge.net/
Description: dotunit is a port of JUnit (www.junit.org) to the Microsoft .net platform. It provides a testing framework to support automated testing of applications, particularly to facilitate unit, function and regression testing. It uses inheritance to identify, test cases, test fixtures and test suites. It also facilitates testing private members, methods.
csUnit
Website: http://www.csunit.org/
Description: csUnit is a free and open source unit testing tool for the .NET Framework. csUnit works with all .NET languages including C#, Visual Basic .NET, J#, and managed C++. It comes with a choice of command line, graphical user interface, and an add-in for Visual Studio.
MBUnit
Website: http://www.mbunit.com/
Description: MbUnit is advanced extensible unit testing framework. MbUnit offers all features that are available with NUnit and csUnit along with extensibility which is not available with them. It was initially named as GUnit, which was been changed to MbUnit to avoid clashing with another project. GUnit stands for Generative Unit Testing Framework
Zanebug
Website: http://www.adapdev.com/zanebug/
Description: Zanebug was developed to provide a unified platform for unit and integration testing. The current release addresses component-level unit testing, with a fair amount of development time focused on performance statistics and a flexible architecture. The long-term view for Zanebug is a tool that provides integrated component, form and web-based testing both locally and remotely with all the necessary performance information necessary for enterprise development.
NUnitLite
Website: http://www.nunitlite.com/
Description: NUniteLite is a lightweight testing framework for .NET, based on the ideas in NUnit and providing a subset of its features. It uses minimal resources and will run on resource-restricted platforms such as those used in embedded and mobile development.
MSTest
Website: http://msdn.microsoft.com/vstudio/teamsystem/
Description: MSTest is Microsoft Test Suite, which comes with Visual Studio Developer. It is available only with few edition of Visual Studio and is as good as NUint Test Suite. In fact Test Cases written for MSTest can be executed with NUnit, if they are been re-build by changing namespaces.
TypeMock
Website: http://www.typemock.com/
Description: TypeMock is a unit testing framework with object mocking ability. It simplifies task of writing unit test cases.
NDbUnit
Website: http://www.ndbunit.org/
Description: NDbUnit is a .NET library for putting a database into a known state. NDbUnit may be used to increase repeatability in unit tests that interact with a database by ensuring that the database’s state is consistent across execution of tests. NDbUnit does this by allowing the unit test to perform an operation on a dataset before or after the execution of a test, thus ensuring a consistent state. It is based on dbUnit
NUintAsp
Website: http://nunitasp.sourceforge.net/
Description: NUnitAsp is a tool for automatically testing ASP.NET web pages. It’s an extension to NUnit, a tool for test-driven development in .NET.
Rhino.Mocks
Website: http://www.ayende.com/projects/rhino-mocks.aspx
Description: A dynamic mock object framework for the .Net platform. It’s purpose is to ease testing by allowing the developer to create mock implementations of custom objects and verify the interactions using unit testing.
EasyMock.Net
Website: http://sourceforge.net/projects/easymocknet/
Description: EasyMock.NET is a class library that provides an easy way to use mock objects for given interfaces or remote objects. EasyMock.NET is a port of the EasyMock framework, which can be found for the Java(TM) platform.
NunitForms
Website: http://nunitforms.sourceforge.net/
Description: NUnitForms is an NUnit extension for unit and acceptance testing of Windows Forms applications. NUnitForms also provides a Recorder application that can record your interactions with a form and "write" a test for you that duplicates your actions. You can perform asserts during this process by right-clicking on your controls and selecting the property to assert. While not all of the testing functionality is currently supported by the recorder, it does provide a good way to familiarize yourself with the API and to demonstrate how testing is accomplished with NUnitForms.
.NetUnit
Website: http://sourceforge.net/projects/dotnetunit/
Description: An implementation of the XUnit testing framework designed specifically for unit testing components written for the .NET platform.
BizUnit
Website: http://www.codeplex.com/bizunit
Description: Test framework for automated testing, enables the rapid development of test cases, specifically targetted but not restricted to testing BizTalk solutions.
AspUnit
Website: http://aspunit.sourceforge.net/
Description: ASPUnit is a unit testing framework based on the architecture of JUnit, the current open source de facto standard for unit testing. ASPUnit is a web-based port of COMUnit using Active Server Pages. It is a VBScript implementation that has been tested to run on top of Microsoft Internet Information Server 5.0 or 5.1.
COMUnit
Website: http://comunit.sourceforge.net/
Description: COMUnit is a unit testing framework based on the architecture of JUnit, the de facto open source standard for creating unit tests. COMUnit is a Visual Basic port of the JUnit framework that is designed to facilitate developing unit tests for Microsoft COM components and Visual Basic applications.
NMock
Website: http://nmock.sourceforge.net/
Description: NMock is a dynamic mock object library for .NET. Mock objects make it easier to test single components—often single classes—without relying on real implementations of all of the other components. This means we can test just one class, rather than a whole tree of objects, and can pinpoint bugs much more clearly. Mock objects are often used during Test Driven Development.
NMock2
Website: http://sourceforge.net/projects/nmock2/
Description: NMock 2.0 is a library for assisting test driven development of C# code by providing a dynamic Mock Object framework.
XtUnit
Website: http://teamagile.com/mainpages/Downloads.html
Description: XtUnit is a unit testing extension for .Net based frameworks. It uses the interception application block to provide runtime abilities of rolling back any changes that were made to the database during Data related unit tests.
DotNetMock
Website: http://sourceforge.net/projects/dotnetmock/
Description: DotNetMock is a framework and a library to facilitate the use of MockObjects for unit testing on the .NET platform. It supports the creation of your own MockObjects as well as the dynamic creation of MockObjects. It supports almost any version of NUnit, and MbUnit. DotNetMock DynamicMocks can mock interfaces at runtime and can even modify ref/out parameters.