Wednesday, November 25, 2009

[Architecture] Microsoft Application Architecture Guide 2nd Edition now available

The second edition of Microsoft’s Guide on Architecture by “patterns & practices”, that was also presented during TechED 2009, is now available for download as PDF and online as HTML version. There is even a printed version that you can buy at Amazon.

MSArchitectureGuide

The guide covers all current architecture styles and serves as “Map” to help us in our architectural decisions from a Microsoft point of view. It has changed since the last versions that were available on CodePlex.  Meaning that a review is also interesting for people, that already know and use the guide in their daily work.

The guide helps you to:

  • Understand the underlying architecture and design principles and patterns for developing successful solutions on the Microsoft platform and the .NET Framework.
  • Identify appropriate strategies and design patterns that will help you design your solution's layers, components, and services.
  • Identify and address the key engineering decision points for your solution.
  • Identify and address the key quality attributes and crosscutting concerns for your solution.
  • Create a candidate baseline architecture for your solution.
  • Choose the right technologies for your solution.
  • Identify patterns & practices solution assets and further guidance that will help you to implement your solution.

In my opinion it is a useful guide that does a good job in presentation all the rich possibilities of today's architecture and project solutions to customer problems. The first chapters also serve as an introduction to software architecture.

If you are interested in architecture and working in the Microsoft environment I highly advise you to take a look and integrate it into your architectural decision making.

Here are the links to the different versions of the guide: 


Share/Save/Bookmark

Monday, November 23, 2009

[Tutorial] How to use Layer Diagrams in Visual Studio 2010 for Architecture Validation Part 4

Last time we defined layers in our Layer Diagram and added projects and folders. We validated the architecture and saw that there were errors. You might already have guessed it but the explanation is, that the Layer Diagram just does not reflect the real architecture inside the source code of our example project.

Two Choices: Change Source or Diagram

We now have two choices: either we have carefully designed our layers and the errors show that the source code is not compliant, in which case we would have to change the source code, or we decide to change the layer definitions (what we will be doing for our example).

One of the really strong parts of Layer Diagrams is that they help to understand source code from a very high point of view. Imagine trying to understand the source code structure without having any documentation and just the source code. This was a time consuming task without the help of Layer Diagrams but will completely change as of today with Visual Studio 2010.

Change the Layer Diagram

Ok lets change the Layer Diagram and see what the real code structure looks like in terms of layers.

  • Open the Source Code and the Layer Diagram and validate the Architecture
  • Double click on the first error and you see that there are references to Business Objects (ex: ExpenseCategory) in the Presentation Layer projects

Archi_Layer_Validation18

  • Add a new dependency between the Presentation Layer and the Business Layer

Archi_Layer_Validation19

  • Re-validate the architecture and you see that there are still 29 errors, this time there seems to be dependencies inside the Data Layer that are causing the problem

Archi_Layer_Validation20

  • Since the Data Layer also uses Business Objects from the Business Layer we need to change the dependency from a one-way to a bidirectional dependency

Archi_Layer_Validation21

  • Re-validate the architecture and you see that there are still 2 errors, this time there seems to be dependencies inside the Business Layer that are causing the problem

Archi_Layer_Validation22

  • Since the Business Layer also uses interfaces and declarations from the Service Layer we need to change the dependency from a one-way to a bidirectional dependency

Archi_Layer_Validation23

  • Re-validate the architecture and you see that there are no more errors, we finally have a Layer Diagram that perfectly reflects the code structure of the source code

Archi_Layer_Validation24

Summary

We saw how to use the Architecture Explorer and the Layer Diagram to build a layer structure that matches existing code or that may serve to assure, that new projects start and stay with a healthy design. We saw how to validate manually if the layer constraints are fulfilled or broken and how to fix problems.

You may even add the Architecture Validation to your build and check-in scripts in TFS. Thus automating the verification and assuring that your projects retain the initial design that your architects designed carefully.


Share/Save/Bookmark

[Tutorial] How to use Layer Diagrams in Visual Studio 2010 for Architecture Validation Part 3

In the last part we added a Layer Diagram, created some layers and added references to all projects within the example project. This time I will show you how to append projects namespaces or even classes  to the different layers using a new tool called Architecture Explorer. I will then show you how to validate you project based on the layer relations.

Using the Architecture Explorer

The Architecture Explorer is a new tool inside Visual Studio 2010. It serves to understand code structure and to interact with different elements in your code (namespaces, classes, methods, etc…). You can use the Class View or the Solution View to filter and  see what is inside your solution.

  • Open the Architecture Explorer (activate it from the menu if you do not see it in your IDE)
  • Click on Solution View, you will see the different folders and the new Architecture project in the window
  • Click on the Business folder and you will its containing projects

Archi_Layer_Validation12

Defining content in Layers

  • Open the Layer Diagram you created in the last part of the series
  • Display the Layer Diagram and Architecture Explorer
  • Select the contents of the Business folder (5 projects)

Archi_Layer_Validation15

  • Drag and drop them from the Architecture Explorer onto the Business Layer in the Layer Diagram
  • Do the same for all other layers (I added the Hosts & UI projects to the Presentation Layer)

Archi_Layer_Validation13

  • The layers now contain numbers on the leftmost edge, these numbers represent how many projects are contained by the layer (if you added namespaces it would be the number of namespaces, etc…)

Archi_Layer_Validation14

Validating the Architecture

  • Do a right click on the Layer Diagram to open the context menu, you will see the option to validate the architecture

Archi_Layer_Validation16

  • Validate the Architecture, a new screen will pop up and the validations starts

Archi_Layer_Validation17

  • At the end of the validation you will see a report that either says that everything was successful or that there were errors

Validation Errors (a good thing!)

  • In our case we will get 114 errors with the information “AV001: Invalid Dependency …”
  • This means that the source code does not adhere to the architecture design that was defined in the Layer Diagram

Archi_Layer_Validation18

  • If you double click on the first error it will take you to the line of code that generated the validation exception, you may now analyze the source of the problem

You might already know why this doesn’t work, anyways stay tuned until the next article, where I explain in detail what happened and what needs to be done next.


Share/Save/Bookmark

Friday, November 20, 2009

[Tutorial] How to use Layer Diagrams in Visual Studio 2010 for Architecture Validation Part 2

In this part of the series we will create the Modeling Project and the Layer Diagram that will later be used for the Architecture Validation of the example project that was introduced in the last article.

Add Modeling Project and Layer Diagram

  • Add a new project of type Modeling Project

Archi_Layer_Validation5

  • Add a new diagram of type Layer Diagram within the new Modeling Project

Archi_Layer_Validation6

  • Add 4 layers to the Layer Diagram and name them Presentation Layer, Service Layer, Business Layer and Data Layer
  • Connect each layer using a simple arrow and give each layer a different color in their properties

Archi_Layer_Validation9Archi_Layer_Validation8

  • You should now have 16 projects including the new Modeling Project with the Layer Diagram

Archi_Layer_Validation10

  • Add references into the Modeling Project from all other projects, so you will be able to access their namespaces and classes in the next parts of the tutorial

Archi_Layer_Validation11


Share/Save/Bookmark

[Tutorial] How to use Layer Diagrams in Visual Studio 2010 for Architecture Validation Part 1

Visual Studio 2010 includes many new features for architects including Layer Diagrams and Architecture Validation. Architects may use Layer Diagrams to either build a new system from scratch and assure its coherence or understand and validate existing systems. The following series of articles will show how to use these new features. You will see how powerful they can become to assure good design - and that it is really easy to do!

CodePlex Example Project

I searched on CodePlex for a good example of an application that has a Layered Architecture. I found ExpenseSample-V3.5, which is very well adapted. This project is written in .NET 3.5 and is based on the following architecture as described in the CodePlex documentation.

LayerSample-App-Arch-Diagram-Jan-2009

Since this is a .NET 3.5 project it should be converted to .NET 4.0, which is done by using the built in wizard. The project converts very well and there are no errors.

Archi_Layer_Validation1Archi_Layer_Validation2

When opening the solution you will find 15 projects that are divided into different layers (Business, Data, Hosts, Services, UI).

Archi_Layer_Validation3

To assure that the application still works after the .NET 4.0 conversion, we need to build it. The build also works without any errors, which means that everything is in place for the next steps of the tutorial.

Archi_Layer_Validation4


Share/Save/Bookmark

Wednesday, November 18, 2009

[Silverlight] Silverlight 4 Beta is Now Available

Scott Guthrie announced today at PDC that Silverlight 4 Beta is now available for testing purposes. These are very interesting news for all RIA developers out there.

Here are some of the new functionalities in Silverlight 4:
  • Out-of-browser capability enhancements for a high quality experience
  • Access to SharePoint 2010, Office, and IIS
  • HD-quality video experiences on the Web with native multicast and offline DRM support
  • Printing capabilities (print directly from within Silverlight)
  • Usage of WebCams and Microphones will be possible
  • Assembly sharing between .Net and Silverlight assemblies
  • etc...
You can get more information using the following links:

Share/Save/Bookmark

[VS 2010 - UML] Sequence Diagram Code Generation is not possible

In Visual Studio 2010 it will not be possible to create a new UML Sequence Diagram from scratch and then generate code from it. Sequence Diagrams will only be used for representation and modeling purposes.

The Sequence Diagram generation is a one-way operation. Meaning that even if you generated a Sequence Diagram from existing code and changed it you will not have the possibility to generate the code that reflects your changes. You will have to do it manually at the moment.

Furthermore there is not possibility to activate debugging in Sequence Diagram mode, which would be a very handy feature for the future.
Share/Save/Bookmark

[VS 2010 - UML] UML Model and Architecture Diagrams Viewer

Creation and modification of UML models and Architecture Diagrams will only be possible from within Visual Studio 2010 Ultimate. But developers will be able to open them in Viewer mode from within all other versions of Visual Studio 2010.
Share/Save/Bookmark

[Event] Microsoft Model Driven Days

Just a little reminder that this years “Microsoft Model Driven Days” will be Thursday 26/11/2009. This is a very interesting event on UML, MDA, SOA and similar subjects. A must for architects and developers that are interested by modeling. I will be attending and will be looking forward to see new faces.

The event is free of charge! So if you have the time register yourself(!) and come to the event. 

You can get further information on http://www.mdday.fr/.
image
Share/Save/Bookmark

Tuesday, November 17, 2009

[UML] OMG-Certified UML Professional Fundamental Exam (OMG-OCUP-100) Preparation Slides

The following slides greatly help for the preparation of the OMG-OCUP-100: OMG-Certified UML Professional Fundamental Exam. They contain all necessary information for passing the certification and can be used in combination with the certification guide.






Share/Save/Bookmark

Thursday, November 12, 2009

[Event] TechED 2009 – Experience Summary

Last Sunday I arrived at the TechEd 2009 in Berlin and registered in the evening. There were many people from all over Europe and even Speakers from the US. About 736 Sessions for over 7000 people were announced. What an event, the week promised to be awesome!

I did 4-5 session per day and also tried to do as much Hands-On-Labs and Interactive Discussions as possible. When I got a possibility to talk to Microsoft collaborators on upcoming technologies I did it!

I attended at sessions on Architecture, WCF 4.0, WIF, Dublin, Parallel Programming, SQL Azure and Visual Studio 2010 and many others. An enormous amount of news was given to the audience and I was very excited of what was presented.

WCF 4.0 will not have major updates but will get default bindings, default behaviors and standard endpoints that will make configuration in most cases much easier. There will be new protocol mappings, a whole new routing mechanism (!!!) and new ad-hoc service discovery features that make it possible to detect services on the network automatically. It will be possible to configure the content-type of the service return format (xml, text, json, atom, etc...).

The Geneva project, that will rewrite history for security handling in application, was renamed to WIF (Windows Identity Foundation). This new claims based approach decouples security handling and management from application development. It works via Tickets that are delivered via an STS (Security Token Service). Cardspace 2.0 will be used to provide users with the possibility to select an identity.

WIF is the framework that is used inside applications for being able to use Tickets and recover claims that are important for them. Finally an abstraction layer for security, something that will make application development much easier and security handling much more flexible!

Dublin, which was renamed to "AppFabric", will provide a new hosting environment for WCF. Some extensions to IIS were shown, that add for example, a new management Dashboard that greatly aids in managing WF 4.0 Workflows and WCF services. WCF 4.0 in conjunction with Dublin will really provide a whole new experience and will be a good alternative for BizTalk in many use cases. Definitely worth looking into it when it will be shipped!

The new Parallel Programming features in .NET 4.0 will make it much easier to get the most out of multi-core machines. In most cases you just have to identify the parts of the application that may be parallelized and use Tasks, PLINQ and the TPL (Task Parallel Library) to optimize for parallel processing. Thread optimization and complicated algorithms will rarely be necessary. There are many new features in Visual Studio 2010 that further aid the developer to master parallel development (Thread/Tasks can be separately debugged and profiled, Performance analysis can be done, etc...).

SQL Azure will be a relational database in the Cloud that can be used together with Windows Azure or client applications on client servers. The experience is seamless and you really see no difference inside your applications. You even can use SQL Server Management Studio (in a new version that can be found here) to manage your online databases. Your databases can have a size be up to 10 GB and the same on-a-use based payment model is applied as with Windows Azure ($9.99 and $19.99 payment plans).

And I could go on and on. This was really an amazing event and I am very happy that Winwise sent me to it. I would love to get into more detail on all the new features, so just contact me if you want additional information.
Share/Save/Bookmark

Wednesday, November 11, 2009

[WIF] TechED 2009 – Windows Identity Foundation, Cardspace 2.0, ADFS 2.0

The new claims based security abstraction layer (before project “Geneva”) was presented. It will likely change how applications implement security handling in the future.

Until now when you developed your application, you had to decide during development time what security approach you wanted to support.  Then your application was more or less coupled to the security implementation.

Changing your application from a Windows to a Web application could mean re-developing the whole security handling (recovery of rights and verification, etc…) for example.

New WIF Security Abstraction Layer

This is about to change considerately with Windows Identity Foundation (WIF), Cardspace 2.0 and ADFS 2.0 or any other provider that can act as STS.

Applications will not mind anymore from where security is coming. In fact they won’t know anymore. They will just know what rights – or better what claims they need and who they trust. It will be the responsibility of the Security Token Service (STS) provider to recover claims and sending them to requesting applications.

P1000382 P1000383
Security will be decoupled completely form application development in this scenario. And it is very easy to do!
The WIF API will provide all functions and objects, that are necessary to do the implementations in your applications. You may change your security configuration by modifying the application configuration file (like for WCF) and changes will be immediate even in production environments.

Claim Recovery Example

Here is an example of how to recover a claim (ex: “age”) that the application needs for security verification (note the usage of LINQ in this context).

P1000384

Visual Studio 2010 Tooling Support

Visual Studio 2010 will provide the tools necessary to make this as easy as possible. There will wizards that greatly help configuring your applications. You may even have a local simulated STS implementation that can be used during development (not everyone has a fully configured STS at hand).

P1000385P1000370P1000372 P1000373

ASP.NET & WCF Integration

With WIF authorization and security handling will provide more flexibility and will allow more complex scenarios.

P1000394 P1000395

Summary

The new security concept that will be provided by WIF will really change how application security will be built. There are already Hands-On-Labs and documentations on WIF and I encourage you to further “dive” into the subject. I for my part will closely follow the next releases and can’t wait to see the final product.

P1000413P1000411
Share/Save/Bookmark

Tuesday, November 10, 2009

[Parallel Programming] TechED 2009 – Parallel Programming in .NET 4.0

There are many new features in .NET 4.0 concerning Parallel Programming such as Tasks, PLINQ, Coordination Structures and many more. Most of these were also presented during the session at the TechED.

P1000295
  • Tasks make it much easier to cope with parallel processing optimizations since they add an abstraction layer. Complicated thread programming is not necessary anymore.
P1000301
  • Parallel LINQ (PLINQ) is a very easy way to add parallelism to your applications since you just have to add knobs to the LINQ expression and the processing is automatically parallelized.
P1000299
  • Task Parallel Library (TPL) provides APIs, structures and objects for parallel programming
P1000314
  • Coordination Structures can then be use inside and outside the code that is parallelized to assure that the processing is correctly done.
P1000315
  • Visual Studio 2010 will include parallel debugging and tracing and many other feature for parallel programming. Here an example of a parallel stack diagram.
P1000312
Share/Save/Bookmark

[AppFabric] TechED 2009 – Project “Dublin” now "AppFabric"

The session on Project “Dublin” (now called "AppFabric") was very interesting. It clearly is an alternative to BizTalk and might just be the right solutions to many business needs. It should ship until the second semester of 2010.
 P1000285P1000278
There are nice extensions to IIS that allow managing & analyzing WCF services in a common Dashboard that is very BizTalk like. From this new dashboard you see what your WCF services are doing and if they are suspended or in Error state.

AppFabric will provide very useful features and is in conjunction with WF 4.0 a very powerful new offer. 

P1000286P1000287
Share/Save/Bookmark

[Architecture] TechED 2009 – Architecture Talk
Command Query Responsibility Segregation

The architecture talk of Udi Dohan,  SOA Specialist and Mastermind behind NServiceBus, was centered around current architecture layer schemes and real life scenarios and new ways of solving customer needs.

I really liked his talk and admit that he made me think critically on our current architecture approaches. This was by far the best architecture talk on TechED 2009. There were so many interesting ideas and concepts. This article sums them up.

Current n-tier Architecture Weaknesses

Software development is all about helping customers to solve problems and/or do some work. It only serves for something if there are added values and if the user intents were correctly discovered and satisfied. Udi stated that the current n-tier approach may not always provide the best way to achieve this goal.

Developers spend most of their time on building software infrastructures instead of concentrating on solving user needs. By having all these different layers in a n-tier architecture there is also the need for transforming data between them. This transformation makes maintainability and extensibility much more complicated.

P1000320
Much overhead is added for data transformations. Functionalities that the user will not see in the end and that will cost performance (nothing is for free). No added value! The user is just interested in the final result – the application that he uses to achieve his goals.

If the application is not doing what the user needs than he will not be happy with it, even if the underlying architecture was from a technical point of view “perfectly” designed.

P1000322
That is why we need to break free from our current thinking and try to approach problems in another manner. Ideally the goal of software architecture is to come up with simple solutions for complex problems.

Udi presented a more simple way of displaying read only data in the UI (which is a use case that does not apply to all user needs but sometimes it is just what needs to be done). Let the UI have a direct connection to the “Persitent View Model” (in other words have a view in the DB for each view in the UI).

P1000326
By doing it like this all intermediary steps are suppressed and when there is a change only the UI Layer and the corresponding views are affected. Simpler, easier to maintain and providing better performance! A win on each level!

This is not possible for all application scenarios but if possible it should be considered when designing application architectures.

Validation and Business Rules

The next topic concerned the separation of Validation and Business Rules: What is covered by Validation and what needs to be done in Business Rules? Udi provided a good explication, that says that Validation should be done upfront to assure that the input is correct (and only that). Business Rules apply to a combination of system states and business logic. They decide if the treatment must be continued or aborted.

P1000332

Command Processing Layer Approach

If we consider a new layer approach that handles commands we could describe the different layers and their interaction as follows.

P1000333 P1000335

Capturing User Intent

Udi gave an example of how to capture user intents and how to architecture the system that fulfills the user needs. He took an example of a ticket reservation system for a football stadium and how the IT system was built to satisfy the users.

P1000342 P1000343
The user enters his needs into the system and gives information of what is acceptable (ex: 4 places together in a group, seat type, etc…). The systems then searches asynchronously if the user needs can be satisfied and alerts the user via email when it has finished (it either finds the places and reserves them or it doesn’t). Less frustrations for the user since it is the system that finds the places and reserves them (in fact working like an agent).

P1000350

Summary

By using the Command Query Responsibility Segregation Principle that he introduced and having an asynchronous approach the system is more scalable, easier to maintain – and for the user – easier to use and understand.

P1000351 P1000352
Share/Save/Bookmark