Wednesday, February 16, 2011

Windows Communication Foundation


WCF is a runtime and set of APIs in .NET framework for building connected, service-oriented applicatons.

Difference with Web Services

Some of  the differences between WCF and Web service is that Web service only supports HTTP protocol. But WCF supports other protocols like TCP, HTTP, HTTPS, Named Pipes and MSMQ. Another major difference is that Web Services use XmlSerializer while WCF uses DataContractSerializer which is better in performance than XmlSerializer. Serialization in WCF.

ABC of WCF (msdn)

 

A - Address :  Where is the service
B - Binding : How do I talk to the service
C - Contract : What can the service do for me

 

Authentication and Authorization in WCF (MSDN)


You can also look in to this article series on MSDN about learning WCF.


Exception Handling in WCF

Handling exceptions in WCF is different than usual exceptions in .NET. Because WCF client may or may not base on .NET. Therefore we should have a generic way to pass exceptions to all types of clients. For this we have SOAP faults. 

SOAP faults are a way to propagate exceptions from service to the client application.  .NET framework has FaultException which can raise SoapFault exception. Here Service should throw FaultException<T> instead of usual CLR Exception object. T can be any type which can be serialized. 

WCF - Exception Handling

Resources

SO - Is there any official WCF Logo 
http://stackoverflow.com/questions/50114/wcf-wtf-does-wcf-raise-the-bar-or-just-the-complexity-level
http://www.codeproject.com/Articles/139787/What-s-the-Difference-between-WCF-and-Web-Services

Monday, February 7, 2011

What you need to know about JavaScript functions

As in any other language, functions are one of the building blocks of JavaScript. You can define functions and call them in different ways. In this article we'll see some basic but important things you need to know about JavaScript functions. 

Function declaration

The basic syntax for creating function declaration is like this. declarations loads to execution context before any code is executed. Below I'll show you function declaration example and 5 ways you can call the function.


Function expression

Functions can be created like expressions as well. Function expression gets load only when interpreter gets to the line of code. Also you can give a name to a function in a function expression they are called named function expression. If you do not give a name to a function expression it'll be called anonymous function expression.

The difference between function expression and declaration is how browser loads them to execution context. With functions comes a important concept called hoisting. Usually in JavaScript variable declarations are hoisted on top of a function. Read this for more info on hoisting

function themselves are objects of type Function. It has methods like apply, call etc.. Every functions by default accepts arguments object. You can find all arguments passed from the caller from argument object. Closures are related with functions. Read this article written by me about closures. JavaScript has predefined functions such as eval, isNaN, parseInt etc. If no return value is defined, functions will return undefined.

You can pass different parameters to functions. If you pass primitive type (primitive types in JavaScript) they get passed by value. But if you pass object (such as Array) the change will be reflected outside the function. That is you're passing an reference to an object by value. There is no pass by reference in JavaScript. 


Constructor functions vs Factory functions
Constructor function uses the new keyword to create a new object, set this within the function of that object and return it.





Factory function also uses to create new objects but it does not use new keyword. In fact factory creates the object for you and returns it. You can return different types of objects from a factory. 



With factories you get better encapsulation and data hiding. 

When you create an object from constructor function the prototype will be included in that object. When you create a n object through a factory since it just returns an object, the prototype won't be available.

Some Useful Stuff

Exclamation mark in front of a function (SO1 , SO2)


Resources
Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook