Tuesday, December 24, 2013

Season’s surprise: IE 11 for Windows 7 SP1 and Windows Server 2008 R2 SP1 is released

Yes! Previously available for Windows 8.1, now IE 11 is also available for Windows 7 SP1 and Windows Server 2008 R2 SP1.

I recommend you, my blog audience, to download the 64bit version as Microsoft is moving towards 64bit.

In fact, Windows Server 2012 R2 is only available in 64 bit!

This is the download page URI: http://windows.microsoft.com/en-us/internet-explorer/download-ie

Microsoft is also beginning to broadcast IE 11 downloads:

IE11_win7_win2008R2_thumb_7DE74C83

Enjoy full speed browsing in IE 11!

Thursday, December 19, 2013

RX Web Services journal: WCF in .NET 4.0 implicitly fits REST Maturity Model Level 2

Hi my blog readers!

Another journal is born! now RX journal about web services!

I have just dived deep in .NET 4.0 technology stack, when this week I was assigned to create web services. As .NET mostly guy, I revisit my skill in creating WCF.

Outside world, many things happened. The need of having REST services with the correct model and incorporating HTTP verbs (not just GET and POST) is becoming crucial and more relevant.

Fortunately, Leonard Richardson has written the REST maturity model as the baseline for us. But Martin Fowler, the best known guy that one popularized DSL and PoEAA (Patterns of Enterprise Application Architecture) helped us to understand REST maturity model.

Martin Fowler described the levels into these:

  • Level 0 – RAW HTTP
  • Level 1 – Resources (with HTTP binding as endpoints)
  • Level 2 – HTTP verbs
  • Level 3 – Hypermedia

Level 0 means you’re using RAW HTTP with either GET or POST, but the resulting request and response is plain XML. This is why Martin describes this Level as swamp of POX (Plain Old XML). A good sample of this is .NET Remoting using RPC in .NET 2.0 and above and Java’s RMI. In Level 0, the talks only involves talking to only one endpoint.

Richardson-Maturity-Model_Level0

Level 1 means you’re considering the request and response as real HTTP object, but the main concern here is talking and requesting specific resources as part of HTTP conversation.

This picture was taken from Martin Fowler’s article:

Richardson-Maturity-Model_Level1

This means not just specifying endpoint, but we also specify which resources needs to be sent and to have.

Level 2 means incorporating HTTP verbs, meaning that now not only specific resources, but it’s also introducing HTTP verbs with response codes.

Richardson-Maturity-Model_Level2

This means that Level 2 add more concern on separation of which HTTP verbs are changing states and not changing states.

These HTTP verbs change states:

  • POST
  • PUT
  • DELETE

This HTTP verb does not change state:

  • GET

Fortunately, WCF in .NET 4.0 is confirmed to have full support of Level 1 and with more care, it also supports Level 2.

This is a small sample of Level 1: (an operation contract of testvalue)

WCF_REST_simplesample

And this is the explanation related to the REST levels:

WCF_REST_Maturity_Level1_thumb_72DE5E5E

It’s quite simple in WCF, isn’t it? But when you consider Level 2, you also have to pay attention to the verb and the HTTP returning status codes.

Supports for setting and getting HTTP status code is available in WCF using WebOperationContext.

I’ll dive into WCF supports for Level 2 in the next blog entry about this.

Put it simply, Level 2 concerns about:

  • Resource specific (as in Level 1)
  • using HTTP verbs
  • specifying HTTP status codes (for each HTTP verb used) as a mean to define what is the nature of the resulting resource.

Level 3 add concerns about using HTTP as the transport for Hyper media, means that the data will have the additional information of what is the next destination.

It’s quite elegantly illustrated as below picture:

Richardson-Maturity-Model_Level3

As you can see, there’s additional information in the forms of links to the resource. This means that the hyperlinks in the data has to be specified.


Further references

Tuesday, December 10, 2013

TEACHING: Study club of MUGI Jadetabek on Developer Track, WEEK 4

Now, it’s week 4! We could not have the workshop within the next week of week 3 because of my busy schedule, sorry!

Also in the week 4, we decided to meet at QQ Kopitiam, at Pacific Place at 9:30 because I had something to do first in the morning. Not just my schedule, but the study club will need to adjust with the participants. Therefore this week 4 was commenced on 7th December, 2013.

To my surprise, the attendance were few: Wakhid and Aris weren’t present. But Wakhid was able to tell me that he’s still minding his final paper assignment.

Ok, the show must go! Sorry to leave you if you weren’t present, guys!

This week I reviewed the knowledge of basic generic and collection. To my surprise, not all of them understood and grabbed the full concept of last week.

WP_000182_thumb_5D41B33E

The assignment was to create a simple implementation of LINQ’s WHERE and also implement ICollection<T>, so I decided to repeat the explanation on how generic works.

Basically we can consider generic type as parameterized type or type as parameter. So, if we declare ICollection<T>, we could use and implement derived ICollection with String as parameter (or any type).

The type T then can be replaced by String, so the use will be ICollection<String> (read as ICollection of String). In fact, arrays in .NET 2.0 and above are implemented as collections of parameterized type, so when we have array of bytes, it’s actually implemented as collections of strongly typed bytes, not just array of boxed objects.

Sample from MSDN: (from http://msdn.microsoft.com/en-us/library/vstudio/b5bx6xee%28v=vs.110%29.aspx)

// The .NET Framework 1.1 way to create a list:
System.Collections.ArrayList list1 = new System.Collections.ArrayList();
list1.Add(3);
list1.Add(105);

System.Collections.ArrayList list2 = new System.Collections.ArrayList();
list2.Add("It is raining in Redmond.");
list2.Add("It is snowing in the mountains.");

Although it’s very subtle, the ArrayList will cast to objects, and this is called boxing.

As consequences, we also need to understand boxing and unboxing concept in C# and VB. For more info, visit boxing and unboxing in MSDN Library.

Now with .NET 2.0 and above, we can create list with strong typed:

// The .NET Framework 2.0 way to create a list
List<int> list1 = new List<int>();

// No boxing, no casting:
list1.Add(3);

// Compile-time error:  // list1.Add("It is raining in Redmond.");

Now every time we access each or any member of list1, we are confident that the type of the member is int.

This type parameter concept is very powerful, and it’s becoming a basic feature for all modern programming language nowadays. Not just languages on top of .NET platform, .NET itself has integrate generic deeply as part of CLI and CLR implementation.

Other platform such as Java had begun implementation of generic in Java 5 (JDK 1.5.0) although it came late. Luckily, there’s an official tutorial of generics in Java from Oracle.

By integrating generic deeply into the runtime, now it’s up to the programming language to leverage this! In .NET, we have C#, VB, F#, C++.

Hey, it’s time for the participants to try!

WP_000184-2_thumb_71186989

Finally, they could create the LINQ WHERE! …And now time to eat!

WP_000191_thumb_5A38D666

Next meetup: advanced LINQ concept.




Sidenote


Again, I encourage all of you to read TAPL book by Benjamin Pearce, to fully understand the type theory behind generic type.