Sunday, April 18, 2010

webHttpBinding – REST in WCF (Part 1)


REST stands for Representational State Transfer

It basically means exposing services

  • based on URI
  • encode message without the overhead of SOAP
  • pass parameter using HTTP
  • format data using JSON or POX

Service Contract

Get the complete code solution from this SVN url : http://subversion.assembla.com/svn/TechnologyAndMe/RestTimeService

using System.ServiceModel;
using System.ServiceModel.Web;

[ServiceContract]
public interface ITimeService
{
[OperationContract]
[WebGet]
string Now(string GMT);
}


Web.Config





behaviorConfiguration="webBehavior">

















Now to access the service hit the service with this url

http://localhost:3048/TimeService.svc/Now?GMT=1


The output is as follows


GMT 14/18/2010 23:23:58

Friday, April 09, 2010

Whitespace – Cleanest programming language


http://compsoc.dur.ac.uk/whitespace/

From their homepage -
“Most modern programming languages do not consider white space characters (spaces, tabs and newlines) syntax, ignoring them, as if they weren't there. We consider this to be a gross injustice to these perfectly friendly members of the character set. Should they be ignored, just because they are invisible? Whitespace is a language that seeks to redress the balance. Any non whitespace characters are ignored; only spaces, tabs and newlines are considered syntax.”

WTF. Now talk about dirty code.

User story formats

 

Now, usually the user stories that we write are of the format :
As A Bank Teller, I Want a name search field, So That I can quickly look up customers.

But like someone pointed out, it makes much more sense to construct the story as follows:
So That I can quickly look up customers, As A Bank Teller, I Want a name search field.

Further more, now we can relate the So That to actual business values and we also got rid of explicit implementation details from I Want, as follows:
So That I can serve customers faster, As A Bank Teller, I Want an efficient way to look up customers.

Sunday, April 04, 2010

WPF window phases

 

1. Constructor is called.
2. Window.Initialized event is raised.
3. Window.Activated event is raised.
4. Window.Loaded event is raised.
5. Window.ContentRendered event is raised.
6. User interacts with the window.
7. Window.Closing event is raised.
8. Window.Unloaded event is raised.
9. Window.Closed event is raised.