Some more fun with Visual Studio 2010 – Part II

In last post we saw few good enhancements in VS 2010. In this post we will explore some exciting new capabilities for Architects in Visual Studio 2010 Ultimate.

If you are using Visual Studio 2010 Ultimate, you will notice Architecture Menu on top. This menu gives architects plenty of options, from modeling their solutions to generating dependencies among your existing projects and the best part of it is that it allows you to even validate your code based on model diagram (H). BUT! for today! We will cover “Generate Dependency Graph” feature in this post.

The primary advantage of generating dependency graph is to visualize your existing software. This is particularly important in scenarios where you are working in an existing software and want to dig dependencies among assemblies/namespaces/classes etc. We know one thing that software are becoming more complex with time and therefore we need better tools and technologies to understand those complex software solutions.

So lets go ahead and give this feature a try!

If we select the option of Generate Dependency Graph –> By Assembly, after few seconds of processing it will show you some kind of web 🙂

dependency graph

The lines depicts the dependency of one assembly to another and the bold lines shows higher number of references or more dependency on other assembly. You can also expand or collapse these assemblies. Interestingly if you double click on any line (representing reference and dependency), It will gives you further option to select the level of detail between two assemblies as shown in image below:

If we select to include Assemblies and Methods , then it will show detail level diagram with assembly containing Methods and their dependency on other assembly’s methods. Cool isn’t it? 🙂

So if you are working on an existing software and you want to understand the code and interaction of different projects and classes, this feature is a real blessing for you 🙂

Practical Enterprise Application Development

This week I presented a session to my team at Telenor Pakistan that was related to Enterprise Architecture, Design and some good design principles. Since I like these stuff and I got request as well, I would like to share the slides with you all 🙂

Enjoy!

References:

Book Review: Professional Enterprise .NET – Wrox

Professional Enterprise .NET Cover

Book Title: Professional Enterprise .NET
Authors: Jon Arking and Scott Millet
Publisher: Wrox

I must say one of the best book I have read on Enterprise Design and Code. The author did very well in explaining how to write flexible, extensible code. If you are a mid level .NET developer and you are curious enough to think about more flexible, testable and extensible applications, you will definitely love this book.

This book covers some of the very exciting topics such as Separation of Concerns, Flexibility, Reusability, Unit Testing, Test Driven Development, Inversion of Control, Domain-Driven, Data access layer, Model-View Presenter, Model-View-Controller. Although it may sounds dry but the author did a great job in keeping me stick to the book. After so many time, this was the book which kept me reading it until i finished it.

The book started with the discussion on What is Enterprise Architecture and Development? Then with an example of Mortgage Loan sample application, the author have applied above mention topics and concepts.

You can also download code of this book from codeplex site.

All in all, I think that it’s worth investing time and money on this book and it’s really a comprehensive guide to the latest enterprise development patterns and methodologies that will make your code cleaner and maintainable.

WCF Binding Selection

Windows Communication Foundation(WCF) Services exposes endpoint(s) and each endpoint has information of ABC i.e. Address, Binding and Contract.

Binding defines the underlying protocol, message encoding and transport details which are essential for client and service to communicate with each other. WCF provides several pre-configured bindings having different protocols, encoding scheme etc. Further these bindings can be customized. For details, visit “Windows Communication Foundation Bindings” at MSDN.

The WCF ships with the following pre-configured bindings:

Binding

Description

basicHttpBinding

This interoperable binding is commonly used as a replacement for earlier Web services based on ASMX (Active Server Methods). It supports Hypertext Transfer Protocol (HTTP) and Hypertext Transfer Protocol over SSL (HTTPS) transport protocols as well as text and Message Transmission Optimization Mechanism (MTOM) encoding methods.

wsHttpBinding

This secure and interoperable binding uses SOAP over HTTP and supports reliability, transactions, and security over the Internet. It supports HTTP and HTTPS transport protocols as well as text and MTOM encoding methods.

wsDualHttpBinding

This interoperable binding is commonly used for duplex service contracts because it supports bidirectional communication.

webHttpBinding

This secure and interoperable binding sends information directly over HTTP or HTTPS without creating a SOAP envelope. It is an efficient choice when SOAP is not required by the client.

wsFederationHttpBinding

This secure and interoperable binding supports federated security. It supports HTTP and HTTPS transport protocols as well as text and MTOM encoding methods.

netTcpBinding

This secure binding is used to send binary-encoded SOAP messages from one WCF computer to another. It uses Transmission Control Protocol (TCP) and includes support for reliability, transactions, and security.

netNamedPipeBinding

This secure binding should be used on a single WCF computer. Binary-encoded SOAP messages are sent over named pipes.

netMsmqBinding

This queued binding is used to send binary-encoded SOAP messages over MSMQ. Communication should occur between two computers.

netPeerTcpBinding

This secure binding is used for peer-to-peer communication over TCP. Communication should occur between two or more computers.

msmqIntegrationBinding

This interoperable binding can be used for existing MSMQ applications that use COM and native C++ application programming interfaces (APIs).

basicHttpContextBinding

This binding provides support for HTTP cookies and enables SOAP headers to exchange context.

netTcpContextBinding

This secure binding enables SOAP headers to be used in the exchange of content.

wsHttpContextBinding

This secure and interoperable binding enables SOAP headers to exchange context while also supporting reliability, transactions, and security.

*Table Taken from MCTS 70-503 Windows Communication Foundation By Microsoft Press, Copyright GrandMasters and Microsoft Corporation.

Choosing a Binding for WCF Service may seem confusing, initially, for developers but here is a flow diagram that will help you in selecting binding depending upon your scenario.

clip_image001
Reference: Programming WCF Services by Juwal Lovy- Oreilly

Perhaps the most commonly used in the market are basicHttpBinding and wsHttpBinding which uses SOAP 1.1 and SOAP 1.2 respectively. A good comparison of both these is done by Kurt CLAEYS on his blog. I hope this post cleared the picture in your mind 🙂

Have a Good Day with Services!

N-Tier Vs. Multi-Layered Architecture

Last week I was invited to assist Final Year Project Coordinator at University of Karachi to take viva for final year projects. So I observed one thing that students do not have clear picture between N-tier architecture and multi-layered architecture. So here I write few lines for them, hope that this will improve their understanding.

Layered architecture refers to logical distribution/separation of components like, a rough example will be, separate DLLs for Business Logic Layer(BLL) or Data Access Layer(DAL).

N-Tier refers to physical separation of components either on same machine or across different machines. For example, We have 3-tier architecture with UI on ASP.NET, BLL as WCF service on different server and DAL as WCF service on different layer. UI communicates with BLL and BLL with DAL. Even when there are multiple processes on single machine interaction through some means, let’s say services, it is said to be N-tier architecture.

Hope this will give you better idea. Don’t forget to live it 🙂

Have a good day!