Analyzing Requirements and Defining Microsoft.NET Solution Architectures, Part IX...
Creating the Physical Design (Part B)
The aim of this series of articles is to provide an overview of issues surrounding the architecture of .NET Solutions. In doing so it is following Microsoft’s recommended approach and, in particular, looking at the requirements of the related Microsoft certification exam (70-300), which itself is one of the requirements for the MCSD .NET qualification. The main reference for this series of articles is the Que publication: 'Exam Cram2 .NET Solution Architectures'.
We’ve looked at the following thus far:
Article I: phase 1 of the process, the envisioning phase.
Article II: started on phase 2 (gathering and analysing requirements) focussing on business requirements.
Article III: continued with phase 2, focussing on user requirements and issues surrounding globalisation and localisation of your application.
Article IV: finished off phase 2, focussing on operational and infrastructure requirements
Article V: phase 3, developing specifications.
Article VI: phase 4, creating the conceptual design.
Article VII: phase 5, creating the logical design (application architecture).
Article VIII: phase 5, creating the logical design (logical data model)
In the last article, IX(A): we started looking issues surrounding phase 6, creating the physical design, which we'll continue now, in part B.
This is the code for the solution, containing constraints to support the business rules. You may decide to employ some or all of the following:
Looking at 1,3 and 4 in more detail:
Business ComponentsBusiness objects should be reused and methods accordingly broken apart whenever code might prove useful later. Business components can be tightly coupled or loosely coupled. The loosely coupled effect is achieved when implementing a workflow or service interface over the BSL. Business components should:
Consider whether you require transactional business services. If yes, look at Enterprise Services and consider the following:
Business entities are data representations of actual objects in your company. Typically, entities are representations of your database table structure, but they do not usually conform to one specific table. Instead, they are denormalised and represent a small entity schema. Often it is wise to design your business entities to be stateful objects containing a DataSet or an XML representation available throughout the object’s lifetime.
Business entities should access the database via the DAL, which handles cleanup and any special auditing features. Business entities are a low level entity view and are meant to be aggregated to perform specific functions; transactions are not recommended at this level. Business entity design recommendations include:
An example: business entities for an ecommerce site can consist of Order, Customer, Product etc. Shopping cart is not a business entity; rather it is a component because it aggregates the product customer and order entities to define the cart.
Business Service InterfacesBusiness service interfaces provide functionality to a remote caller via the BSL. Because the USL is being bypassed alternative security must be provided and only the required functionality should be exposed. Design capabilities for your service interface are:
Web Services are the most common way to implement a business service interface.
Network latency and bandwidthYour application's performance and reliability are heavily affected by your network infrastructure. In the business services layer in particular there are related opportunities for response times to dwindle.
Latency is the time taken for data to move from point A to point B. Bandwidth is a related, but different issue. Some best practices to avoid latency are:
The USL must provide precise events, validation and exception handling to facilitate the UI. The USL should call only the BSL (unless there isn’t one in your selected architecture). USL best practices include:
The presentation layer consists of UI components (UICs) and UI process components (UPCs). UICs are simple interfaces that enable users to interact with the application. UPCs are similar to UICs but they follow a process. They are common in wizard type functionality.
UI examples include Web forms, Windows forms, console apps, mobile forms or any combination thereof. Considering each in turn:
Windows Forms are a good choice for offline applications; they manage intense state or access to client system resources that might require administrative privileges. Not intended for Intranet/ Internet-based applications (though be an appropriate choice in certain scenarios), but are ideal for distributable software applications where the processing is implemented in part or in full on the client side. Windows forms are stateful and can provide multiple forms simultaneously.
They can be used as full-blown desktop UIs, embedded HTML or as an application plugin. They can also be run over the Internet similar to ActiveX controls and Java applets as long as the .NET Framework is installed on the client.
Best practice:Web Forms provide an excellent platform for developing Internet and intranet applications that scale to platforms .NET does not support. The web is a stateless medium but ASP.NET offers state management and caching features. Recommendations are:
ASP.NET also provides an extensive framework for globalisation. Though the use of satellite assemblies, ASP.NET can change the content depending on the user’s language and culture preferences.
Mobile devices became easier to develop for with the introduction of the mobile Internet toolkit. Mobile controls request the device type and then automatically convert the tags to render properly in the calling device. Some points of note:
The User service facade is typically .NET classes that can be called or inherited from that provide the UI for your site, e.g. an extended datagrid.
Caching result sets and reference based objects can significantly improve performance. The Cache object has application scope and can be access programmatically or is available as page caching and fragment caching of page parts.
Enterprise thin-client applications serving a substantial number of concurrent users usually implement a web farm architecture. Particularly important then is security. As well as using SSL, best practice is to implement a firewall between the Internet, the USL, BSL and database server(s). This practice puts the USL and BSL in a demilitarised zone (DMZ), where they are outside the company firewall but have an open port into the network. Solutions that implement business logic on a machine separate from UI logic should implement this DMZ, which allows for a 3-layer firewall approach. Solutions that implement business logic and UI logic on the same physical machine can still implement a 2-layer firewall.
Your data source may be a data service or service agent (Web Service).
Data access components must be built to perform specific communication with the data source and provide a consistent interface for business services. They are typically stateless and simply abstract the obscurities of the underlying data source. Each data access component should access a maximum of one data store for the purpose of maintainability. If stored procedures are available, they should be used.
Some physical design considerations:
Service agents may be Web Services, remotable components or abstract APIs. The DAL should encapsulate the agent's underlying obscurities. Data access components that call service agents can also carry out the following additional functionality:
Several options exist: ViewState, hidden fields, querystring, cookies, application state, session state, database sessions.
That concludes our overview of issues involved in the physical design per se. However, in the next article we’ll look at the related and critical issues of deployment and maintenance.
Exam Cram 2 .NET Solution Architectures
Cornish et al.
Que
http://msdn.microsoft.com/architecture/