July 2008 - Posts
This is 2 consecutive years, TechEd SEA has held in Malaysia. For those who don't know what the TechEd is, TechEd is Microsoft event where you can learn a lot of latest technologies from experts.
Check it out for more information http://www.microsoft.com/malaysia/techedsea2008/default.mspx
What are Microsoft Patterns and Practices?
Microsoft Patterns and Practices are Microsoft's proven recommendations for how to design, develop, deploy, and operate architecturally sound application for Microsoft platform.
Use patterns and practices to:
- Understand proven architecture, design, and implementation patterns
- Re-use tested, performance-tuned source code and application blocks
- Implement security, performance, scalability engineering practices
- Build enterprise .NET application faster with confidence
In short, Microsoft Patterns and Practices are a set of recommendations and guidance that help us to build an application with best practice approach.
There are 3 types of patterns and practices guidance:
- Software Factories
- Application Block
- Guides
Software Factories
A software factory is a structured collection of related software assets.
A software factory contains a variety of software assets including content and tools.
- Content includes reusable code component, documentation, and reference implementation
- Tools include wizards, code generators, and visual designers.
One benefit of the software factory is that architect and developer can customize, extend, and adjust it to address the unique needs of a project team or an organization.
There are several important points related with Software Factories:
- Mobile Client Software Factory
- Smart Client Software Factory
- Web Client Software Factory
- Web Service Software Factory
Application Blocks
Application Blocks are reusable source code components that provide proven solutions to common development challenges. They can be integrated as is into applications, or they can be extended or customized.
Then what about Enterprise Library? Does it related to Application Blocks?
Well, Enterprise Library consists of several Applications Blocks. And there are several changes of number of application blocks and improvements in each version.
Enterprise Library 1.0:
- Was built by Microsoft in partnership with Avanade.
- It merged many of the capabilities of Microsoft's original standalone application block with Avanade's ACA.NET (Avanade Connected Architecture for .NET) development framework.
Enterprise Library 1.1:
- Caching Application Block
- Configuration Application Block
- Cryptography Application Block
- Data Access Application Block
- Exception Handling Application Block
- Logging Application Block
- Security Application Block
Enterprise Library 2.0:
- Leverages key new capabilities provided by the platform
- Certain features from Enterprise Library v1.x have been deprecated in favor of the platform
- Configuration Application Block is no longer exists.
- Much improved Logging Application Block
- Simpler and more powerful Data Access Application Block
Enterprise Library 3.0:
- New Application Blocks: Validation Application Block
- New Application Blocks: Policy Injection Application Block
- Integration with WCF
- Etc
Enterprise Library 3.1:
- Minor enhancement to Validation and Policy Injection Application Block
Enterprise Library 4.0:
- Integration with Unity Application Block
- Windows Management Instrumentation (WMI) 2.0 support and improved instrumentation
- Performance improvement (in Logging Application Block)
- Pluggable Cache Managers
- Visual Studio 2008 support
- Bug fixes
Guides
Guides consist of written guidance, either online or printed, which you can read to get a detailed understanding of technical problem domains and engineering practices.
The following are the collections of guidance:
- .NET Data Access Architecture Guide
- Application Architecture for .NET: Designing Applications and Services
- Application Interoperability: Microsoft .NET and J2EE
- Authentication in ASP.NET: .NET Security Guidance
- Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication
- Caching Architecture Guide for .NET Framework Applications
- Data Patterns
- Deploying .NET Framework-based Applications
- Describing the Enterprise Architectural Space
- Design and Implementation Guidelines for Web Clients
- Designing Application-Managed Authorization
- Designing Data Tier Components and Passing Data Through Tiers
- Enterprise Solution Patterns Using Microsoft .NET
- Exception Management Architecture Guide
- Guidelines for Application Integration
- Improving .NET Application Performance and Scalability
- Improving Web Application Security: Threats and Countermeasures
- Integration Patterns
- Smart Client Architecture and Design Guide
- Team Development with Visual Studio .NET and Visual SourceSafe
- Testing .NET Application Blocks
- Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET
- Web Service Security Guidance
Reference
In this post, I am going to write on the brief introduction to Windows Communication Foundation (WCF). WCF Code Name "Indigo" is a part of .NET Framework 3.0 API.
Let's start at the problem first.
The Problem
The Solution
In order to answer the problem, Microsoft tried to develop a connected system framework to unify all technologies.
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows.
Windows Communication Foundation
Programming Model Architecture
Does WCF hard to be understood? Don't worry; WCF is just as easy as ABC J
ABC means Address, Binding, and Contract.
Take a look at the picture below.
The client is at the left side and the service is at the right side. How does the client communication to the service and vice versa? The client needs to request something to the service and the service needs to reply the client.
How does it work?
It's important to know that there is an endpoint both in client and server. Moreover, the endpoint from the client must match the server's one.
What does the endpoint contains?
Remember the ABC: Address, Binding, and Contract.
Address refers to the service location or service address. Basically in the form of URL.
e.g.: http://localhost:8000/MyFunkyService/
Binding refers to how does the two endpoint talk. They need some standard channel.
There are several pre-defined binding:
BasicHttpBinding:
Basic Profile 1.1 Interop and Intergration w/ASMX
WsHttpBinding:
Basis for WS-* interop.
Supports WS-Security, WS-RM, WS-Tx
NetTcpBinding:
.NETó.NET across processes
Secure, reliable duplexed
NetNamePipesBinding
.NETó.NET across processes
Secure, reliable duplexed
NetMSMQBinding
.NETó.NET via MSMQ
NetPeerTcpBinding
.NET Peer ó Peer
Beside those pre-defined binding, you can also customize the binding yourself.
The following is the endpoint example in config file.
<endpoint
address="http://localhost:1191/LibraryWCFService/Service.svc"
binding="wsHttpBinding"
contract="IService"
name="WSHttpBinding_IService">
Reference Book:
I strongly suggest the book "Programming WCF Services" by Microsoft software legend, Juval Lowly.
Because of some urgent reasons, I'll have to do some quick ramp and understanding on certain latest technologies.
I'll start on Windows Workflow Foundation.
Where to find the resource? Googling? Yeah, it's good actually. But I afraid that I found hundred or thousand of link / resource that are not appropriate, not specific, not very useful, not too informative, or too advanced for a starter to learn. Sometimes starter confuses where to start and what to learn first.
The answer is here. .NET Framework 3.0 Training Kit and Visual Studio 2008 Training Kit! You'll find the presentation from the expert, demo code, and hands on lab. It's perfect for the starter.
Introduction
Okay, before we go in to the Windows Workflow Foundation, let's define what the term "Workflow" is. Workflow is:
- The organization of work business process or application login.
- A set of activities that coordinate people or / and software
- Something that we face every day in our daily life (maybe sometimes, we don't aware of it)
- Request a leave to our boss is also to be considered as a workflow (do you? J)
Actually at the earlier, Microsoft has started to aware the important of the workflow in software development.
It would be nice if:
- there is something that can help us easier to make a workflow
- We can integrate the workflow activity with our other application / action
- I can send a request to my supervisor to take a leave via web application; my supervisor could reply me his decision. When my supervisor agrees, there would be an email that will be sent automatically to the HR department. Finally, my leave credit at the database would be automatically deducted.
Those requirements forced the birth of a cool stuff named Windows Workflow Foundation (WF, not WWF coz WWF has been taken and known, stands for World Wrestling FederationJ)
In formal definition, Windows Workflow Foundation is the programming model, engine and tools for quickly building workflow enabled applications on Windows.
Architecture
I fully agree with what Mr Risman said. "Learning the How To is easy; understand the concept and architecture of how something works is more important". As the result, in this post, I'll start from the concept and architecture first. Hopefully, I can continue the "How To" part in the next post.
So next, let's step in to the architecture.
Let's dig it reversely from the bottom.
From the big box, we can see that the workflow foundation would be treated as a "Hosted Process" that are ready to listen any action or request.
Inside the host process, there will be the Workflow Foundation that contains 3 important layers:
-
Runtime Service
This is where the heart of the WCF is. It makes the WCF alive. We can say, it's the foundation for others layer.
-
Runtime Engine
Runtime Engine runs on the top of Runtime Service. It handles some stuff like the workflow execution and the state management.
-
Base Activity Library
This is the library of the WF. We will need the library to build our workflow. We are given, all we need to do is learn how to use it J.
If you are familiar with the .NET Framework architecture, imagine it like the BCL (Base Class Library / Framework Class Library)
On the top of the 3 important layers that I mentioned above, there is Custom Activity Library. It is sure that we will need something the Base Activity Library doesn't provide us; we need to build it ourselves or buy it from 3rd party vendor. Here's the Custom Activity Library located.
After we are ready with those things above, we now are ready to develop our workflow. We can design our workflow using the libraries such as:
- Code Activity
- Delay
- Conditional (If – Else)
- Looping (While)
- Listen
- Etc
To make us easier in building the workflow design, Visual Designer offers us a great help. All the action or process could be done by click and drag visually. Of course, Visual Designer is integrated in the Visual Studio (2005 and 2008).
Workflow Authoring Modes
How to create a workflow? There are several authoring modes to creating the workflow:
- Markup Only / Declarative -> Could be done using XAML (eXtensible Application Markup Language)
- Markup + Code -> XAML + (C# / VB)
- Code Only -> (C# / VB)
- Application Generated -> Application creates activity tree and serializes it into one of the things above.
All of the 4 modes above will be compiled by the Workflow Compiler (wfc.exe) and will be compiled once again be language compiler (either C# or VB), then finally become the .NET assembly.
Activity
Another important point / concept in Workflow Foundation is Activity.
Activity is:
Here's the concept and architecture part first. Hopefully, I can continue the "How To" part in the next post.
Resources:
Forum – http://www.windowsworkflow.net/forums