Skip to main content

Posts

Showing posts from May, 2008

.NET Framework Client Profile

The .NET framwork keeps on growing and so does the size, so it has become apparent that a lighter version of the .NET Framework is needed. Last week, Microsoft released the Visual Studio 2008 and .NET Framework 3.5 SP1 Beta. This includes the .NET Framework Client Profile,a smaller, optimized verson of the .NET framework needed for clients applications to run.The size of this framework is approximatley 27 MB (not that small), some of the assemblies that still lies in the beta but will be removed in the RTM version are System.Management, System.Messaging, System.ServiceProcess, System.Web, System.Web.RegularExpressions Visula Studio 2008 also has an option where you can make sure that an application targeted for the Client Profile Framework does not reference assemblies that are not included in the Client Profile Framework.You can have a look at the list of assemblies that are inluded in the client profile here

WS-* and REST, Which Is Better and Why?

I have been hooked up to REST these days after having some times to go through the WCF Web Programming Model (I know I am lagging behind in technologies !). While looking at the pros and cons of REST and WS-*, I could see more then few web pages, blogs, on the debate of what’s the best solution for SOA. REST is easy to use, no SOAP-client tool kits needed to generate web service proxies, as the fundamental concept behind REST being every operation is accessed by its unique URI, it's just a matter of typing it in your web browser, this also makes testing easier for developers (as all they need to do to see if the service is working, is to type the url in the browser !) Further more if your are practicing an asynchronous pattern such as using AJAX, it might be very easy to call a REST service, get the response in JSON and do the processing on the client side, this is much easier then using the typical DOM method to parse XML. When it comes to coupling, REST is more loosely coupled th...

RESTful Example

Here is an example on how you would create a RESTful webservice with the WCF Web programming model. I assume that you know how to write a WCF service and host it in IIS. In this example I am going to create a service that will say "Hello" plus a string that is passed into the service, further more the service is going to be hosted in IIS. the following is a WCF service class, [ServiceContract] public interface ITest { [OperationContract] [WebGet(UriTemplate="/SayHello/{str}",ResponseFormat= ebMessageFormat.Xml)] string SayHello(string str); } public class TestImpl : ITest { public string SayHello(string str) { return "Hello " + str; } } SayHello is our service operation. Note that this is a general WCF service with addittion of a [WebGet] attribute on top of our service operation. by using the [WebGet] attribute we mean that the operation is to be invoked with the HTTP GET verb.The next step is to define our .svc file for our service, the content of the ....

RESTful Web Services and the WCF Web Programming Model

REST (Representational State Transfer) is not a new thing to the web service world; you can find a lot about what it is on the net, but for formality...REST is an architectural style (not a standard) it simply means web services are identified as resources and each operation as a unique URI assigned to it.You invoke the object's operation using the HTTP verbs like GET, POST etc... Most web services are being shifted to using this style, for an example yahoo web services use REST. But some companies continue to have a REST service in addition to the SOAP based service. One of the advantages of using REST over SOAP based services is that REST is light weight, as there is not much XML markup; for an example, REST does not use the SOAP header which is chunky. Another benefit of REST is that the client accessing the service does not need special SOAP tool kit to use the service, as the service operation is identified as a URI, it is just a matter of accessing it like a web page in a bro...

Finalization, Know What it Costs

This is a post about object finalization in .NET. Finalization is not as inexpensive as we think, it increases the pressure put on GC.All objects that need finalization are moved into a finalizable queue and the actual finalization happens in a separate thread. Because the objects full state may be needed, the object itself and all the object it points to are promoted to the next generation (this is needed so that GC does not clean these objects off in the current round), and these objects are cleaned up only after the following GC. Due to this reason, resources that need to be released should be wrapped in as small a finalizable object as possible, for instance if your class needs a reference to an unmanaged resource, then you should wrap the unmanaged resource in a separate finalizable class and make that a member of your class and furthermore the parent should be a non-finalizable class. This approach will assure that only the wrapped class (class that contains the unmanaged resourc...