Wednesday, May 23, 2007

Good Articles On Interface

I have come accross one very good illustration on Interface.
Universal TV Remote Control for all different brands of TV
Power On/Off, Volume high/low, Channel Selection are the common contracts for TV functionalities on a Universal TV Remote Control. I do not need to care about the implementations of every TV. As long as every TV compliance to these contracts, the universal remote control is able to access those functionalities on different brands of TV.
Very Interesting Ambiguity in C# Interface

Tuesday, May 22, 2007

Abstract Class vs. Interface

  • An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods.
  • An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the property's signature but no implementation.
  • An abstract class cannot support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class.
  • A class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class.
  • Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.
  • Abstract classes are faster than interfaces.

http://aspalliance.com/1213_Working_with_Abstract_classes_Sealed_Classes_and_Interfaces_in_C

Monday, May 21, 2007

Why Static Methods?

Why use static methods?
1. Allow users to use those methods without having to create an instance of that class
2. The static class method apply to the class rather than instances
3. Instance methods are instance methods because they rely on the state of the specific object instance.
4. Static methods, e.g. instances() is used to track the number of instantiations at the class level. They are independant of instance states.
5. Useful for utility class (private constructor - no instantiation, but it's easily abused and lead to procedural programming) or factory class.

refer to Static Methods

Sunday, March 11, 2007

.NET Framework 3.0 (Part 2 - WCF)

note: * indicates "important info"

*
What is Windows Communication Foundation (WCF) ?

Windows Communication Foundation is Microsoft's unified programming model for building service-oriented applications with managed code. It extends the .NET Framework to enable developers to build secure and reliable transacted Web services that integrate across platforms and interoperate with existing investments. Windows Communication Foundation combines and extends the capabilities of existing Microsoft distributed systems technologies, including Enterprise Services, System.Messaging, Microsoft .NET Remoting, ASMX, and WSE to deliver a unified development experience across multiple axes, including distance (cross-process, cross-machine, croPublishss-subnet, cross-intranet, cross-Internet), topologies (farms, fire-walled, content-routed, dynamic), hosts (ASP.NET, EXE, Windows Presentation Foundation, Windows Forms, NT Service, COM+), protocols (TCP, HTTP, cross-process, custom), and security models (SAML, Kerberos, X509, username/password, custom).

How will Windows Communication Foundation change the way developers build applications?

WCF radically simplifies development of distributed applications in several ways.

  1. WCF reduces complexity by unifying the silos that exist with today's distributed technology stacks (Enterprise Services, System.Messaging, .NET Remoting, ASMX, and WSE). This enables developers to compose distributed applications using the best features of each of today's stacks.
  2. Windows Communication Foundation maximizes developer productivity through an attribute-based programming model.
  3. WCF is the first development framework built from the ground up on the principle of service-orientation —enabling developers to build loosely coupled applications that interoperate securely and reliably across platforms.
*How does Windows Communication Foundation address Service Oriented Architecture (SOA)?

WCF is the first programming model built from the ground up to provide implicit service-oriented application development, enabling developers to work autonomously and build applications that are more version independent, thereby increasing application resilience to change.

*Will Windows Communication Foundation be backwards compatible with existing distributed systems technologies?

WCF represents the next logical version for each of today's distributed systems stacks. As such, developers using today's technologies will be able to apply their existing skills to WCF application development. In addition, Windows Communication Foundation will enable side-by-side operation of applications built with existing technologies and Windows Communication Foundation-based applications. Finally, Microsoft will provide guidance for developers upgrading existing code from ASMX, .NET Remoting, .NET Enterprise services, WSE, System.Messaging to Windows Communication Foundation.

*What are the core components of an Windows Communication Foundation service?
  1. A service class, implemented in C# or VB.NET or another CLR-based language that implements one or more methods
  2. A host environment, —an application domain and process—ing which the service runs
  3. One or more endpoints that allow clients to access the service.
How are Windows Communication Foundation services hosted?

A class implementing a WCF service is typically compiled into a library. By definition, all libraries need a host application domain and Windows process to run in. Windows Communication Foundation provides two options for hosting libraries that implement services.

  1. Windows Activation Service (WAS)
  2. any application domain running in an arbitrary process (such as a Windows Forms application, a console application, an NT Service, etc).
*What is Windows Communication Foundation's default communication encoding on the wire?

By default, Windows Communication Foundation uses SOAP (perhaps with some WS-* extensions), represented on the wire in its usual text-based XML encoding. When two Windows Communication Foundation-based services communicate with each other, however, it makes sense to optimize this communication. All of the same features are provided, including reliable messaging, security, and transactions, but the wire encoding used is an optimized binary version of SOAP. Messages still conform to the data structure of a SOAP message, referred to as its Infoset, but their encoding uses a binary representation of that Infoset rather than the standard angle-brackets-and-text format of XML.

Does Windows Communication Foundation support peer-to-peer interaction?

Yes. Windows Communication Foundation services can be hosted in a variety of application types, including desktop applications (built with Windows Presentation Foundation or Windows Forms), COM+ components, Windows Services, etc. This enables developers to simply build service endpoints and have Windows Communication Foundation handle the communication between them.

Does Windows Communication Foundation support both synchronous and asynchronous messaging?

Yes. Windows Communication Foundation supports multiple message patterns, including one-way, request/response, two-way (duplex), and queued.

Will Windows Communication Foundation support transactions that can be coordinated across different platforms?

Yes. Windows Communication Foundation will plug into the Microsoft Distributed Transaction Coordinator (MSDTC) extensibility model and will support WS-AtomicTransaction as well as WS-Coordination to enable coordinated transactions across platforms.

Web services are moving away from WS-Attachments and DIME. What attachments protocol will be used in Windows Communication Foundation?

SOAP Message Transmission Optimization Mechanism (MTOM) will be the attachment technology supported in Windows Communication Foundation.

*What is Service-Orientation and how is it related to Windows Communication Foundation?

Service Orientation is a specific set of architectural principles for building loosely coupled services that help developers maximize the return on your application investments over time. The services have explicit boundaries, are autonomous, share schema and contracts, and determine compatibility based on policy. Applications based on these principles provide benefits in maintainability, reusability, and manageability of connected systems. Windows Communication Foundation is the first programming model built from the ground up for building service-oriented applications.

Why is service orientation important?

Loosely-coupled applications built on the tenets of service orientation yield benefits in maintainability, reusability, and manageability of connected systems. Service-oriented applications also more closely reflect real-world processes and relationships. Microsoft sees service orientation as a means to an end— that end being a set of connected systems that optimize communications across a business —connecting people, information, and devices.

*Does service-oriented development conflict with object-oriented development?

No. Service-oriented development complements object-oriented (OO) development. Object-oriented development continues to fulfill an important role in the internal design of services. Service-orientation deals with how to interconnect services to build connected systems. To use an architecture analogy, OO development addresses the architecture within a single building (a service), while service-orientation addresses the issues around city planning (a system).

How will Windows Communication Foundation make service-oriented development easier?

Today, it is difficult to build service-oriented applications due to the lack of an intuitive service-oriented programming model. Web services provide a great start, but lack support for more advanced communication, including secure and reliable transacted services. Windows Communication Foundation provides both an intuitive service-oriented programming model and the advanced functionality to create service-oriented applications that interoperate across organizational and platform boundaries.

What specifications will Windows Communication Foundation support?

Windows Communication Foundation will support a broad range of Web services standards, including basic standards (XML, XSD, XPath, SOAP, WSDL) and advanced standards and specifications that comprise the WS-* architecture. These include WS-Addressing, WS-Policy, WS-Security, WS-Trust, WS-SecureConversation, WS-ReliableMessaging, WS-AtomicTransaction, WS-Coordination, WS-Policy, and MTOM.

Notes taken from :
Windows Communication Foundation (Indigo) FAQ
Do read David Chappell's Introducing Indigo white paper if you wish to know more.

Saturday, March 10, 2007

.NET Framework 3.0 ( 1.0 Overview)

Figure 1. The .NET Framework 3.0.

The Microsoft .NET Framework 3.0 (formerly WinFX), is the new managed code programming model for Windows. It combines the power of the .NET Framework 2.0 with four new technologies: Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), Windows Workflow Foundation (WF), and Windows CardSpace (WCS, formerly "InfoCard"). There are no changes to the version of the .NET Framework 2.0 components included in the .NET Framework 3.0. It also means that applications that run on the .NET Framework 2.0 today will continue to run on the .NET Framework 3.0.

Figure 1. The Detailed .NET Framework 3.0.

The benefits of .NET Framework 3.0 today are as following:
  • to build applications that have visually compelling user experiences
  • seamless communication across technology boundaries
  • the ability to support a wide range of business processes
  • an easier way to manage your personal information online.
If you do have the .NET Framework 2.0 installed, the .NET Framework 3.0 installer will only install the new components of the .NET Framework 3.0. The .NET Framework 3.0 uses the 2.0 version of the CLR too.

Since the .NET Framework 3.0 includes only new components that are added to the .NET Framework 2.0 and there is no overlap between the assemblies of the .NET Framework 2.0 and the .NET Framework 3.0, there's no real "Side by Side" scenario. You can run applications based on the .NET Framework 2.0 and applications based on the .NET Framework 3.0 on the same machine.

The .NET Framework 3.0 will be available for and supported on Windows Vista™, Windows Server 2003 (SP1), and Windows XP (SP2). The .NET Framework 3.0 is a core component of the Windows Vista operating system, and is installed by default on Windows Vista.

Notes from articles:
Learn .NET Framework 3.0
.NET Framework 3.0 Versioning and Deployment Q&A