web 2.0

Application Architecture Guide

Patterns and practices logo Patterns&Practices team released the second version of .NET Application Architecture Guide, which provides guidance for architecture principles, design principles and trusted patterns.

It helps developers and architects to build more effective, high quality .NET applications.

It is also a good overview of software architecture for students.

Read .NET Application Architecture Guide PDF (on MSDN)

Unit Testing of Silverlight LoB Applications

Book cover

Book cover

Unit testing has become rather important in the last decade as the need for quality code increased. It is also an essential part of Test-Driven Design which is a part of Extreme Programming.

Probably the most common approach to do unit testing in .NET solutions is by creating special Tests projects in a pair to the library we want to test and perform the testing in NUnit . In Silverlight projects we would like to test the business domain logic on the server and the ViewModel classes on the Silverlight client side.

If you haven’t ever used unit testing read an excellent book The Art of Unit Testing with examples in C# which will guide through both the theory of unit testing and practical examples. There were also a presentation of Developing Testable Silverlight Application at the Microsoft PDC conference.

Note: I plan to enlarge this article later with a real example of Testable Silverlight Application.

Domain-driven design books

Domain model is a pattern for an object-oriented approach for organizing business logic.
Let me introduce you 2 books which deal with this pattern, previously briefly described in the P of EAA book written by Martin Fowler.

Domain-driven design

Domain-driven design

Domain-Driven Design: Tackling Complexity in the Heart of Software

The book offers readers a systematic approach to domain-driven design, presenting an extensive set of design best practices, experience-based techniques, and fundamental principles that facilitate the development of software projects facing complex domains. Intertwining design and development practice, this book incorporates numerous examples based on actual projects to illustrate the application of domain-driven design to real-world software development.

from the back cover


Applying DDD and patterns

Applying DDD

Applying Domain-Driven Design and Patterns: With Examples in C# and .NET

Applying Domain-Driven Design and Patterns is the first complete, practical guide to leveraging patterns, domain-driven design, and test-driven development in .NET environments. Drawing on seminal work by Martin Fowler and Eric Evans, Jimmy Nilsson shows how to customize real-world architectures for any .NET application. You’ll learn how to prepare domain models for application infrastructure; support business rules; provide persistence support; plan for the presentation layer and UI testing; and design for service orientation or aspect orientation.

description of the book at Amazon

Enable associated entities to load with base entity

Associated entitites I encoutered a problem, when I wanted to load Employees entities also with some associated entities at once, from the well-known AdwentureWorks database model (in Entity Framework) via DomainService/Context in a .NET RIA Services SL Application.

So if you encountered the same problem, that initially your associated/referenced entities are null when loaded, read more to see how to solve this issue.

Continue reading »

Localization of Silverlight Business Application (sample)

Illustration

Illustration

Although it looks that localization of Silverlight Business Applications is not worth of writing a post, there are some really inconspicuous problems which you have to resolve.

If you want to localize the application by creating resource files of strings for a particual language (AppStrings.sk-SK.resx, AppString.de-DE.resx) you should definitely read this post (with sample source-code) to not get into trouble.

Continue reading »

MVVM Architectural Pattern

MVVM pattern

MVVM pattern

MVVM which stands for Model-View-ViewModel is a relatively new pattern supporting development of WPF and Silverlight Applications.
It is  based on well-known MVC and MVP patterns, but it is actually adapted to take the advantage of data binding in WPF.

I started to look for appropriate architectural pattern for Large Silverlight LOB Applications and I was wondering if I can rely on MVC.
Then I found out, that there is already a design pattern targeted at modern UI development platforms called Model-View-ViewModel, introduced by John Gossman in 2005.

It is actually a Martin Fowler’s PresentationModel design pattern adjusted for WPF & Silverlight.
Continue reading »

Silverlight Application: Google Search (updated)

This application uses Google Search API and behaves like Internet Search Application with option to preview desired page in web browser directly in this application.

Layout

Layout

Out of Browser

Out of Browser

Installation

Installation


Read more to get know how I built it and download the source code.
Update: The project was published on CodePlex: slgooglesearch.codeplex.com

Continue reading »

The most useful Silverlight & RIA services blogs

I’m subscribed to a few blogs which are really good sources of samples, articles and news about our topic.
Scan my list to see if you would find useful resources there, too.

Brad Abrams blog – Design Guidelines, Managed code and the .NET Framework (RIA Services articles)

Tim Heuer blog – My favourite source for most up-to-date Silverlight articles (RIA Services articles)

Laurent Duveau – Really a lot of examples of new Silverlight features

Jeff Prosise blog – Well written blog mainly about Silverlight

Shawn Wildermuth – Professional articles about architecture & patterns, MEF, MVVM

SilverlightShow.net – Although it’s not a pure blog, it is an ultimate source of the most important articles.

If you know about another useful blog not mentioned here let me know…

WCF RIA Services Facebook Group

I created a new facebook group WCF RIA Services because I haven’t found any other group specially discussing Silverlight, RIA Applications, etc.
So if you are an Experienced Microsoft .NET developer interested in RIA and Enterprise applications feel free to join our facebook group and share your news and knowledge with others.

Domain Model

Decoration

Decoration

A better pattern for business logic layer.

Let me to introduce you the 3 base patterns to organize your domain logic: Transaction Script, Domain Model and Table Module.

Transaction Script
Organizes business logic by transactions. Logic for each of the CRUD operations and other business logic over data is encapsulated in one transaction script. So every transaction is a unique procedure which handles a single request from the presentation. These transactions usually do direct calls to the database like Stored procedures calls or Dynamic SQL queries.

Domain Model
An object model, which describes entities and relations between them in the domain. It’s one of the key aspects of Domain Driven Design.

Table Module
A single instance that handles the business logic for all rows in a database table or view.

For object-oriented programmers the Domain Model pattern would be the best understandable pattern, altgough many of them are still getting in touch mainly with the first Transaction Script pattern.

This article is about how Domain Model works, how to use it and how to implement it.
Continue reading »

Previous Entries