Home > Guides > Programming > .NET and Windows Programming

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

Best Practices — Application Blocks

Last updated Oct 21, 2004.

When you get right down to it, most applications aren't all that different from one another. I know that statement is bordering on heresy, but it's true. It might seem like your Web-based homegrown CRM application is oh-so-different from the single-client recipe program you wrote for home use, but they share an astounding amount of common code. Both access a database. Both require some kind of user authentication (well, maybe). Both need to handle exceptions, log errors and significant events, save user profile information, and process user interface events. The processing details differ significantly, but all applications contain those and other basic parts. If you're paying attention while you're writing code (something that's not quite as common as you might think, considering the state of much software today), you'll find yourself writing very similar code to handle these common tasks in every program you build.

The introduction of (or, more correctly, the marketing of) design patterns in the mid-1990s created a small revolution in software development. Developers were encouraged to abstract their problems and recognize when the problem fit into one of the many defined design patterns. By thinking in terms of common patterns, developers were able more easily to apply knowledge and implementation experience gained from previous development efforts. Some people went a bit overboard with the whole patterns thing, but the same thing happened with structured programming, object-oriented design and development, relational DBMS, and every other technology. That doesn't invalidate the concept. Thinking in terms of design patterns has proven to be a very powerful and effective way to develop software.

Some patterns are so commonly used, and often in exactly in the same way, that they become more than just patterns. They evolve into common code libraries and are included in almost every project. This is nothing new: common code libraries have been around for almost as long as programming has existed. Every programmer has his own library of common code, as does every development shop. After all, once you've figured out a good way to perform a common task, it makes sense to formalize it and put it somewhere where others can use it.

That's what Microsoft's Application Blocks are: code libraries that ease implementation of common tasks. Accessing data, for example, is a very common task in today's applications. There are many, many different ways to access data, but over the years developers have learned that just a few of those ways are generally effective. The developers of the Data Access Application Block (DAAB) recognized the common database access patterns and abstracted them into a small, consistent interface that takes most of the drudgery out of database access. Compared to the amount of code required to access data through ADO.NET directly, using the DAAB is almost trivial. And because it's implemented in a separate class, it's very easy to use unmodified in many different applications.

Application blocks are focused, typically small, abstraction layers that ease and standardize implementation of of common tasks. They cover a wide range of programming problems, and other application blocks are under development. They implement one way, the recommended way, of providing common application services, and are based on input not only from Microsoft, but also users in the field who have learned the most effective ways performing these common tasks.

The following application blocks for .NET currently exist. Follow the links for more information about the individual application blocks.

Aggregation Application Block for .NET

Asynchronous Invocation Application Block for .NET

Authorization and Profile Application Block

Caching Application Block for .NET

Configuration Management Application Block for .NET

Data Access Application Block for .NET

Exception Management Application Block for .NET

Logging Application Block

Smart Client Offline Application Block

Updater Application Block for .NET

User Interface Process Application Block – Version 2.0

User Interface Process Application Block for .NET

All of these application blocks are supplied with source and examples, and all are free to download and use. If your application needs the services provided by an application block, you should seriously consider using the application block to implement it. Not only will it save you time, but it also will help to provide a standard programming infrastructure across companies—a useful thing when you're looking for .NET programmers, or even if you're a .NET programmer looking for a job.

Discussions

Copies of the array?
Posted Dec 23, 2008 03:40 PM by luige21
1 Replies
Hi
Posted Dec 5, 2008 05:10 AM by ajay2000bhushan
2 Replies
You have no clue.
Posted Jun 10, 2008 03:28 PM by theinternetmaster
1 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jim Mischel"Highly unlikely" does not mean "impossible"
By Jim MischelJuly 18, 2009 No Comments

One of my programs crashed the other day in a very unexpected place.  A call to System.Threading.ConcurrentQueue.TryDequeue (from the Parallel Extensions to .NET) resulted in an OverflowException being thrown.  Investigation revealed a pretty serious bug in the System.Random constructor.

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part II
By John TraenkenschuhMay 24, 2009 No Comments

In the last blog in this series, Traenk relates his first experiences with computers and with coding.  But now, some years have passed. . .

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part I
By John TraenkenschuhMay 24, 2009 No Comments

Traenk relates his past experience with Operating Systems that goes back 25 years, ok, more than that but he ain't tellin'

See More Blogs

Informit Network