<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEYAQH0yeyp7ImA9WhFSEk4.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069</id><updated>2013-06-14T19:49:01.393+02:00</updated><category term="Personal" /><category term="IoLanguage" /><category term="Resharper" /><category term="IT-Jam" /><category term="Microsoft" /><category term="KohonenAlgorithm" /><category term="Performance" /><category term="SQL" /><category term="WindowsForms" /><category term="Pedagogic Practice" /><category term="English" /><category term="LvivNetUserGroup" /><category term="HowTo" /><category term="Errors" /><category term="Deployment" /><category term="CodeAndBeer" /><category term="Clojure" /><category term="UI" /><category term="CI" /><category term="LambdaExpression" /><category term="Ukrainian" /><category term="SOA" /><category term="Prolog" /><category term="IDE" /><category term="TeamWork" /><category term="Concurrency" /><category term="ASP.NET" /><category term="Web" /><category term="Environment" /><category term="YearPlanReport" /><category term="Book Reviews" /><category term="MEF" /><category term="Scala" /><category term="CodePuzzle" /><category term="Opinion" /><category term="TDD" /><category term="Languages" /><category term="RandomThoughts" /><category term="Revision of my activity" /><category term="OData" /><category term="Delphi" /><category term="UnitTesting" /><category term="Career" /><category term="QuickTip" /><category term="InfluenceOnPeople" /><category term="Presentation" /><category term="DDD" /><category term="Events" /><category term="Clean Code" /><category term="AutoMapper" /><category term="Design Patterns" /><category term="NUnit" /><category term="MasterDiploma" /><category term="IoC" /><category term="Certification" /><category term="REST" /><category term="UML" /><category term="WP7" /><category term="RhinoMocks" /><category term="Coaching" /><category term="Design" /><category term="F#" /><category term="Workaround" /><category term="Java" /><category term="Fun" /><category term="IIS" /><category term="Refactoring" /><category term="CodeReview" /><category term="Haskell" /><category term="C#" /><category term="Regex" /><category term="Frameworks" /><category term="Conferences" /><category term="WCF" /><category term="Ruby" /><category term="Success" /><category term="OOP" /><category term="DistributedCache" /><category term="Autofac" /><category term="VS2010" /><category term="NHibernate" /><category term="Tools" /><category term="My book" /><category term="SVN" /><category term="PublicTalks" /><category term="DevMeeting" /><category term="Education" /><category term="Blog" /><category term="Silverlight" /><category term=".NET" /><category term="Prototyping" /><category term="Erlang" /><title>Developer's RoadMap To Success</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.andriybuday.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.andriybuday.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>253</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/DevelopersRoadmapToSuccess" /><feedburner:info uri="developersroadmaptosuccess" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>DevelopersRoadmapToSuccess</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;C0IMRXY8eyp7ImA9WhBaFkU.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-16375323728241962</id><published>2013-05-27T21:05:00.001+02:00</published><updated>2013-05-27T21:06:24.873+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-27T21:06:24.873+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>How to consume WCF service in .NET</title><content type="html">&lt;p align="justify"&gt;What? I must be kidding. This is not blog for kids trying to play with .NET. Every professional .NET developer knows how to consume WCF. Don’t they? There is nothing more easier than that.&lt;/p&gt;  &lt;p align="justify"&gt;Well, not that long ago I realized that the way I like to consume WCF services is not 100% correct.&lt;/p&gt;  &lt;p align="justify"&gt;What I like to do is use of “using”:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (var client = &lt;span class="kwrd"&gt;new&lt;/span&gt; SomeServiceClient())
{
  var response = client.SomeServiceOperation(request);
  &lt;span class="rem"&gt;//return or do something&lt;/span&gt;
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p align="justify"&gt;While this looks nice, here is thing which even kids won’t like: Dispose method for the client is not really implemented correctly by Microsoft! It could throw an exception if there is network problem therefore masking other exceptions that could have happened in between. You can understand the issue better if you have a look at WCF samples (&lt;code&gt;\WF_WCF_Samples\WCF\Basic\Client\UsingUsing&lt;/code&gt;).&lt;/p&gt;

&lt;p align="justify"&gt;MS proposes their own solution (read it &lt;a href="http://msdn.microsoft.com/en-us/library/aa355056%28v=vs.90%29.aspx"&gt;here&lt;/a&gt;):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var client = &lt;span class="kwrd"&gt;new&lt;/span&gt; SomeServiceClient();
&lt;span class="kwrd"&gt;try&lt;/span&gt;
{
    var response = client.SomeServiceOperation(request);
    &lt;span class="rem"&gt;// do something&lt;/span&gt;
    client.Close();
}
&lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception)
{
    client.Abort();
    &lt;span class="kwrd"&gt;throw&lt;/span&gt;;
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;While this is correct way it is too much code, especially if you put catch blocks for Communication and Timeout exceptions as recommended by MS. Guys over internet propose other solutions, like wrapping the call or extension methods.&lt;/p&gt;

&lt;p&gt;Here is my solution, which is nothing new, but just slightly modified version of best proposed answer on &lt;a href="http://stackoverflow.com/questions/573872/what-is-the-best-workaround-for-the-wcf-client-using-block-issue"&gt;SO&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Elegant example of usage with return statements:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; Service&amp;lt;ISomeServiceChannel&amp;gt;.Use(client =&amp;gt;
{
    &lt;span class="kwrd"&gt;return&lt;/span&gt; client.SomeServiceOperation(request);
});&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And the solution itself:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Service&amp;lt;TChannel&amp;gt;
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; ChannelFactory&amp;lt;TChannel&amp;gt; ChannelFactory = &lt;span class="kwrd"&gt;new&lt;/span&gt; ChannelFactory&amp;lt;TChannel&amp;gt;(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;);

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; TReturn Use&amp;lt;TReturn&amp;gt;(Func&amp;lt;TChannel, TReturn&amp;gt; codeBlock)
    {
        var proxy = (IClientChannel)ChannelFactory.CreateChannel();
        var success = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
        &lt;span class="kwrd"&gt;try&lt;/span&gt;
        {
            var result = codeBlock((TChannel)proxy);
            proxy.Close();
            success = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
            &lt;span class="kwrd"&gt;return&lt;/span&gt; result;
        }
        &lt;span class="kwrd"&gt;finally&lt;/span&gt;
        {
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!success)
            {
                proxy.Abort();
            }
        }
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;And some bitterness for the end. It doesn’t look like Microsoft is in a hurry to fix Dispose while they should accordingly to their own &lt;a href="http://msdn.microsoft.com/en-us/library/bb386039.aspx"&gt;guidelines&lt;/a&gt;. But even knowing this I still like “using” and will probably be stick to it for smaller things. You see, my problem is that I have never-ever experienced inconveniences or issues because of this.&lt;/p&gt;

&lt;p align="justify"&gt;Is it same for you or do you have a story to share with me/others in your comment? :)&lt;/p&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/w4rM8tAVECM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/16375323728241962/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/05/how-to-consume-wcf-service-in-net.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/16375323728241962?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/16375323728241962?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/w4rM8tAVECM/how-to-consume-wcf-service-in-net.html" title="How to consume WCF service in .NET" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/05/how-to-consume-wcf-service-in-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMCSX0_eSp7ImA9WhBaFko.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-155587939883914485</id><published>2013-05-26T20:23:00.001+02:00</published><updated>2013-05-27T19:57:48.341+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-27T19:57:48.341+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>GMT vs. UTC and Time Zones in .NET</title><content type="html">&lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;Recently I had correspondence with HR from Great Britain. In one of the e-mails I wrote “16:00 CEST (UTC+2) would work for me” which confused the guy, so he asked what GMT UK time it is. If I was too much pedantic I could have replied that GMT is ~same as UTC and that in GMT it is 14:00. But of course it would confuse him even more. I replied with “3PM” as it was corresponding time in UK.&lt;/div&gt;  &lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;Problem is that 3PM (or 15:00) is not GMT time, but rather “GMT Standard Time + Daylight Saving Time” and when you look it up it is better called &lt;a href="http://www.timeanddate.com/library/abbreviations/timezones/eu/bst.html"&gt;BST&lt;/a&gt; – British Summer Time. On the other hand I also understand that for many people it is much easier to refer to their time zone as GMT (maybe for historical reasons). &lt;/div&gt;  &lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;I wouldn’t write this blog post if confusion was only in heads of ordinary people. Unfortunately big enterprises and small startups still frequently fail to write proper time zone handling in their applications.&lt;/div&gt;  &lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;Lets start with this: We no longer argue whether Earth is orbiting Sun or the other way around, the same way we no longer depend on some astronomical events to measure time, although none would like if at 1PM it was night. There is atomic clock invented which is ultimate truth of time, but since Earth is not spinning that precisely Coordinated Universal Time (UTC) has been developed. GMT is historical term and it would be great to leave it aside. &lt;/div&gt;  &lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;If you want to understand modern time measurements I would strongly recommend to read these two articles: &lt;a href="http://www.timeanddate.com/time/aboututc.html"&gt;Coordinated Universal Time (UTC) Explained&lt;/a&gt; and &lt;a href="http://www.timeanddate.com/time/gmt-utc-time.html"&gt;GMT and Other Time Systems Explained&lt;/a&gt;.&lt;/div&gt;  &lt;h5 style="text-align: left" dir="ltr" trbidi="on"&gt;Now bit more for not so ordinal people&lt;/h5&gt;  &lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;When it comes to source code things are not getting much cleaner. Answer to question “&lt;a href="http://stackoverflow.com/questions/2292334/difference-between-utc-and-gmt-standard-time-in-net"&gt;Difference between UTC and GMT Standard Time in .NET&lt;/a&gt;” at SO:&lt;/div&gt;  &lt;blockquote style="text-align: left" dir="ltr" trbidi="on"&gt;   &lt;div align="justify"&gt;GMT does &lt;i&gt;not&lt;/i&gt; adjust for daylight savings time. You can hear it from the horse's mouth on this &lt;a href="http://wwp.greenwichmeantime.com/what-is-gmt.htm"&gt;web site.&lt;/a&gt; Add this line of code to see the source of the problem:&lt;/div&gt;    &lt;pre class="csharpcode"&gt;Console.WriteLine(TimeZoneInfo.FindSystemTimeZoneById(&lt;span class="str"&gt;&amp;quot;GMT Standard Time&amp;quot;&lt;/span&gt;).SupportsDaylightSavingTime);&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, "Courier New", courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, "Courier New", courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

  &lt;br /&gt;

  &lt;div align="justify"&gt;Output: True.&lt;/div&gt;

  &lt;div align="justify"&gt;This is not a .NET problem, it is Windows messing up. The registry key that TimeZoneInfo uses is &lt;span style="color: maroon"&gt;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\GMT Standard Time&lt;/span&gt;&lt;/div&gt;

  &lt;div align="justify"&gt;You'd better stick with UTC.&lt;/div&gt;
&lt;/blockquote&gt;

&lt;div style="text-align: left" dir="ltr" trbidi="on"&gt;And I partially agree that it is Windows messing up for few reasons. If you look at corresponding to registry entry “GMT Standard Time” UI:
  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/-02w4-10O3t8/UaJTKgO6e5I/AAAAAAAA7ek/rP3M_DRKDTs/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-18zwrjUxZpI/UaJTN1MOamI/AAAAAAAA7es/aVoI6R7y0Z4/image_thumb%25255B2%25255D.png?imgmax=800" width="443" height="248" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;you will notice that it is displayed as UTC, but it is also DST adjustable. Now when you read this MSDN page about &lt;a href="http://msdn.microsoft.com/en-us/library/bb397783.aspx"&gt;TimeZoneInfo&lt;/a&gt;, you will get an impression that “standard times” are not DST adjustable, but when converting in .NET it actually takes daylight into account. Concluding I’m afraid that when dealing with time zone conversions we have to be very cautious.&lt;/div&gt;

&lt;div style="text-align: left" dir="ltr" trbidi="on"&gt;Conversion itself can be done utilizing class &lt;a href="http://msdn.microsoft.com/en-us/library/bb397783.aspx"&gt;TimeZoneInfo&lt;/a&gt; (same link again):

  &lt;br /&gt;&lt;/div&gt;

&lt;blockquote style="text-align: left" dir="ltr" trbidi="on"&gt;
  &lt;pre class="csharpcode"&gt;TimeZoneInfo GMT = TimeZoneInfo.FindSystemTimeZoneById(&lt;span class="str"&gt;&amp;quot;GMT Standard Time&amp;quot;&lt;/span&gt;);
DateTime postDateUtc = TimeZoneInfo.ConvertTimeToUtc(dbRecord.PostDateInLocalLondon, GMT);&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;And please be careful. You would need some exception handling and be ready for not-existing or ambiguous time. For example, see how this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;TimeZoneInfo GMT = TimeZoneInfo.FindSystemTimeZoneById(&lt;span class="str"&gt;&amp;quot;GMT Standard Time&amp;quot;&lt;/span&gt;);
DateTime notExistingInGmtTime = &lt;span class="kwrd"&gt;new&lt;/span&gt; DateTime(2013, 3, 31, 1, 30, 0, DateTimeKind.Unspecified);
DateTime dateInUtc = TimeZoneInfo.ConvertTimeToUtc(notExistingInGmtTime, GMT);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;would throw an exception. Reason is that there is no such time as 1:30AM on 31 March 2013 in London.&lt;/p&gt;

&lt;div style="text-align: left" dir="ltr" trbidi="on"&gt;
  &lt;br /&gt;&lt;/div&gt;

&lt;h5 style="text-align: left" dir="ltr" trbidi="on"&gt;How to work with Time, Dates and Time Zones in .NET&lt;/h5&gt;

&lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;Everything starts with basics. If you get them wrong how do you expect to write quality code? It is not a shame to read again about DateTime or even Boolean. Deep inside there is always something hidden – it just depends on depth.&lt;/div&gt;

&lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;In my career I’ve experienced quite many (as for such fundamental concept) different problems and inconveniences because of incorrect handling of time.&lt;/div&gt;

&lt;div style="text-align: left" dir="ltr" align="justify" trbidi="on"&gt;My rules of thumb:&lt;/div&gt;

&lt;div style="text-align: left" dir="ltr" trbidi="on"&gt;
  &lt;ul&gt;
    &lt;li&gt;
      &lt;div align="justify"&gt;Always persist date and time in UTC, otherwise save offset, but never-ever local time &lt;/div&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;div align="justify"&gt;Use DateTimeOffset – &lt;a href="http://blogs.msdn.com/b/davidrickard/archive/2012/04/07/system-datetime-good-practices-and-common-pitfalls.aspx"&gt;it is DateTime v2&lt;/a&gt;, otherwise at least make sure to avoid DateTime pitfalls&lt;/div&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;div align="justify"&gt;Be explicit about TimeZone used, in APIs I would also call date&amp;amp;time fields with suffix “Utc” (ugly?)&lt;/div&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;div align="justify"&gt;Convert to local time just before displaying &lt;/div&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;div align="justify"&gt;… and check for &lt;a href="http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices"&gt;best practices&lt;/a&gt; over internet &lt;/div&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;

&lt;div align="justify"&gt;Before finishing this post I would like to mention I have a task for myself as well: exploring &lt;a href="http://code.google.com/p/noda-time/"&gt;Noda Time&lt;/a&gt;. If you haven’t read &lt;a href="http://noda-time.blogspot.co.at/2011/08/what-wrong-with-datetime-anyway.html"&gt;What's wrong with DateTime anyway?&lt;/a&gt; you should!&lt;/div&gt;

&lt;div align="justify"&gt;… and, sorry but had to copy &lt;b&gt;one final issue&lt;/b&gt;…&lt;/div&gt;

&lt;blockquote&gt;
  &lt;div align="justify"&gt;If it is Coordinated Universal Time, why is the acronym UTC and not CUT? When the English and the French were getting together to work out the notation, the french wanted TUC, for Temps Universel Coordonné. UTC was a compromise: it fit equally badly for each language. :)&lt;/div&gt;&lt;/blockquote&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/KTJg49kUZvc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/155587939883914485/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/05/gmt-vs-utc-and-time-zones-in-net.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/155587939883914485?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/155587939883914485?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/KTJg49kUZvc/gmt-vs-utc-and-time-zones-in-net.html" title="GMT vs. UTC and Time Zones in .NET" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-18zwrjUxZpI/UaJTN1MOamI/AAAAAAAA7es/aVoI6R7y0Z4/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/05/gmt-vs-utc-and-time-zones-in-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEGRHkzcCp7ImA9WhBVEUk.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-4233337120810249228</id><published>2013-04-12T21:15:00.001+02:00</published><updated>2013-04-16T22:20:25.788+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-16T22:20:25.788+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tools" /><title>NDepend – a great tool to know more about your code</title><content type="html">&lt;p align="justify"&gt;I’ve always been working in enterprise projects. They usually involve tons of code and sophisticated extensive dependencies inside of code base.&lt;/p&gt;  &lt;p align="justify"&gt;On the other hand I’m keen on keeping code as clean and simple as possible. But how do you find problems quickly within huge set of solutions/projects/assemblies when lot of teams work on those? You have no idea who writes good and who writes bad code or where to look for potential bugs or ugly design.&lt;/p&gt;  &lt;p align="justify"&gt;When you have to analyze a lot of code there is no better static analysis tool than NDepend. There are quite a lot of tools which could perform some analysis here and there, but biggest advantage of NDepend is that everything is in one nice package.&lt;/p&gt;  &lt;p align="justify"&gt;Probably the most exciting feature of NDepend is Code Query LINQ. It allows you to write your own customized queries. Want to see all methods that have cyclomatic complexity higher than 5 and with more than 15 lines of code? Not a problem. Just run this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;from&lt;/span&gt; m &lt;span class="kwrd"&gt;in&lt;/span&gt; JustMyCode.Methods &lt;span class="kwrd"&gt;where&lt;/span&gt; 
  m.NbLinesOfCode &amp;gt; 15 &amp;amp;&amp;amp;
  m.CyclomaticComplexity &amp;gt; 5

&lt;span class="kwrd"&gt;select&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; { m, m.NbLinesOfCode, m.CyclomaticComplexity} &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;As easy as that. Double click on a method and you are already editing it in Visual Studio.&lt;/p&gt;

&lt;p align="justify"&gt;I also like that tool provides analysis on different levels of details. On bigger scale you can identify problematic assemblies. For this purpose there are couple of features. One of them is “Abstractness vs. Instability”. It generates great image with distribution of your assemblies.&lt;/p&gt;

&lt;p align="justify"&gt;Image below was generated for one of projects I’m working on. If most of your assemblies fit into green zone than there is a good balance between abstractness vs. instability. I’m proud to say that code which I write always is in “green zone”.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-bBonTX_jxbI/UW2xDeMZS9I/AAAAAAAA7KY/Eo2BNhm29ek/s1600-h/image%25255B49%25255D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-9ku2z--FR6c/UWxQhZ3OkYI/AAAAAAAA7Kg/1AUL222D4HY/image_thumb%25255B35%25255D.png?imgmax=800" width="755" height="755" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p align="justify"&gt;I went through few of our projects and indeed projects with problematic code base is usually close or is in orange zone. It can be considered bad if you are in “Zone of Pain”. Scott Hanselman has nice post on this and NDepend in general called “&lt;a href="http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx"&gt;Exiting The Zone of Pain - Static Analysis with NDepend&lt;/a&gt;”. Check it out.&lt;/p&gt;

&lt;p align="justify"&gt;Another high-scale features would be “dependency graph” and “dependency matrix”. While first one is something that comes with VS (well Ultimate), second one is more sophisticated and not found that frequently in other tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-AkJ_AVMGmTo/UWxQiYT1R-I/AAAAAAAA7Kk/UBA2-HO3vqs/s1600-h/image%25255B31%25255D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-m15mLluokXc/UWxQjK4FDPI/AAAAAAAA7Ko/uAcijKTjHxY/image_thumb%25255B21%25255D.png?imgmax=800" width="761" height="673" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p align="justify"&gt;This feature gives you complex matrix of all dependencies all the way between assemblies. You can expand it to classes and even methods. On the picture above a dependency cycle is shown. What is great about NDepend is that it always explains in plan English why and what is shown. In this particular situation there was cycle dependency because compiler generated help class for linq query, so I ignored it as I cannot do much about it. But you never know, next time you might have a problem with your code.&lt;/p&gt;

&lt;p align="justify"&gt;When you run analysis NDepend would check against built-in code quality queries. What you get is something as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-DVzaEw9inqg/UW2xH-w8EGI/AAAAAAAA7Ks/BBSU-cmDDDI/s1600-h/image%25255B46%25255D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-7YhWqUTAo80/UW2xI6-dwkI/AAAAAAAA7K0/AuyekPulLBU/image_thumb%25255B32%25255D.png?imgmax=800" width="817" height="358" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p align="justify"&gt;When you click on items on the right you get detailed list of matched classes/methods so you can go through them and verify if anything has to be changed. To be honest even that I’m very scrupulous when it comes to code quality, I discover a lot of new things for myself. &lt;/p&gt;

&lt;p align="justify"&gt;For example I got this in section “.NET Framework Usage”: &lt;em&gt;Collection properties should be read only&lt;/em&gt; with an explanation from MSDN:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;// A writable collection property allows a user to replace the collection with 
    &lt;br /&gt;// a completely different collection. A read-only property stops the collection 

    &lt;br /&gt;// from being replaced but still allows the individual members to be set. 

    &lt;br /&gt;// If replacing the collection is a goal, the preferred design pattern is to 

    &lt;br /&gt;// include a method to remove all the elements from the collection 

    &lt;br /&gt;// (with a call to the ICollection.Clear() method) and then re-populate the collection.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Of course it makes sense, but I just never thought about it. And there are many-many other things which you can learn from the tool only by using it.&lt;/p&gt;

&lt;p align="justify"&gt;During my working experience I started to think that people tend to create too many projects in VS when they finally feel comfortable with doing so. I like when there are as few assemblies as possible. Folders/namespaces are very good logical separation of code, there is no need in assemblies A, B and C if they always run in same application domain and depend on same stuff. NDepend team advices this and also reasons about it. You can read their “white-books”.&lt;/p&gt;

&lt;p align="justify"&gt;Other cool thing about NDepend is that it can be integrated with Visual Studio and Reflector. When you run NDepend it provides you with start page which proposes these add-ins for you. This is very handy.&lt;/p&gt;

&lt;p align="justify"&gt;It is natural that NDepend has console so you can run it from you scripts.&lt;/p&gt;

&lt;p align="justify"&gt;You can see complete list of NDepend features here: &lt;a title="http://www.ndepend.com/Features.aspx" href="http://www.ndepend.com/Features.aspx"&gt;http://www.ndepend.com/Features.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;I’m afraid that my thoughts were somehow not well structured, I just picked some of the capabilities NDepend has and did not talk much about different use cases, but don’t worry. You will find answers to all your questions on web site: &lt;a href="http://www.ndepend.com/"&gt;www.ndepend.com/&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;In my current company NDepend is integrated in build process, in my previous company I used it occasionally to see how we progress over time. Big companies usually take code quality seriously as smallest design flaws now could mean a lot of money leaks in future. Of course everything boils down to employees, but if they have right tools at their disposal you are protecting yourself. This great tool has a price that for sure doesn’t break the bank especially for company that claims to ship high quality software.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/2n_ODB5yPnY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/4233337120810249228/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/04/ndepend-great-tool-to-know-more-about.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4233337120810249228?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4233337120810249228?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/2n_ODB5yPnY/ndepend-great-tool-to-know-more-about.html" title="NDepend – a great tool to know more about your code" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-9ku2z--FR6c/UWxQhZ3OkYI/AAAAAAAA7Kg/1AUL222D4HY/s72-c/image_thumb%25255B35%25255D.png?imgmax=800" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/04/ndepend-great-tool-to-know-more-about.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIMR3g5cSp7ImA9WhBREkg.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-1223033535820002207</id><published>2013-02-18T23:34:00.001+01:00</published><updated>2013-03-02T19:56:26.629+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-02T19:56:26.629+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tools" /><category scheme="http://www.blogger.com/atom/ns#" term="QuickTip" /><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><title>IIS Logging hints: (Log Parser + Log Parser Studio + IIS Advanced Logging)</title><content type="html">&lt;p align="justify"&gt;Rather than starting this blog post with first excusing about me being not much into IIS. I will share very simple but extremely powerful toolset to be aware how your web application is living its life.&lt;/p&gt;  &lt;p align="justify"&gt;Of course any good application has exception handling and logging in place therefor you know when “shit happens” and possibly able to dig into it, find root cause and fix. Great! But what if you want to know more? What if you want to see some graphics showing distribution of users, their favourite features, pick hours, etc? To some extend Google Analytics could satisfy your needs. I use it for this blog and it is absolutely brilliant there.&lt;/p&gt;  &lt;p align="justify"&gt;You could have better tool in your hands? Plain simple. Plain power.&lt;/p&gt;  &lt;h4&gt;First. Enable your IIS Logging&lt;/h4&gt;  &lt;p&gt;To enable IIS logging use &lt;a href="http://support.microsoft.com/kb/313437"&gt;this&lt;/a&gt; boring step-by-step explanation. Or find this self-explanatory nice pictogram &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-ugLCblaQ2ZA/UTJJ7kuXapI/AAAAAAAA7Ho/-AfjSk3SA_0/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-WbdWfSdfluU/UTJJ8fyjyHI/AAAAAAAA7Hw/EHNfK_zGHSU/image_thumb%25255B1%25255D.png?imgmax=800" width="54" height="62" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;in IIS manager. After enabling it in actions section your logs will be collected accordingly to configuration. (Say for application with high load you might want to change configuration to generate a new log file for each hour.)&lt;/p&gt;  &lt;h4&gt;Second. Analyse what’s inside&lt;/h4&gt;  &lt;p align="justify"&gt;Well, first step could be considered as waste of keystrokes for some of you as you find it natural to have IIS logging enabled. But I also know that there are applications running for which no one ever collected any logs and have only preliminary idea how their applications are used and what is happening at all.&lt;/p&gt;  &lt;p align="justify"&gt;Here is bit of my story: We develop HTTP API used by various front-ends. Now we rewrite one of our heavily used endpoints. Therefor it was needed to know usage patterns (GET method parameters) and picks. I was able to quickly find everything out. The most time consuming was to download all those gigs of logs. But as soon as they are easily accessible, everything is piece of cake. Just continue reading…&lt;/p&gt;  &lt;p align="justify"&gt;You would need some tool to start analysing your logs.&lt;/p&gt;  &lt;p align="justify"&gt;Best fit would be Microsoft LogParser. &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=24659"&gt;Download it&lt;/a&gt;. It is console application which allows to query stuff with SQL-like queries. I said “stuff” because it is not only logs. Have a look on this LogParser architecture diagram:&lt;/p&gt;  &lt;p&gt;&lt;img border="0" alt="logparser_architecture.gif" src="http://codinghorror.typepad.com/.a/6a0120a85dcdae970b0128776fb331970c-pi" width="414" height="429" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Output could be also charts (though there is dependency on MsOffice). For example this could be chart of non-200 status codes:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-PgFA9vknUqA/UTJJ9HsG1CI/AAAAAAAA7H4/1rdLpj4i6IQ/s1600-h/clip_image001%25255B12%25255D.gif"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://lh4.ggpht.com/-x77RT5rWQ1Q/UTJJ9x9WHlI/AAAAAAAA7IA/DI3_rxNXNZ0/clip_image001_thumb%25255B9%25255D.gif?imgmax=800" width="344" height="264" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;You can utilize this to to build nice reporting system with graphics to be sent to development team and/or managers.&lt;/p&gt;  &lt;h5&gt;Log Parser Studio&lt;/h5&gt;  &lt;p&gt;What if you want to quickly analyse something without bothering with console app?&lt;/p&gt;  &lt;p&gt;There is &lt;a href="http://blogs.technet.com/b/exchange/archive/2012/03/07/introducing-log-parser-studio.aspx"&gt;Log Parser Studio&lt;/a&gt; – an excellent and handy tool.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-9M-M95wna6Q/UTJJ-peT-xI/AAAAAAAA7II/sZGNZHM_g4A/s1600-h/image%25255B8%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-kVmeGa9F2FQ/UTJJ_oUTEkI/AAAAAAAA7IQ/uInaIreNvio/image_thumb%25255B4%25255D.png?imgmax=800" width="640" height="411" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;When you just started it library of different queries is shown to you along with possibility to search among them. So you have a great starting point for your custom queries.&lt;/p&gt;  &lt;p&gt;For example here is simple query I just used:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;SELECT &lt;/span&gt;QUANTIZE(TO_TIMESTAMP(&lt;span class="kwrd"&gt;date&lt;/span&gt;, &lt;span class="kwrd"&gt;time&lt;/span&gt;), 60) &lt;span class="kwrd"&gt;AS&lt;/span&gt; Minute,
    sc-status,
    &lt;span class="kwrd"&gt;COUNT&lt;/span&gt;(*) &lt;span class="kwrd"&gt;AS&lt;/span&gt; Total
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; *.log
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; (cs-uri-stem &lt;span class="kwrd"&gt;like&lt;/span&gt; &lt;span class="str"&gt;'%SuspicionsEndpoint.svc%'&lt;/span&gt;) &lt;span class="kwrd"&gt;and&lt;/span&gt; (sc-status = 500)
&lt;span class="kwrd"&gt;GROUP&lt;/span&gt; &lt;span class="kwrd"&gt;BY&lt;/span&gt; sc-status, Minute
&lt;span class="kwrd"&gt;ORDER&lt;/span&gt; &lt;span class="kwrd"&gt;BY&lt;/span&gt; Minute&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;I have found &lt;a href="http://logparserplus.com/Functions"&gt;this page&lt;/a&gt; to be extremely useful as reference for functions in LogParser.&lt;/p&gt;

&lt;p align="justify"&gt;Be aware that LogParser doesn’t support everything available in SQL. When I tried to write something bit more complex like distinct count with grouping it complained. At least LogParser provided meaningful explanation so I knew that feature isn’t implemented. I had to use temporary file to achieve what I wanted. &lt;/p&gt;

&lt;h4&gt;Third (if you want more from IIS). Install Advanced Logging&lt;/h4&gt;

&lt;p&gt;You might be in situation when default logging fields are not enough for you:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-POJscTe2DJ4/UTJKAfV4fZI/AAAAAAAA7IY/tENND4Kv6fY/s1600-h/image%25255B15%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-a74i0zoX6BY/UTJKBHPQL7I/AAAAAAAA7Ig/o8Z0XG5NrD0/image_thumb%25255B9%25255D.png?imgmax=800" width="449" height="536" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;For example, some token information is supplied in http header. No worries – &lt;a href="http://www.iis.net/downloads/microsoft/advanced-logging"&gt;Install IIS Advanced Logging&lt;/a&gt; extension. Now you look for this pictogram:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-qwSYDpRfbdQ/UTJKB8lQ9iI/AAAAAAAA7Io/qdVfGPCxgUw/s1600-h/image%25255B20%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/--7WX67lhyKY/UTJKCpYJtuI/AAAAAAAA7Iw/E2xqYT6bSOE/image_thumb%25255B12%25255D.png?imgmax=800" width="61" height="75" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setup and configuration is somewhat more complex.&lt;/p&gt;

&lt;p&gt;Here is great step-by-step with pictures: &lt;a title="http://www.iis.net/learn/extensions/advanced-logging-module/advanced-logging-for-iis-custom-logging" href="http://www.iis.net/learn/extensions/advanced-logging-module/advanced-logging-for-iis-custom-logging"&gt;http://www.iis.net/learn/extensions/advanced-logging-module/advanced-logging-for-iis-custom-logging&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here is mine shorter example. Say you want to include custom http request header:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&amp;quot;Add Log Definition…” &lt;/li&gt;

  &lt;li&gt;Configure it and include few common logging fields and save &lt;/li&gt;

  &lt;li&gt;Navigate back to “Advanced Logging”, select your definition and hit “Edit Logging Fields…” &lt;/li&gt;

  &lt;li&gt;Add logging field: &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://lh4.ggpht.com/-1En1oNolvYM/UTJKDqR3O_I/AAAAAAAA7I4/ehXO-AT86JQ/s1600-h/image%25255B30%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-n7siShDGPiM/UTJKEX1h_gI/AAAAAAAA7JA/rpu_verOSYM/image_thumb%25255B20%25255D.png?imgmax=800" width="340" height="293" /&gt;&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Use it in your definition &lt;/li&gt;

  &lt;li&gt;Enable your definition for web site (if not yet enabled) &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There you go. At this moment you can analyse even more information with Log Parser or nice Log Parser Studio.&lt;/p&gt;

&lt;p&gt;Hope this post is of help for those who want to know more about their application!&lt;/p&gt;

&lt;p&gt;Quick links:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=24659"&gt;Log Parser download page&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://blogs.technet.com/b/exchange/archive/2012/03/07/introducing-log-parser-studio.aspx"&gt;Log Parser Studio&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://logparserplus.com/Functions"&gt;Log Parser Functions&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.iis.net/downloads/microsoft/advanced-logging"&gt;Advanced Logging Extension&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.iis.net/learn/extensions/advanced-logging-module/advanced-logging-for-iis-custom-logging"&gt;Step-by-step configuration of advanced logging&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/IqjrazV8kBc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/1223033535820002207/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/02/iis-logging-hints-log-parser-log-parser.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/1223033535820002207?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/1223033535820002207?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/IqjrazV8kBc/iis-logging-hints-log-parser-log-parser.html" title="IIS Logging hints: (Log Parser + Log Parser Studio + IIS Advanced Logging)" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-WbdWfSdfluU/UTJJ8fyjyHI/AAAAAAAA7Hw/EHNfK_zGHSU/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/02/iis-logging-hints-log-parser-log-parser.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YBQ3ozeyp7ImA9WhNaFUk.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-4994075473772923953</id><published>2013-01-30T01:08:00.001+01:00</published><updated>2013-01-30T12:25:52.483+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-30T12:25:52.483+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="YearPlanReport" /><title>2013: Where Do You Want to Be In a Year?</title><content type="html">&lt;p align="justify"&gt;Dear Reader,&lt;/p&gt;  &lt;p align="justify"&gt;I always thought that it is important to keep track of things you are doing and also to have a plan so that you know where you are moving and where you want to be.&lt;/p&gt;  &lt;p align="justify"&gt;This is continuation of my year &lt;a href="http://andriybuday.blogspot.com/search/label/YearPlanReport"&gt;plan/report thread&lt;/a&gt;. I had similar plan for &lt;a href="http://andriybuday.blogspot.com/2010/01/where-do-you-want-to-be-in-year.html"&gt;2010&lt;/a&gt;, &lt;a href="http://andriybuday.blogspot.com/2011/01/where-do-you-want-to-be-in-year.html"&gt;2011&lt;/a&gt; and for &lt;a href="http://www.andriybuday.com/2012/01/where-do-you-want-to-be-in-year.html"&gt;2012&lt;/a&gt;. &lt;a href="http://andriybuday.blogspot.com/2011/01/what-has-been-done-during-last-year.html"&gt;Completion of 2010&lt;/a&gt; list was almost 100% successful, &lt;a href="http://andriybuday.blogspot.com/2012/01/what-i-have-done-in-2011.html"&gt;completion of 2011&lt;/a&gt; list was less successful. &lt;a href="http://www.andriybuday.com/2013/01/what-i-have-done-in-2012.html"&gt;2012 list completion&lt;/a&gt; is somewhere in between. Both 2011 and 2012 greatly changed my life. Same is expected in the year 2013.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Here below is my resolution list for 2013&lt;/b&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The best thing which could happen&lt;/li&gt;    &lt;li&gt;Travel a lot&lt;/li&gt;    &lt;li&gt;Buy a car&lt;/li&gt;    &lt;li&gt;Ski high in the Alps&lt;/li&gt;    &lt;li&gt;Learn German for real A2&lt;/li&gt;    &lt;li&gt;Improve English fluency by applying more synonymous and idioms&lt;/li&gt;    &lt;li&gt;Perform well &amp;amp; keep being challenged at work&lt;/li&gt;    &lt;li&gt;Contribute to open source&lt;/li&gt;    &lt;li&gt;Deliver many technical presentations &lt;/li&gt;    &lt;li&gt;Extend social network at work &amp;amp; outside&lt;/li&gt;    &lt;li&gt;Write some web project&lt;/li&gt;    &lt;li&gt;Do programming in other languages than C#&lt;/li&gt;    &lt;li&gt;Take part in one or few programming contests&lt;/li&gt;    &lt;li&gt;Visit one or few conferences&lt;/li&gt;    &lt;li&gt;Improve blog quality&lt;/li&gt;    &lt;li&gt;Write at least 41 blog posts &lt;/li&gt;    &lt;li&gt;Increase community visibility &lt;/li&gt;    &lt;li&gt;Read as many books as I like &lt;/li&gt;    &lt;li&gt;Consistently do exercises&lt;/li&gt;    &lt;li&gt;Reach 2013 reputation at stackoverflow&lt;/li&gt;    &lt;li&gt;Earn 2013 euro outside&lt;/li&gt; &lt;/ol&gt;  &lt;p align="justify"&gt;I tried to keep each point very concise therefore my list may be lacking some of SMART-iness, but in a light of high unpredictability for a long term it would be much easier to remember and follow such a plan.&lt;/p&gt;  &lt;p align="justify"&gt;What do you want to do in this year? Any good suggestions for me?&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/tecLjS5MNLM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/4994075473772923953/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/01/2013-where-do-you-want-to-be-in-year.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4994075473772923953?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4994075473772923953?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/tecLjS5MNLM/2013-where-do-you-want-to-be-in-year.html" title="2013: Where Do You Want to Be In a Year?" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/01/2013-where-do-you-want-to-be-in-year.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cBQ3g9cCp7ImA9WhNaEEo.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-5616990895769294211</id><published>2013-01-21T00:24:00.001+01:00</published><updated>2013-01-25T00:44:12.668+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-25T00:44:12.668+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Success" /><category scheme="http://www.blogger.com/atom/ns#" term="YearPlanReport" /><title>What I have done in 2012</title><content type="html">&lt;p align="justify"&gt;I tend to have very ambitious plans and even realizing this I never regret because I believe that the higher you mark the higher you are going to reach. Of course there is some frustration and dissatisfaction when it is time for a review. If it is the case for you just neglect all bad and continue looking forward. Life is too short to spoil it with negative emotions. I visited so many places in the past year I wouldn’t believe if you told me this year before. Great and deep feelings of pleasant moments travelling somewhere in Europe together with my wife is the best thing taken from passed year. I hardly remember last piece of code I worked on, but I clearly see golden sun smoothly going down on the beach of Falassarna.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-NYuBM50axjY/UBZfIekt3uI/AAAAAAAAHrY/gbl9lVKccnQ/s640/DSC_0229.JPG" width="640" height="362" /&gt;&lt;/p&gt;  &lt;h5&gt;Overview of 2012&lt;/h5&gt;  &lt;p align="justify"&gt;At the beginning of 2012 my life was about to change much once again. I changed my job, but this time it also meant change of a country. While we were finishing relocation paper work I tried to enjoy last month of being unemployed. I went skiing many times and slept well. Besides I released my e-book on design patterns.&lt;/p&gt;  &lt;p align="justify"&gt;Suddenly we appeared in Austria. Here is picture of me in front of my company’s logo at first day of our arrival:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-fWtkV-5pBuA/UQHHQMIU_TI/AAAAAAAA7HU/TggyqSVRz_s/s1600-h/WP_000304%25255B1%25255D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="WP_000304" border="0" alt="WP_000304" src="http://lh4.ggpht.com/-yN808WfUa_Y/UPx8nUrOUQI/AAAAAAAA7Hc/IF0YJ4H_s2w/WP_000304_thumb.jpg?imgmax=800" width="640" height="480" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Finding an apartment was a first challenge. After overcoming it and few others we almost stopped worrying. Starting in a completely different country and company with different mindset was extremely interesting and exciting.&lt;/p&gt;  &lt;p align="justify"&gt;After some acclimatization me and wife started to travel. Leveraging &lt;a href="http://en.wikipedia.org/wiki/Schengen_Area"&gt;Schengen Area&lt;/a&gt; we really travelled a lot, I even did not expect that much. You will find complete list later on.&lt;/p&gt;  &lt;p align="justify"&gt;My professional life though did not thrive much in the past year. For sure I’ve improved my skills in many areas. For example my English has improved and a lot of new working experience was gained. I also learned some new to me approaches of delivering software and understood a lot about new company setup and its product available and used by millions. Additionally I introduced myself to few programming languages and did some pet programming.&lt;/p&gt;  &lt;p align="justify"&gt;Year ended with long vacation back in Ukraine together with my parents, friends and relatives. I wish I could be in many places at the same time.&lt;/p&gt;  &lt;h5&gt;Plan completeness&lt;/h5&gt;  &lt;p&gt;Now lets look at each of the items I planned year ago in my &lt;a href="http://www.andriybuday.com/2012/01/where-do-you-want-to-be-in-year.html"&gt;2012 “Where do you want to be in a Year?”&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Buy a car in Europe (some used German car)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Car is a whole separate topic. Turns out that keeping car in Europe is quite expensive. Just mandatory insurance costs close to 100 Euro each month. Of course it depends on car size and your driving experience and can be much decreased if you willing to drive Matiz while having 9 years driving background.&lt;/p&gt;  &lt;p align="justify"&gt;I didn’t buy a car in 2012 for myself, but I bought people carrier for my father. It was first time I really leveraged from duty fee. 20% of taxes were returned when I brought back confirmation of exporting car out of EU. Well registering car in Ukraine is tough task and I’m glad I didn’t have to deal with it.&lt;/p&gt;  &lt;p align="justify"&gt;In addition I now hold Austrian driving license and proud to state that I passed an exam with my first try. It might sound ridiculous, but many friends I know here didn’t pass exam immediately, even they had some experience from Ukraine. Even 3 other fellows who tried to pass exam same day with me have failed. One try costs 130, printed license costs 90 and medical check 35. Total 225 euro just to get license if you already hold one from other country. If you want to pass it from scratch it would cost around 1,3K.&lt;/p&gt;  &lt;p align="justify"&gt;If you do the math, renting car is by far more cheaper and preferable over owning one if you only have some weekend trips time-to-time. Unfortunately I cannot drive to Ukraine by hired car. This year I drove Hyundai i40, Hyundai Accent, Opel Corsa, Opel Astra. As of not rented I drove Hyundai i20, Fiat Scudo carrying twice as many people as in normal car and finally I had a chance to drive my Chevrolet before I sold it. I think I like driving.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Travel though major &lt;/strong&gt;&lt;a href="http://en.wikipedia.org/wiki/List_of_cities_and_towns_in_Austria"&gt;&lt;strong&gt;cities in Austria&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; (Vienna, Salzburg, Linz, Graz, Innsbruck, Bregenz, Eisenstadt, Klagenfurt)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;It would be a titanic work to write about all places we visited with my wife during passed 2012 year, but thanks to her there is report on each of our travel. Below is list in chronological order with links to her blog.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/01/3-2012_2966.html"&gt;Dubno&lt;/a&gt;-&lt;a href="http://natalasseit.blogspot.co.at/2012/01/3-2012.html"&gt;Rivne&lt;/a&gt;-&lt;a href="http://natalasseit.blogspot.co.at/2012/01/blog-post.html"&gt;Luts’k&lt;/a&gt; (still Ukraine) &lt;/li&gt;    &lt;li&gt;Vienna (dozen of posts on our life in this beautiful city &lt;a href="http://natalasseit.blogspot.co.at/search/label/%D0%92%D1%96%D0%B4%D0%B5%D0%BD%D1%8C"&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/04/blog-post_22.html"&gt;Baden&lt;/a&gt; (Austria) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/04/blog-post_25.html"&gt;Graz&lt;/a&gt; (Austria) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/05/wildalpen.html"&gt;Alps&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/05/blog-post.html"&gt;Linz&lt;/a&gt; (Austria) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/05/blog-post_29.html"&gt;Venice&lt;/a&gt; (Italy) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/06/blog-post_16.html"&gt;Berlin&lt;/a&gt; (Germany) &lt;/li&gt;    &lt;li&gt;Whole week of Greece: start with &lt;a href="http://natalasseit.blogspot.co.at/2012/07/1.html"&gt;Athens&lt;/a&gt; and continue to &lt;a href="http://natalasseit.blogspot.co.at/2012/07/4.html"&gt;Kreta island&lt;/a&gt; &lt;a href="http://natalasseit.blogspot.co.at/2012/07/6.html"&gt;beaches&lt;/a&gt; and &lt;a href="http://natalasseit.blogspot.co.at/2012/07/5.html"&gt;adventures&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/08/blog-post.html"&gt;Bratislava&lt;/a&gt; (Slovakia) &lt;/li&gt;    &lt;li&gt;More of awesome Alps, including &lt;a href="http://natalasseit.blogspot.co.at/2012/09/blog-post_19.html"&gt;ice cave&lt;/a&gt; and astonishing &lt;a href="http://natalasseit.blogspot.co.at/2012/09/liechtensteinklamm.html"&gt;Hallstatt and Liechtensteinklamm&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/10/blog-post_590.html"&gt;Amsterdam&lt;/a&gt; (Holland) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/10/blog-post_19.html"&gt;Brussels&lt;/a&gt; and &lt;a href="http://natalasseit.blogspot.co.at/2012/10/brugge-belgie.html"&gt;Brugge&lt;/a&gt; (Belgium) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://natalasseit.blogspot.co.at/2012/11/paris-france_14.html"&gt;Paris&lt;/a&gt; (France) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I won’t start commenting on those above, because it would take ages. If you can read Ukrainian you have all stories there, otherwise just see some pictures.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Sport activities (have two-three summer hikes into the Alps &amp;amp; ski in the Alps)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;I don’t have a bike. But you can ride one completely free of charge here in Vienna. You just register with your credit card and whenever you use bike less than 1 hour you are not charged. Me and wife used this to spend many summer days with joy and benefit for health. We also had one hike in Alps &lt;a href="http://natalasseit.blogspot.co.at/2012/08/reichenau-der-rax.html"&gt;Reichenau an der Rax&lt;/a&gt;. So far I went skiing only once and not in so distant Alps. Want to ski in some “real” Alps.&lt;/p&gt;  &lt;p align="justify"&gt;Generally I’m not completely satisfied with completeness of this point. But environment in Austria is more suitable for active life. People ride, run, walk really lot in dozen of parks.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Learn German for at &lt;/strong&gt;&lt;a href="http://en.wikipedia.org/wiki/Common_European_Framework_of_Reference_for_Languages"&gt;&lt;strong&gt;A2 level&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; (which is elementary)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Ich glaube meine Deutsch ist noch zu schlecht. I attended one intensive course and also joined language courses offered by my company. Placement test reckons me for A2 level. I doubt it being even close to truth, but I will continue with German in 2013.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Improve English and rich C1 level (which is advanced)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Probably C1 is pre-advance. For sure I’ve improved my English. Online estimation gives me 7.7K known words versus 4.9K in the beginning of the year. But dictionary is very small portion of what can be considered as proficiency in a language. Fluency in speech is very important. Everyday work in English-speaking environment is a great advantage.&lt;/p&gt;  &lt;p align="justify"&gt;I have extensive blog post on languages I use here in Austria, called “&lt;a href="http://www.andriybuday.com/2012/04/die-frage-of-language.html"&gt;Існує die Frage of Language. Или нет?&lt;/a&gt;”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Show kick-ass performance at work&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;For sure I performed really well. Many of my skills were noticed and acknowledged, especially technical ones. On the other hand I’m still lacking in self-confidence and communication skills and maybe some other soft skills. There is already one conference I’m going to visit to improve some of those. But I also doubt that I’m so bad in such things, as I have already been in role of tech lead and it was quite smooth. I think I need more time and motivation which is melting in new company.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Get promotion (or get clear idea on career opportunities, if not possible)&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;I think I now have much better idea on career opportunities and raises. It is completely out of synch with what I expected when I just started. Have you seen films in which guys work years to get any promotion meanwhile fighting with others to be pick number one. Of course it is not that severe as in movies, but there are many factors which make it closer to movies than to Ukrainian IT reality.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- In Vienna find local .net community (&lt;/strong&gt;&lt;a href="http://weblogs.thinktecture.com/cnagel/ineta/"&gt;&lt;strong&gt;user group&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;, whatsoever) and join&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;As per me .NET user group here is marketing driven and besides is held in German so not something I can join easily, at least not for first years. Overall IT market is rather small here.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Visit &lt;/strong&gt;&lt;a href="http://europe.msteched.com/"&gt;&lt;strong&gt;TechEd Europe&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; or &lt;/strong&gt;&lt;a href="http://www.ndcoslo.com/"&gt;&lt;strong&gt;NDC2012&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; (if possible because of budged considerations)&lt;/strong&gt; &lt;/p&gt;  &lt;p align="justify"&gt;I’m too greedy to spend almost 2K euro on conference while videos can be downloaded later. It is exactly what I did. Watched dozen of those. Though I visited &lt;a href="http://www.andriybuday.com/2012/09/professional-net-2012-vienna-austria.html"&gt;small conference&lt;/a&gt; kindly offered by company.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Have new friends in Austria, who share same opinions&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Many new friends, but I wouldn’t say that I have any Austrian as my real friend. Also by “same opinions” I largely meant interest in technical topics. It is even worse with that. I tried &lt;a href="http://www.andriybuday.com/2012/10/code-beer-functional-programming.html"&gt;code and beer&lt;/a&gt; session and it didn’t go well. I hope it is just matter of time.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Write couple of WP7 applications and post them to marketplace&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Nothing in marketplace. Played a bit with couple of ideas, but gave up. Not sure I still want to do this. I wrote couple of Win8Metro applications for fun and also gave up. It would be not fair to say that I competed this point.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Release “&lt;/strong&gt;&lt;a href="http://andriybuday.blogspot.com/2011/12/help-me-finish-my-book-need-you-for.html"&gt;&lt;strong&gt;Design Patterns&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;” Book – I have 1 month to do so&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I’m happy to know that I didn’t leave Ukrainian IT without any of my contribution.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.andriybuday.com/p/book.html"&gt;Book&lt;/a&gt; has been released and is available on its &lt;a href="http://designpatterns.andriybuday.com/"&gt;web site&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Read 15 books (see &lt;/strong&gt;&lt;a href="http://ua.linkedin.com/in/andriybuday"&gt;&lt;strong&gt;my LinkedIn&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; reading list)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I read 7 books and have way too many in progress. Us usual there are &lt;a href="http://www.andriybuday.com/search/label/Book%20Reviews"&gt;Book Reviews&lt;/a&gt; on my blog.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Learn programming language(s). I will start with “&lt;/strong&gt;&lt;a href="http://pragprog.com/book/btlang/seven-languages-in-seven-weeks"&gt;&lt;strong&gt;7 languages in 7 weeks&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;” and then pick up one for deeper insight (not compulsory from book)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This year I tried many programming languages. Here are my posts on each of the languages from the book:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Haskell"&gt;Haskell&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Scala"&gt;Scala&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Erlang"&gt;Erlang&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Clojure"&gt;Clojure&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/IoLanguage"&gt;Io&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Prolog"&gt;Prolog&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.andriybuday.com/search/label/Ruby"&gt;Ruby&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;- Discipline myself to get up at some certain time&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We have daily standup meeting at 10:30 so it forces me to be up at latest at 10AM. I cannot say that I failed with this, but also not completely what I wanted.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;- Have more public visibility and community impact&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This year I had drastically much less public visibility than year before.&lt;/p&gt;  &lt;h5&gt;More to come&lt;/h5&gt;  &lt;p align="justify"&gt;I’m planning to have blog post on working experience here in Austria in general and in comparison with Ukraine as it could be very interesting for many of you.&lt;/p&gt;  &lt;p align="justify"&gt;Next year is promising to be life changing once again!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/iGbMXl9SMSI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/5616990895769294211/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2013/01/what-i-have-done-in-2012.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5616990895769294211?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5616990895769294211?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/iGbMXl9SMSI/what-i-have-done-in-2012.html" title="What I have done in 2012" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-NYuBM50axjY/UBZfIekt3uI/AAAAAAAAHrY/gbl9lVKccnQ/s72-c/DSC_0229.JPG" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.andriybuday.com/2013/01/what-i-have-done-in-2012.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQGSXszeCp7ImA9WhNVEkQ.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-7980765276620251153</id><published>2012-12-18T00:52:00.001+01:00</published><updated>2012-12-23T20:52:08.580+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-23T20:52:08.580+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>Consuming REST services in .NET</title><content type="html">&lt;p align="justify"&gt;Before proceeding to real stuff, let’s choose some simple public &lt;a href="http://en.wikipedia.org/wiki/Representational_state_transfer"&gt;REST&lt;/a&gt; API to consume. I stopped at this one: &lt;a title="http://timezonedb.com/api" href="http://timezonedb.com/api"&gt;http://timezonedb.com/api&lt;/a&gt;. It is very simple service providing current local time for requested time zone. After registering you will get some key to access api. In this blog post we will use “YOUR_API_KEY”.&lt;/p&gt;  &lt;p&gt;Here is sample response:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;UTF-8&amp;quot;&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;result&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;OK&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;message&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;message&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;countryCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;AU&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;countryCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;zoneName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Australia/Melbourne&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;zoneName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;abbreviation&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;EST&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;abbreviation&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;gmtOffset&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;39600&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;gmtOffset&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;dst&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;1&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;dst&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;timestamp&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;1321217345&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;timestamp&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;result&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;We will look at 3 possible ways of consuming REST:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Using plain .NET HTTP request &lt;/strong&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;Using WCF mechanisms &lt;/strong&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;Using HttpClient library&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;Whichever approach we take, we would need some entities corresponding to the API’s response.&lt;/p&gt;

&lt;p&gt;For XML response use cases I prepared following entity:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    [XmlRoot(&lt;span class="str"&gt;&amp;quot;result&amp;quot;&lt;/span&gt;)]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TimezoneDbInfo
    {
        [XmlElement(&lt;span class="str"&gt;&amp;quot;status&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Status { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;message&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Message { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;countryCode&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CountryCode { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;zoneName&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ZoneName { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;abbreviation&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Abbreviation { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;gmtOffset&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; GmtOffset { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;dst&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Dst { get; set; }
        [XmlElement(&lt;span class="str"&gt;&amp;quot;timestamp&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Timestamp { get; set; }
    }&lt;/pre&gt;
&lt;style type="text/css"&gt;










.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;For JSON use cases we will use following:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    [DataContract(Name = &lt;span class="str"&gt;&amp;quot;result&amp;quot;&lt;/span&gt;)]
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TimezoneDbInfoJson
    {
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;status&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Status { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;message&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Message { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;countryCode&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CountryCode { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;zoneName&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ZoneName { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;abbreviation&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Abbreviation { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;gmtOffset&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; GmtOffset { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;dst&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Dst { get; set; }
        [DataMember(Name = &lt;span class="str"&gt;&amp;quot;timestamp&amp;quot;&lt;/span&gt;)]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Timestamp { get; set; }
    }&lt;/pre&gt;
&lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;So let’s start!&lt;/p&gt;

&lt;h3&gt;Way1: using plain .NET HTTP request&lt;/h3&gt;

&lt;p&gt;Here is how you can consume REST using WebRequest:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var urlTemplate = &lt;span class="str"&gt;&amp;quot;http://api.timezonedb.com/?zone={0}&amp;amp;key={1}&amp;quot;&lt;/span&gt;;
var url = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(urlTemplate, &lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);

var request = WebRequest.Create(url);
var response = request.GetResponse();
var s = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlSerializer(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(TimezoneDbInfo));
var timezoneDbInfo = (TimezoneDbInfo)s.Deserialize(response.GetResponseStream());&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;And if you would need to consume same data but in JSON format, you can come up with following code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var urlTemplate = &lt;span class="str"&gt;&amp;quot;http://api.timezonedb.com/?zone={0}&amp;amp;key={1}&amp;amp;format=json&amp;quot;&lt;/span&gt;;
var url = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(urlTemplate, &lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);

var webClient = &lt;span class="kwrd"&gt;new&lt;/span&gt; WebClient();
&lt;span class="kwrd"&gt;byte&lt;/span&gt;[] downloadedRawResponse = webClient.DownloadData(url);

var stream = &lt;span class="kwrd"&gt;new&lt;/span&gt; MemoryStream(downloadedRawResponse);
var s = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataContractJsonSerializer(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(TimezoneDbInfoJson));
var timezoneDbInfo = (TimezoneDbInfoJson)s.ReadObject(stream);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;




.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;Either way, using WebRequest or WebClient allows for some lower level of flexibility like controlling timeouts, headers and many other things. For example:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;request.Timeout = 30000;
request.Headers.Add(&lt;span class="str"&gt;&amp;quot;Accept-Language&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p align="justify"&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;Some of the disadvantages of above approach are manual building of request URL and manual deserialization of a response. Many of you might not like above code, thus let’s switch to WCF approach, which looks more elegant and robust at the first glance.&lt;/p&gt;

&lt;h3&gt;Way2: Using WCF mechanisms&lt;/h3&gt;

&lt;p align="justify"&gt;Not a secret that we can create REST services with WCF. Effectively this means that we can also create client for other REST services. For this all we need is just to create proxy as if it was our own service. Well, we cannot have wsdl with metadata, so we have to create proxies manually.&lt;/p&gt;

&lt;p align="justify"&gt;To start we put some WCF configuration in place:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;webHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;webHttpBindingCustom&amp;quot;&lt;/span&gt;
                &lt;span class="attr"&gt;receiveTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;00:01:01&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;sendTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;00:01:01&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;security&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;None&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;webHttpBinding&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;bindings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;client&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpoint&lt;/span&gt; &lt;span class="attr"&gt;address&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://api.timezonedb.com/&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;binding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;webHttpBinding&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;bindingConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;webHttpBindingCustom&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;behaviorConfiguration&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tzBehavior&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;contract&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ConsumingRestInNet.ITimezoneDb&amp;quot;&lt;/span&gt;
              &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TimeZoneDbREST&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;client&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;behaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;endpointBehaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;behavior&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;tzBehavior&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;webHttp&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;behavior&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;endpointBehaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;behaviors&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.serviceModel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;We already have some configuration flexibility which comes with WCF. Now, let’s define service contract:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;[ServiceContract]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; ITimezoneDb
{
    [OperationContract]
    [XmlSerializerFormat]
    [WebGet(UriTemplate = &lt;span class="str"&gt;&amp;quot;?zone={zone}&amp;amp;key={key}&amp;quot;&lt;/span&gt;)]
    TimezoneDbInfo GetTimezoneInfo(&lt;span class="kwrd"&gt;string&lt;/span&gt; zone, &lt;span class="kwrd"&gt;string&lt;/span&gt; key);

    [OperationContract]
    [WebGet(UriTemplate = &lt;span class="str"&gt;&amp;quot;?zone={zone}&amp;amp;key={key}&amp;amp;format=json&amp;quot;&lt;/span&gt;)]
    TimezoneDbInfoJson GetTimezoneInfoJson(&lt;span class="kwrd"&gt;string&lt;/span&gt; zone, &lt;span class="kwrd"&gt;string&lt;/span&gt; key);
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;(In above method we can avoid having 2 methods by orchestrating our TimezoneDbInfo entity with &lt;em&gt;DataContract&lt;/em&gt; in addition to &lt;em&gt;XmlRoot &lt;/em&gt;and by having 3rd param).&lt;/p&gt;

&lt;p&gt;XML consumption:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var channelFactory = &lt;span class="kwrd"&gt;new&lt;/span&gt; ChannelFactory&amp;lt;ITimezoneDb&amp;gt;(&lt;span class="str"&gt;&amp;quot;TimeZoneDbREST&amp;quot;&lt;/span&gt;);
var channel = channelFactory.CreateChannel();
var timezoneDbInfo = channel.GetTimezoneInfo(&lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;JSON consumption:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var channelFactory = &lt;span class="kwrd"&gt;new&lt;/span&gt; ChannelFactory&amp;lt;ITimezoneDb&amp;gt;(&lt;span class="str"&gt;&amp;quot;TimeZoneDbREST&amp;quot;&lt;/span&gt;);
var channel = channelFactory.CreateChannel();
var timezoneDbInfo = channel.GetTimezoneInfoJson(&lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;You can also go further and implement your own Client class:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; TimezoneDbClient : ClientBase&amp;lt;ITimezoneDb&amp;gt;, ITimezoneDb
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; TimezoneDbClient(&lt;span class="kwrd"&gt;string&lt;/span&gt; endpointConfigurationName)
        : &lt;span class="kwrd"&gt;base&lt;/span&gt;(endpointConfigurationName)
    {
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; TimezoneDbInfo GetTimezoneInfo(&lt;span class="kwrd"&gt;string&lt;/span&gt; zone, &lt;span class="kwrd"&gt;string&lt;/span&gt; key)
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.Channel.GetTimezoneInfo(zone, key);
    }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; TimezoneDbInfoJson GetTimezoneInfoJson(&lt;span class="kwrd"&gt;string&lt;/span&gt; zone, &lt;span class="kwrd"&gt;string&lt;/span&gt; key)
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.Channel.GetTimezoneInfoJson(zone, key);
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;Now consumptions will look like piece of cake:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;var client = &lt;span class="kwrd"&gt;new&lt;/span&gt; TimezoneDbClient(&lt;span class="str"&gt;&amp;quot;TimeZoneDbREST&amp;quot;&lt;/span&gt;);
var timezoneDbInfo = client.GetTimezoneInfoJson(&lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;(Well, of course! All other crap went to other classes and config (: )&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h3&gt;Way3: Using HttpClient library&lt;/h3&gt;

&lt;p align="justify"&gt;It would be a perfect ending for a blog post. But it is not. On one hand using WCF provides us with great abstraction over service, but on the other hand it is just overhead for doing simple things. Also some people &lt;a href="http://stackoverflow.com/a/8884600/232881"&gt;think&lt;/a&gt; that coupling generated by WCF defeats the point of REST.&lt;/p&gt;

&lt;p align="justify"&gt;Here is extract of a &lt;a href="http://stackoverflow.com/questions/671118/what-exactly-is-restful-programming"&gt;great answer&lt;/a&gt; on SO about what exactly is RESTful programming:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p align="justify"&gt;Really, what it's about is using the true potential of HTTP. The protocol is oriented around verbs and resources. The two verbs in mainstream usage is GET and POST, which I think everyone will recognize. However, the HTTP standard defines several other such as PUT and DELETE. These verbs are then applied to resources.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p align="justify"&gt;To leverage all of this potential Microsoft has built &lt;code&gt;Microsoft.Net.Http. &lt;/code&gt;Its nuget page says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p align="justify"&gt;This package provides a programming interface for modern HTTP applications. This package includes HttpClient for sending requests over HTTP, as well as HttpRequestMessage and HttpResponseMessage for processing HTTP messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p align="justify"&gt;Here is how we can use it:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;var urlTemplate = &lt;span class="str"&gt;&amp;quot;http://api.timezonedb.com/?zone={0}&amp;amp;key={1}&amp;amp;format=json&amp;quot;&lt;/span&gt;;
var url = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(urlTemplate, &lt;span class="str"&gt;&amp;quot;Europe/Kiev&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;YOUR_API_KEY&amp;quot;&lt;/span&gt;);

var httpClient = &lt;span class="kwrd"&gt;new&lt;/span&gt; HttpClient();
var streamTask = httpClient.GetStreamAsync(url);

var s = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataContractJsonSerializer(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(TimezoneDbInfoJson));
var timezoneDbInfo = (TimezoneDbInfoJson)s.ReadObject(streamTask.Result);&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;Code above looks pretty much the same as when we used plain WebRequest. But HttpClient is much more advanced and adopted for consuming REST services. For example, it has methods: GetAsync and PostAsync. Reading and sending custom headers is much more simplified. Here is great post with many examples of using HttpClient: &lt;a title="http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/" href="http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/"&gt;http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other possibilities to consume REST in .NET?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;- YES. There are dozen of libraries out there implemented exactly for that, though I’m sure that most of them cannot be considered as good candidates.&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;How to consume REST in .NET: &lt;a title="http://stackoverflow.com/questions/8883656/how-to-consume-a-restful-service-in-net" href="http://stackoverflow.com/questions/8883656/how-to-consume-a-restful-service-in-net"&gt;http://stackoverflow.com/questions/8883656/how-to-consume-a-restful-service-in-net&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Examples of using HttpClient: &lt;a title="http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/" href="http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/"&gt;http://www.bizcoder.com/index.php/2012/01/09/httpclient-it-lives-and-it-is-glorious/&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;MSDN blog post on consuming REST with WCF: &lt;a title="http://blogs.msdn.com/b/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx" href="http://blogs.msdn.com/b/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx"&gt;http://blogs.msdn.com/b/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;TimeZoneDb API page: &lt;a title="http://timezonedb.com/api" href="http://timezonedb.com/api"&gt;http://timezonedb.com/api&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Have you noticed there response has integer for time? &lt;a title="http://en.wikipedia.org/wiki/Unix_timestamp" href="http://en.wikipedia.org/wiki/Unix_timestamp"&gt;http://en.wikipedia.org/wiki/Unix_timestamp&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;Nuget page for Microsoft.Net.Http: &lt;a title="http://nuget.org/packages/Microsoft.Net.Http" href="http://nuget.org/packages/Microsoft.Net.Http"&gt;http://nuget.org/packages/Microsoft.Net.Http&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Hope this post comes handy for you!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/BMQZtoTMIiM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/7980765276620251153/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/12/consuming-rest-services-in-net.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/7980765276620251153?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/7980765276620251153?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/BMQZtoTMIiM/consuming-rest-services-in-net.html" title="Consuming REST services in .NET" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/12/consuming-rest-services-in-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEACRXcyfSp7ImA9WhNWF00.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-4309223213458652528</id><published>2012-12-17T00:49:00.001+01:00</published><updated>2012-12-17T01:06:04.995+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-17T01:06:04.995+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><title>Book review: “Seven Languages in Seven Weeks”</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.amazon.com/Seven-Languages-Weeks-Programming-Programmers/dp/193435659X"&gt;&lt;img style="display: inline; margin-left: 0px; margin-right: 0px" align="left" src="http://ecx.images-amazon.com/images/I/5109xeEqMZL._SL500_SS500_.jpg" width="270" height="270" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;This is a review of a book called “&lt;a href="http://www.amazon.com/Seven-Languages-Weeks-Programming-Programmers/dp/193435659X"&gt;Seven Languages In Seven Weeks&lt;/a&gt;”, which I have started reading quite long time ago. Maybe I could have finished it in seven weeks, if I only was reading it chapter by chapter and not in between of other books.&lt;/p&gt;  &lt;p align="justify"&gt;I have found couple of very interesting feedbacks on this book, some of them even criticizing. Bad critics mostly were about languages selection, concentration on very simple stuff in Days 1 and 2 and jumping to cool stuff only in Day 3, also many complained about some important features missed.&lt;/p&gt;  &lt;p align="justify"&gt;I guess such kind of opinions come from people who either have tons of experience or either are complainers by their nature. Either way, though I agree that the book is not giving solid picture about each of the languages, I don’t think it was its purpose! As per me intension of the book was to introduce readers to interesting programming concepts represented in those 7 languages and encourage to actually code something in each of them. Author says “If you simply read this book, you’ll experience the flavor of the syntax and no more.” and it is complete truth. I know it because, for instance, I skipped coding in Erlang thinking that I will do it in the end, but it didn’t work that smooth.&lt;/p&gt;  &lt;p align="justify"&gt;I tried to have blog posts on each of the languages, but I didn’t strictly follow home works, as some guys did. For example, &lt;a href="http://www.bennadel.com/blog/2109-Seven-Languages-In-Seven-Weeks-By-Bruce-Tate-What-An-Adventure.htm"&gt;Ben Nadel&lt;/a&gt; has posts for each of “days”.&lt;/p&gt;  &lt;p align="justify"&gt;Here are my posts on each of the languages from the book:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Haskell"&gt;Haskell&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Scala"&gt;Scala&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Erlang"&gt;Erlang&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Clojure"&gt;Clojure&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/IoLanguage"&gt;Io&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Prolog"&gt;Prolog&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://www.andriybuday.com/search/label/Ruby"&gt;Ruby&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;Some of posts are not part of the book’s reading process. BTW, list sorted by how much each of languages appeal to me.&lt;/p&gt;  &lt;h5&gt;Do I recommend this book?&lt;/h5&gt;  &lt;p align="justify"&gt;I have answer up-front, copied from my comment to similar question. Here you go: “… it always depends on your needs. If you are interested to quickly go through couple of interesting languages I would recommend this book. Though book is not always easy to follow. Also when you read always do home work. If you want deep insight into one-two languages or comprehensive explanations or step-by-step samples this book is not your choice.” I still keep the same attitude about recommending it, but if someone expects a short answer, than it is going to be – &lt;strong&gt;YES&lt;/strong&gt;.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/AX4-6zo3Lno" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/4309223213458652528/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/12/book-review-seven-languages-in-seven.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4309223213458652528?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4309223213458652528?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/AX4-6zo3Lno/book-review-seven-languages-in-seven.html" title="Book review: “Seven Languages in Seven Weeks”" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/12/book-review-seven-languages-in-seven.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUCQn0-eip7ImA9WhNWE0s.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-5624599037926794517</id><published>2012-12-13T02:41:00.001+01:00</published><updated>2012-12-13T02:47:43.352+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-13T02:47:43.352+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Erlang" /><title>Erlang programming language</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.erlang.org/"&gt;&lt;img style="display: inline; margin-left: 0px; margin-right: 0px" alt="Erlang logo" align="left" src="http://www.erlang.org/doc/erlang-logo.png" /&gt;&lt;/a&gt;The one I didn’t get. But don’t worry, I can “kill” myself and “spawn” another me to try once again.&lt;/p&gt;  &lt;p align="justify"&gt;Not sure if I have to repeat some of the definitions given to this language, because I doubt that my readers read only this blog and never heard about Erlang. But who would start searching for “Erlang” if you are already here, so to avoid this dilemma I just copied one of its definitions later on.&lt;/p&gt;  &lt;h5&gt;Some of my thoughts&lt;/h5&gt;  &lt;p align="justify"&gt;Erlang is great and hard language at the same time. Its syntax easily looks somewhat alien to many developers, not saying about normal people, who are capable of reading only few human languages. On the other hand ideas behind Erlang are just astonishing. “Let it crash” concept works, because there is no shared state between processes, and if something crashes you just restart stuff, not worrying about overhead as processes are lightweight. And how does this sound to you: dynamic language in which you can change code on the fly? I don’t think you can allow for downtime when you are in a rocket. Not sure if NASA uses Erlang, but many telecom companies use it for sure, which resulted in birth of &lt;a href="http://en.wikipedia.org/wiki/Open_Telecom_Platform"&gt;Open Telecom Platform&lt;/a&gt; (OTP) – a library for telecom applications.&lt;/p&gt;  &lt;h5&gt;&lt;strong&gt;Why Erlang?&lt;/strong&gt; – Built to kick ass!&lt;/h5&gt;  &lt;p&gt;I’ve found following explanation very sensible:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;Erlang was developed at &lt;strong&gt;Ericsson&lt;/strong&gt; and was designed from the ground up for writing &lt;strong&gt;scalable&lt;/strong&gt;, &lt;strong&gt;fault-tolerant&lt;/strong&gt;, &lt;strong&gt;distributed&lt;/strong&gt;, &lt;strong&gt;non-stop&lt;/strong&gt;, &lt;strong&gt;soft-realtime&lt;/strong&gt; applications. &lt;em&gt;Everything&lt;/em&gt; in the language, runtime and libraries reflects that purpose, which makes Erlang the best platform for developing this kind of software.&lt;/p&gt;    &lt;p&gt;Use Erlang if you want your application to:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;handle very large number of concurrent activities &lt;/li&gt;      &lt;li&gt;be easily distributable over a network of computers &lt;/li&gt;      &lt;li&gt;be fault-tolerant to both software &amp;amp; hardware errors &lt;/li&gt;      &lt;li&gt;scale with the number of machines on the network &lt;/li&gt;      &lt;li&gt;be upgradable &amp;amp; reconfigurable without having to stop &amp;amp; restart &lt;/li&gt;      &lt;li&gt;be responsive to users within certain strict timeframes &lt;/li&gt;      &lt;li&gt;stay in continuous operation for many years &lt;/li&gt;   &lt;/ul&gt; &lt;/blockquote&gt;  &lt;p&gt;Please visit &lt;a title="http://veldstra.org/whyerlang/" href="http://veldstra.org/whyerlang/"&gt;http://veldstra.org/whyerlang/&lt;/a&gt; for more “why Erlang?”.&lt;/p&gt;  &lt;h5&gt;How many are there Erlang developers?&lt;/h5&gt;  &lt;p align="justify"&gt;This or some similar question often is very interesting when its about some exotic or small language. Hard to answer, but I’ve found this really nice site: &lt;a title="http://roberto-aloi.com/languagesintheworld/#" href="http://roberto-aloi.com/languagesintheworld/"&gt;http://roberto-aloi.com/languagesintheworld/#&lt;/a&gt;. Try it out to figure out who is coding Erlang/Haskell/Scala/… in your country.&lt;/p&gt;  &lt;h5&gt;Sleeping Barber problem in Erlang&lt;/h5&gt;  &lt;p align="justify"&gt;In my &lt;a href="http://www.andriybuday.com/2012/10/haskell-programming-language.html"&gt;Haskell&lt;/a&gt; post I wrote “I’m too new to Haskell to talk about some advanced features and to write programs which are over 10 lines of code.” I can ensure that now I can write Erlang programs which are more than 10 lines of code, but I won’t be able to confidently talk about most of aspects of this language either.&lt;/p&gt;  &lt;p align="justify"&gt;I can write larger programs, because I wrote one. Pitfall here is that I don’t completely understand how it works. I believe this is due to the fact, that I’ve chosen wrong problem to solve with this language. Erland is not really build for stuff like “run this for 10 seconds”, but rather for stuff like “that’s your message, deal with it”. Though, I could easily be wrong.&lt;/p&gt;  &lt;p align="justify"&gt;I decided that my first Erlang program will be “sleeping barber” problem, which I’ve already done in &lt;a href="http://www.andriybuday.com/2012/11/clojure-programming-language.html"&gt;Clojure&lt;/a&gt; (BTW, there is small bug, spot it!). Once again:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Problem called &amp;quot;sleeping barber.&amp;quot; was created by Edsger Dijkstra in 1965. It has these characteristics:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;A barber shop takes customers. &lt;/li&gt;      &lt;li&gt;Customers arrive at random intervals, from 10 to 30 milliseconds. &lt;/li&gt;      &lt;li&gt;The barber shop has three chairs in the waiting room. &lt;/li&gt;      &lt;li&gt;The barber shop has one barber and one barber chair. &lt;/li&gt;      &lt;li&gt;When the barber's chair is empty, a customer sits in the chair, wakes up the barber, and gets a haircut. &lt;/li&gt;      &lt;li&gt;If the chairs are occupied, all new customers will turn away. &lt;/li&gt;      &lt;li&gt;Haircuts take 20 milliseconds. &lt;/li&gt;      &lt;li&gt;After a customer receives a haircut, he gets up and leaves. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;Write a multithreaded program to determine how many haircuts a barber can give in 10 seconds.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h5&gt;Mine solution in Erlang&lt;/h5&gt;  &lt;p&gt;&lt;strong&gt;Counter &lt;/strong&gt;– does nothing smart except of counting number of customers with new haircut&lt;/p&gt; &lt;!-- HTML generated using hilite.me --&gt;  &lt;div style="border-bottom: gray 0.1em solid; border-left: gray 0.8em solid; padding-bottom: 0.2em; padding-left: 0.6em; width: auto; padding-right: 0.6em; background: white; color: black; overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; padding-top: 0.2em"&gt;   &lt;pre style="line-height: 125%; margin: 0px"&gt;-&lt;span style="color: #800000; font-weight: bold"&gt;module&lt;/span&gt;(counter).
-&lt;span style="color: #800000; font-weight: bold"&gt;export&lt;/span&gt;([loop&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;,incr&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;,get_count&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;]).

&lt;span style="color: #0060b0; font-weight: bold"&gt;loop&lt;/span&gt;(&lt;span style="color: #906030"&gt;Count&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;                            
    &lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;                                   
        { incr } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
            loop(&lt;span style="color: #906030"&gt;Count&lt;/span&gt; &lt;span style="color: #303030"&gt;+&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;);              
        { report, &lt;span style="color: #906030"&gt;To&lt;/span&gt; } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;                     
            &lt;span style="color: #906030"&gt;To&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { count, &lt;span style="color: #906030"&gt;Count&lt;/span&gt; },            
            loop(&lt;span style="color: #906030"&gt;Count&lt;/span&gt;)                           
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.                                      

&lt;span style="color: #0060b0; font-weight: bold"&gt;incr&lt;/span&gt;(&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
    &lt;span style="color: #906030"&gt;Counter&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { incr }.

&lt;span style="color: #0060b0; font-weight: bold"&gt;get_count&lt;/span&gt;(&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;    
    &lt;span style="color: #906030"&gt;Counter&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { report, self() },
    &lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
        { count, &lt;span style="color: #906030"&gt;Count&lt;/span&gt; } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #906030"&gt;Count&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Barber&lt;/strong&gt;&lt;/p&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;div style="border-bottom: gray 0.1em solid; border-left: gray 0.8em solid; padding-bottom: 0.2em; padding-left: 0.6em; width: auto; padding-right: 0.6em; background: white; color: black; overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; padding-top: 0.2em"&gt;
  &lt;pre style="line-height: 125%; margin: 0px"&gt;-&lt;span style="color: #800000; font-weight: bold"&gt;module&lt;/span&gt;(barber).
-&lt;span style="color: #800000; font-weight: bold"&gt;import&lt;/span&gt;(counter,[incr&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;]).
-&lt;span style="color: #800000; font-weight: bold"&gt;export&lt;/span&gt;([loop&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt;, cuthair&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;3&lt;/span&gt;]).

&lt;span style="color: #0060b0; font-weight: bold"&gt;loop&lt;/span&gt;() &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
	&lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
	{&lt;span style="color: #906030"&gt;Pid&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;}&lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		&lt;span style="color: #0e84b5; font-weight: bold"&gt;timer&lt;/span&gt;:sleep(&lt;span style="color: #0000d0; font-weight: bold"&gt;20&lt;/span&gt;),
		&lt;span style="color: #906030"&gt;Pid&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; &lt;span style="background-color: #fff0f0"&gt;&amp;quot;haircut done!&amp;quot;&lt;/span&gt;,
		&lt;span style="color: #0e84b5; font-weight: bold"&gt;counter&lt;/span&gt;:incr(&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;),
		loop()
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.

&lt;span style="color: #0060b0; font-weight: bold"&gt;cuthair&lt;/span&gt;(&lt;span style="color: #906030"&gt;To&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
	&lt;span style="color: #808080"&gt;% make barber work synchronously&lt;/span&gt;
	&lt;span style="color: #906030"&gt;Barber&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { &lt;span style="color: #906030"&gt;To&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt; },
    &lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
        &lt;span style="color: #906030"&gt;BarberService&lt;/span&gt; &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #906030"&gt;BarberService&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Barbershop &lt;/strong&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Crazy stuff. For example, take a look at how I implemented continuous generation of customers. It is tail recursion function, which takes 10000 as starting &lt;em&gt;WorkTime&lt;/em&gt; and generates customer after 10-30ms of thread sleeping, then calls itself with &lt;em&gt;WorkTime&lt;/em&gt; minus time needed to send customer to barbershop. It continues until function is out of &lt;em&gt;WorkTime&lt;/em&gt;. Similar I do for &lt;em&gt;barber_work_day&lt;/em&gt;.&lt;/p&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;div style="border-bottom: gray 0.1em solid; border-left: gray 0.8em solid; padding-bottom: 0.2em; padding-left: 0.6em; width: auto; padding-right: 0.6em; background: white; color: black; overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; padding-top: 0.2em"&gt;
  &lt;pre style="line-height: 125%; margin: 0px"&gt;-&lt;span style="color: #800000; font-weight: bold"&gt;module&lt;/span&gt;(barbershop).
-&lt;span style="color: #800000; font-weight: bold"&gt;export&lt;/span&gt;([loop&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;3&lt;/span&gt;,customers&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;2&lt;/span&gt;,barber_work_day&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;4&lt;/span&gt;]).

&lt;span style="color: #0060b0; font-weight: bold"&gt;loop&lt;/span&gt;(&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
	{ customer } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		loop(&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt;&lt;span style="color: #303030"&gt;-&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;);
	{ barber } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		loop(&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt;&lt;span style="color: #303030"&gt;+&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;);
	{ free_chairs_count, &lt;span style="color: #906030"&gt;To&lt;/span&gt; } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		&lt;span style="color: #906030"&gt;To&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { chairs, &lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; },
		loop(&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;)
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.                    

&lt;span style="color: #0060b0; font-weight: bold"&gt;barber_work_day&lt;/span&gt;(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;)
			&lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; &lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt; &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;;
&lt;span style="color: #0060b0; font-weight: bold"&gt;barber_work_day&lt;/span&gt;(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;)
			&lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; &lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt; &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
&lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
{ start } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
	self() &lt;span style="color: #303030"&gt;!&lt;/span&gt; { start },
	&lt;span style="color: #906030"&gt;X&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;20&lt;/span&gt;,
	&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; get_free_chairs_count(&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;),
	&lt;span style="color: #008000; font-weight: bold"&gt;case&lt;/span&gt; &lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;of&lt;/span&gt;
	_ &lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; (&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;3&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
		&lt;span style="color: #0e84b5; font-weight: bold"&gt;timer&lt;/span&gt;:sleep(&lt;span style="color: #906030"&gt;X&lt;/span&gt;),
		&lt;span style="color: #906030"&gt;Barber&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { self(), &lt;span style="color: #906030"&gt;Counter&lt;/span&gt; },
		&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; {barber},
		barber_work_day(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;&lt;span style="color: #303030"&gt;-&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;20&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;);
	_ &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		barber_work_day(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barber&lt;/span&gt;, &lt;span style="color: #906030"&gt;Counter&lt;/span&gt;)
	&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.
	
	
&lt;span style="color: #0060b0; font-weight: bold"&gt;get_free_chairs_count&lt;/span&gt;(&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;    
    &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; { free_chairs_count, self() },
&lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
        { chairs, &lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.

&lt;span style="color: #0060b0; font-weight: bold"&gt;customers&lt;/span&gt;(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; &lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt; &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;1&lt;/span&gt;;
&lt;span style="color: #0060b0; font-weight: bold"&gt;customers&lt;/span&gt;(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; &lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt; &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
&lt;span style="color: #008000; font-weight: bold"&gt;receive&lt;/span&gt;
{ start } &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
	self() &lt;span style="color: #303030"&gt;!&lt;/span&gt; { start },
	&lt;span style="color: #906030"&gt;X&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #0e84b5; font-weight: bold"&gt;random&lt;/span&gt;:uniform(&lt;span style="color: #0000d0; font-weight: bold"&gt;21&lt;/span&gt;) &lt;span style="color: #303030"&gt;+&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;9&lt;/span&gt;,
	&lt;span style="color: #0e84b5; font-weight: bold"&gt;timer&lt;/span&gt;:sleep(&lt;span style="color: #906030"&gt;X&lt;/span&gt;),
	
	&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; get_free_chairs_count(&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;),
	&lt;span style="color: #008000; font-weight: bold"&gt;case&lt;/span&gt; &lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;of&lt;/span&gt;
	_ &lt;span style="color: #008000; font-weight: bold"&gt;when&lt;/span&gt; (&lt;span style="color: #906030"&gt;FreeChairs&lt;/span&gt; &lt;span style="color: #303030"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt;) &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
		&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; {customer},
		customers(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;&lt;span style="color: #303030"&gt;-&lt;/span&gt;&lt;span style="color: #906030"&gt;X&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;);
	_ &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
		customers(&lt;span style="color: #906030"&gt;WorkTime&lt;/span&gt;&lt;span style="color: #303030"&gt;-&lt;/span&gt;&lt;span style="color: #906030"&gt;X&lt;/span&gt;, &lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;)
	&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;
&lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;.&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Program&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here I just initialize random, create processes and kick-off generation of customers and barber’s work day.&lt;/p&gt;
&lt;!-- HTML generated using hilite.me --&gt;

&lt;div style="border-bottom: gray 0.1em solid; border-left: gray 0.8em solid; padding-bottom: 0.2em; padding-left: 0.6em; width: auto; padding-right: 0.6em; background: white; color: black; overflow: auto; border-top: gray 0.1em solid; border-right: gray 0.1em solid; padding-top: 0.2em"&gt;
  &lt;pre style="line-height: 125%; margin: 0px"&gt;{&lt;span style="color: #906030"&gt;A1&lt;/span&gt;, &lt;span style="color: #906030"&gt;A2&lt;/span&gt;, &lt;span style="color: #906030"&gt;A3&lt;/span&gt;} &lt;span style="color: #303030"&gt;=&lt;/span&gt; now().

&lt;span style="color: #0e84b5; font-weight: bold"&gt;random&lt;/span&gt;:seed(&lt;span style="color: #906030"&gt;A1&lt;/span&gt;, &lt;span style="color: #906030"&gt;A2&lt;/span&gt;, &lt;span style="color: #906030"&gt;A3&lt;/span&gt;).

&lt;span style="color: #906030"&gt;Counter&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #007020"&gt;spawn&lt;/span&gt;(&lt;span style="color: #008000; font-weight: bold"&gt;fun&lt;/span&gt;() &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #0e84b5; font-weight: bold"&gt;counter&lt;/span&gt;:loop(&lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;).

&lt;span style="color: #906030"&gt;Barber&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #007020"&gt;spawn&lt;/span&gt;(&lt;span style="color: #008000; font-weight: bold"&gt;fun&lt;/span&gt; &lt;span style="color: #0e84b5; font-weight: bold"&gt;barber&lt;/span&gt;:loop&lt;span style="color: #303030"&gt;/&lt;/span&gt;&lt;span style="color: #0000d0; font-weight: bold"&gt;0&lt;/span&gt;).

&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #007020"&gt;spawn&lt;/span&gt;(&lt;span style="color: #008000; font-weight: bold"&gt;fun&lt;/span&gt;() &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; &lt;span style="color: #0e84b5; font-weight: bold"&gt;barbershop&lt;/span&gt;:loop(&lt;span style="color: #0000d0; font-weight: bold"&gt;3&lt;/span&gt;,&lt;span style="color: #906030"&gt;Barber&lt;/span&gt;,&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;).

&lt;span style="color: #906030"&gt;Customers&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #007020"&gt;spawn&lt;/span&gt;(&lt;span style="color: #008000; font-weight: bold"&gt;fun&lt;/span&gt;() &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt;
	&lt;span style="color: #0e84b5; font-weight: bold"&gt;barbershop&lt;/span&gt;:customers(&lt;span style="color: #0000d0; font-weight: bold"&gt;10000&lt;/span&gt;,&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;).

&lt;span style="color: #906030"&gt;BarberWorkDay&lt;/span&gt; &lt;span style="color: #303030"&gt;=&lt;/span&gt; &lt;span style="color: #007020"&gt;spawn&lt;/span&gt;(&lt;span style="color: #008000; font-weight: bold"&gt;fun&lt;/span&gt;() &lt;span style="color: #303030"&gt;-&amp;gt;&lt;/span&gt; 
	&lt;span style="color: #0e84b5; font-weight: bold"&gt;barbershop&lt;/span&gt;:barber_work_day(&lt;span style="color: #0000d0; font-weight: bold"&gt;10000&lt;/span&gt;,&lt;span style="color: #906030"&gt;Barbershop&lt;/span&gt;,&lt;span style="color: #906030"&gt;Barber&lt;/span&gt;,&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;) &lt;span style="color: #008000; font-weight: bold"&gt;end&lt;/span&gt;).

&lt;span style="color: #906030"&gt;BarberWorkDay&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; {start}.

&lt;span style="color: #906030"&gt;Customers&lt;/span&gt; &lt;span style="color: #303030"&gt;!&lt;/span&gt; {start}.

&lt;span style="color: #0e84b5; font-weight: bold"&gt;counter&lt;/span&gt;:get_count(&lt;span style="color: #906030"&gt;Counter&lt;/span&gt;).&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;Un-obviously it executes slightly longer than 10 seconds (12-15), so when I call &lt;em&gt;counter:get_count(Counter)&lt;/em&gt; exactly after 10 seconds I’m getting slightly lower numbers than expected, so I just call &lt;em&gt;get_count&lt;/em&gt; in console until number stops growing with some very realistic number, like 434.&lt;/p&gt;

&lt;p align="justify"&gt;Now you can blame me for my dumbness, because it is really a lot of code for quite simple problem and it took me good 6+ hours to implement.&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Official site: &lt;a title="http://www.erlang.org/" href="http://www.erlang.org/"&gt;http://www.erlang.org/&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Cool learning site: &lt;a title="http://learnyousomeerlang.com/" href="http://learnyousomeerlang.com/"&gt;http://learnyousomeerlang.com/&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;OTP from Erlang perspective: &lt;a title="http://learnyousomeerlang.com/what-is-otp" href="http://learnyousomeerlang.com/what-is-otp"&gt;http://learnyousomeerlang.com/what-is-otp&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Why Erlang: &lt;a title="http://veldstra.org/whyerlang/" href="http://veldstra.org/whyerlang/"&gt;http://veldstra.org/whyerlang/&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;Code highlighter: &lt;a title="http://hilite.me/" href="http://hilite.me/"&gt;http://hilite.me/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I really hope you liked this post! If true, instead of blaming me, you are welcome to share your own experience with Erlang.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/8lcAbyY9mpo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/5624599037926794517/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/12/erlang-programming-language.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5624599037926794517?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5624599037926794517?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/8lcAbyY9mpo/erlang-programming-language.html" title="Erlang programming language" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/12/erlang-programming-language.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMHRXs_eCp7ImA9WhNXEko.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-5067041676995897933</id><published>2012-11-30T01:40:00.001+01:00</published><updated>2012-11-30T12:20:34.540+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-30T12:20:34.540+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Clojure programming language</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div align="justify"&gt;
&lt;img align="left" alt="Clojure" height="100" src="http://clojure.org/space/showimage/clojure-icon.gif" style="display: inline; margin: 0px 10px 0px 0px;" width="100" /&gt;&lt;a href="http://clojure.org/"&gt;Clojure&lt;/a&gt; is a dialect of the Lisp programming language. Accordingly to Rich Hickey, creator of the language, “it is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming.”&lt;/div&gt;
&lt;div align="justify"&gt;
Ok, enough! Probably you can read definition and most of the “getting started” information somewhere else. I’m here to share my thoughts on this language and to inspire you to try it out.&lt;/div&gt;
&lt;div align="justify"&gt;
Back in university days some of my peers had chance to learn Lisp. (My academic group instead had something else, maybe JavaScript, which I anyway haven’t learnt there.) So I only knew that there is such language as Lisp and it has something to do with lists. Now I know a little bit more – it is about &lt;b&gt;LIS&lt;/b&gt;t &lt;b&gt;P&lt;/b&gt;rocessing… and I’ve also tried one of its dialects.&lt;/div&gt;
&lt;div align="justify"&gt;
Clojure has its differences and some oddness, like, for example, prefix notations. Well, writing (* 5 (+ 2 3) ) instead of (5 * (2 + 3) ) is not difficult, but it is like saying “understand me later you will” in &lt;a href="http://en.wikipedia.org/wiki/Yoda"&gt;Yoda&lt;/a&gt; style! Also having few thousands of “((((“ and “))))&lt;span style="color: red;"&gt;)&lt;/span&gt;” makes code looking ugly as per me. Or maybe I’m too newbie in formatting source code. Honestly, except of idea that everything is list I didn’t grasp any concept which would sound completely new to me.&lt;/div&gt;
&lt;h4&gt;
Some code&lt;/h4&gt;
&lt;div align="justify"&gt;
As you may know I’m reading “&lt;a href="http://pragprog.com/book/btlang/seven-languages-in-seven-weeks"&gt;7 languages in 7 weeks&lt;/a&gt;” and for each language there is set of tasks. Initially I thought that I will take the most difficult task from Day 3 and implement it, but when I started coding I realized that it was too hard to be my first program in Clojure. So I took baby steps:&lt;/div&gt;
&lt;div align="justify"&gt;
Day 1: Function &lt;i&gt;big&lt;/i&gt; that returns true if &lt;i&gt;st&lt;/i&gt; is longer than &lt;i&gt;n&lt;/i&gt;.&lt;/div&gt;
&lt;pre style="background: #002240; color: white;"&gt;(defn big [st n]
  (&lt;span style="color: #ff9d00;"&gt;if&lt;/span&gt; ( &amp;gt; (count st) n) true false))

&lt;span style="color: #0088ff; font-style: italic;"&gt;&lt;span style="color: #e1efff;"&gt;;&lt;/span&gt; usage&lt;/span&gt;
(big &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;is length of this string longer than 15?&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;15&lt;/span&gt;)&lt;/pre&gt;
Day 1: Function that identifies collection.&lt;br /&gt;
&lt;pre style="background: #002240; color: white;"&gt;(defn collection-type [col]
       (&lt;span style="color: #ffb054;"&gt;cond&lt;/span&gt;
        (vector? col) (str &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;vector:&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
        (&lt;span style="color: #ffb054;"&gt;list&lt;/span&gt;? col) (str &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;list:&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
        (map? col) (str &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;map:&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)))

(collection-type [&lt;span style="color: #ff628c;"&gt;1&lt;/span&gt;])
(collection-type (&lt;span style="color: #ffb054;"&gt;list&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;2&lt;/span&gt;))
(collection-type {:chewie :wookie :lea :human})&lt;/pre&gt;
Day 2: An &lt;i&gt;unless&lt;/i&gt; with an else condition using macros.&lt;br /&gt;
&lt;pre style="background: #002240; color: white;"&gt;(&lt;span style="color: #ffee80;"&gt;defmacro&lt;/span&gt; &lt;span style="color: #ffdd00;"&gt;unless&lt;/span&gt; [test body]
    (&lt;span style="color: #ffb054;"&gt;list&lt;/span&gt; '&lt;span style="color: #ff9d00;"&gt;if&lt;/span&gt; (&lt;span style="color: #ffb054;"&gt;list&lt;/span&gt; 'not test) body))
    
(macroexpand '(unless condition body))

(unless (&amp;gt; &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;10&lt;/span&gt;) (println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;Did you really think that 1 &amp;gt; 10?&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;))&lt;/pre&gt;
Day 2: Type using &lt;i&gt;defrecord&lt;/i&gt; that implements a &lt;i&gt;protocol&lt;/i&gt;.&lt;br /&gt;
&lt;pre style="background: #002240; color: white;"&gt;(defprotocol Person
    (writeName [c])
    (writeAge [c]))
    
(defrecord PersonImpl [name age]
    Person
    (writeName [_] (println name))
    (writeAge [_] (println age))
    Object
    (toString [this] (str &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;Name=&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; (writeName this) &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;&amp;amp; Age=&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; (writeAge this) )))
    
(def andriy (PersonImpl. &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;Andriy&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;25&lt;/span&gt;))

(writeName andriy)
(writeAge andriy)
(println andriy)&lt;/pre&gt;
&lt;span style="font-size: medium;"&gt;Hey! Stop scrolling! :)&lt;/span&gt;&lt;br /&gt;
Day 3: &lt;a href="http://en.wikipedia.org/wiki/Sleeping_barber_problem"&gt;Sleeping barber&lt;/a&gt; problem.&lt;br /&gt;
&lt;div align="justify"&gt;
So, this is task which I thought I will do immediately after reading about Clojure, but I failed. I was able to perform it after I finished with those above. Here is what I had to solve (as in book):&lt;/div&gt;
&lt;blockquote&gt;
Problem called "sleeping barber." was created by Edsger Dijkstra in 1965. It has these characteristics:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;A barber shop takes customers. &lt;/li&gt;
&lt;li&gt;Customers arrive at random intervals, from 10 to 30 milliseconds. &lt;/li&gt;
&lt;li&gt;The barber shop has three chairs in the waiting room. &lt;/li&gt;
&lt;li&gt;The barber shop has one barber and one barber chair. &lt;/li&gt;
&lt;li&gt;When the barber's chair is empty, a customer sits in the chair, wakes up the barber, and gets a haircut. &lt;/li&gt;
&lt;li&gt;If the chairs are occupied, all new customers will turn away. &lt;/li&gt;
&lt;li&gt;Haircuts take 20 milliseconds. &lt;/li&gt;
&lt;li&gt;After a customer receives a haircut, he gets up and leaves. &lt;/li&gt;
&lt;/ul&gt;
Write a multithreaded program to determine how many haircuts a barber can give in 10 seconds.&lt;/blockquote&gt;
My solution:&lt;br /&gt;
&lt;pre style="background: #002240; color: white;"&gt;(def counter (agent &lt;span style="color: #ff628c;"&gt;0&lt;/span&gt;))
(def chairs (agent &lt;span style="color: #ff628c;"&gt;0&lt;/span&gt;))
(def workingTime (agent &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt;))

(defn haircut [x]
    (&lt;span style="color: #ff9d00;"&gt;do&lt;/span&gt;
        (Thread/sleep &lt;span style="color: #ff628c;"&gt;20&lt;/span&gt;)
        (println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;...haircutting...&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
        (+ &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt; x)))

(defn customer [x]
    (&lt;span style="color: #ff9d00;"&gt;&lt;span style="color: #ff8000;"&gt;if&lt;/span&gt;&lt;/span&gt; (&amp;lt; x &lt;span style="color: #ff628c;"&gt;3&lt;/span&gt;) 
        (&lt;span style="color: #ff9d00;"&gt;do&lt;/span&gt;
            (send counter haircut)
            (println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;I'm next!&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
            (+ &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt; x))
        (&lt;span style="color: #ff9d00;"&gt;do&lt;/span&gt;
            (println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;I went home. This barber shop sucks!&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
            (- &lt;span style="color: #ff628c;"&gt;1&lt;/span&gt; x))))

(defn waitUntilEndOfTheDay [x]
    (&lt;span style="color: #ff9d00;"&gt;do&lt;/span&gt;
        (Thread/sleep ( * &lt;span style="color: #ff628c;"&gt;10&lt;/span&gt; &lt;span style="color: #ff628c;"&gt;1000&lt;/span&gt;) )
        (println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;[ Clock ticked end of working day ]&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)
        (dec x)
        ))
    
(send workingTime waitUntilEndOfTheDay)

(while 
    (pos? @workingTime)
        (&lt;span style="color: #ff9d00;"&gt;do&lt;/span&gt; 
            (Thread/sleep ( + &lt;span style="color: #ff628c;"&gt;10&lt;/span&gt; (rand-int &lt;span style="color: #ff628c;"&gt;21&lt;/span&gt;) ))
            (send chairs customer)))
            
(println &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;Barber has finished the day giving &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; @counter &lt;span style="color: #3ad900;"&gt;"&lt;/span&gt; haircuts.&lt;span style="color: #3ad900;"&gt;"&lt;/span&gt;)&lt;/pre&gt;
&lt;div align="justify"&gt;
I have found many other solutions to this problem, like this &lt;a href="http://bash-shell.net/blog/2011/may/29/seven-languages-seven-weeks-part-10-clojure-day-3/"&gt;one&lt;/a&gt; or another by &lt;a href="http://www.bennadel.com/blog/2101-Seven-Languages-In-Seven-Weeks-Clojure-Day-3.htm"&gt;Ben Nadel&lt;/a&gt;, or &lt;a href="http://blog.clome.info/clojure-day-3/"&gt;this&lt;/a&gt; or even &lt;a href="https://www.google.at/search?q=clojure+sleeping+barber+day+3"&gt;more&lt;/a&gt;, but I like mine because it is original and one of the shortest solutions. Plus it has the most interactive output. Like in if you were in barber shop:&lt;/div&gt;
&lt;blockquote&gt;
&lt;span style="font-size: xx-small;"&gt;…&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: xx-small;"&gt;...haircutting...        &lt;br /&gt;
I went home. This barber shop sucks!         &lt;br /&gt;
...haircutting...         &lt;br /&gt;
I'm next!         &lt;br /&gt;
...haircutting...         &lt;br /&gt;
I'm next!        &lt;br /&gt;
I'm next!        &lt;br /&gt;
[ Clock ticked end of working day ]         &lt;br /&gt;
...haircutting...         &lt;br /&gt;
Barber has finished the day giving&amp;nbsp; 365&amp;nbsp; haircuts.         &lt;br /&gt;
nil&lt;/span&gt;&lt;/blockquote&gt;
&lt;div align="justify"&gt;
It took me slightly more than one hour of real fun to solve this, but it worth every minute I spent. I like great feeling when something challenging was done. For sure it is one of the components of developer’s happiness.&lt;/div&gt;
&lt;div align="justify"&gt;
Have I convinced you that there are a lot of interesting things in programming still awaiting you to pick them up?&lt;/div&gt;
&lt;div align="justify"&gt;
&lt;span style="font-size: xx-small;"&gt;Sorry for highlighting. I didn’t find appropriate Clojure highlighter.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/s4gbKyCozPs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/5067041676995897933/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/11/clojure-programming-language.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5067041676995897933?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5067041676995897933?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/s4gbKyCozPs/clojure-programming-language.html" title="Clojure programming language" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/11/clojure-programming-language.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4ARHw_eip7ImA9WhNQGEw.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-5637918165061063485</id><published>2012-11-25T05:32:00.001+01:00</published><updated>2012-11-25T05:32:25.242+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-25T05:32:25.242+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Personal" /><title>My Dell Studio XPS 16 (1647) upgraded</title><content type="html">&lt;p align="justify"&gt;&lt;img style="margin: 0px 10px 0px 0px; display: inline" title="DellStudioXPS" border="0" alt="DellStudioXPS" align="left" src="http://lh4.ggpht.com/_kD34xgIwKhc/TJvl3YGn91I/AAAAAAAAB1c/S3q4_fGGLeA/DellStudioXPS_thumb%5B8%5D.gif?imgmax=800" width="177" height="177" /&gt;I’m not only reading books &amp;amp; blogging about them. Of course these two things require lots of computer resources :), but I also do some programming and simply sit in front of my laptop, which sometimes requires much more resources, especially if sitting is virtual.&lt;/p&gt;  &lt;p align="justify"&gt;In blog post “&lt;a href="My new Dell Studio XPS 16 (1647) laptop"&gt;My new Dell Studio XPS 16 (1647) laptop&lt;/a&gt;” I wrote “So looking at the pictures above it is seen that bottleneck of my new laptop is hard disk and memory speed. This means that when something will require accessing hard disk (loading something into memory, working with svn, etc) I will not gain performance. Sadly, but I can do nothing about this.”&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;Well, I can!&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Before:   &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_kD34xgIwKhc/TJvl5oB1-vI/AAAAAAAAB1o/IFTh9BWbZwk/s1600-h/Studio.XPS.1647.WindowsExperience8.png"&gt;&lt;img title="Studio.XPS.1647.WindowsExperience" border="0" alt="Studio.XPS.1647.WindowsExperience" src="http://lh3.ggpht.com/_kD34xgIwKhc/TJvl6bz2gbI/AAAAAAAAB1s/mGTBMOCw5Zo/Studio.XPS.1647.WindowsExperience_th.png?imgmax=800" width="694" height="241" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-8nEDj767D4k/ULGfSqfAkaI/AAAAAAAA7GU/-QXrk4sdd8I/s1600-h/image%25255B10%25255D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-pIcvWR1-lvA/ULGfUq55--I/AAAAAAAA7Gc/ZT65-qmH7Uk/image_thumb%25255B6%25255D.png?imgmax=800" width="708" height="239" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I think it is pretty much obvious what happened to my laptop. It got two presents from Amazon:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.de/gp/product/B007BBQQ04/"&gt;Samsung MZ-7PC256B/WW 256GB SSD (2,5’’, 256MB Cache, SATA 6.0Gbps)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://ecx.images-amazon.com/images/I/31oRCCB4x6L._SL500_AA300_.jpg" width="120" height="120" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.de/gp/product/B002YUF8ZG/"&gt;Corsair PC1333 8GB (1333MHz, 204-polig, 2x 4GB) DDR3-RAM Kit&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://ecx.images-amazon.com/images/I/71oTOQ-SrtL._AA1500_.jpg" width="120" height="120" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;While 8Gb of memory and SSD it is not something that can surprise someone these days I feel very happy about my purchase and confident that current performance is enough for me at least for 1 year.&lt;/p&gt;  &lt;p align="justify"&gt;I’ve been thinking if it worth posting my journey of migrating to new hard drive, which includes screwdrivers, aches of system image restoring, backups in clouds and on my external 2Tb drive, ending with bullet points, aka. recommendations for you. But you are not stupid, and internet is full of this crap. Sometimes I’m just getting sick when watching primitive “unpack” videos on youtube, so I hope you didn’t get sick because of my post. I just wanted to share my happiness with you!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/raGJgX8NxRM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/5637918165061063485/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/11/my-dell-studio-xps-16-1647-upgraded.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5637918165061063485?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/5637918165061063485?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/raGJgX8NxRM/my-dell-studio-xps-16-1647-upgraded.html" title="My Dell Studio XPS 16 (1647) upgraded" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_kD34xgIwKhc/TJvl3YGn91I/AAAAAAAAB1c/S3q4_fGGLeA/s72-c/DellStudioXPS_thumb%5B8%5D.gif?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/11/my-dell-studio-xps-16-1647-upgraded.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cMRnk6eip7ImA9WhNQGEw.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-4461850051332388817</id><published>2012-11-23T00:59:00.001+01:00</published><updated>2012-11-25T04:44:47.712+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-25T04:44:47.712+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UnitTesting" /><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><title>Book Review: “The Art of Unit Testing: With Examples in .Net”</title><content type="html">&lt;p align="justify"&gt;&lt;img style="margin: 0px 10px 0px 0px; display: inline" align="left" src="http://i.pdfchm.net/8/3/15651/200/the-art-of-unit-testing-with-examples-in-net.jpg" width="200" height="251" /&gt;I always wanted to read some comprehensive book on unit testing, therefore book “&lt;a href="http://www.amazon.com/Art-Unit-Testing-Examples-Net/dp/1933988274"&gt;The Art of Unit Testing: With Examples in .Net&lt;/a&gt;” appeared in my list of books to read. It has been more than 1 year since I planned to read it, finally it took me only 2 days to read it – yesterday and the day before yesterday. Sometimes comprehensive things are not that comprehensive as you imagine them or… maybe with time topic is no longer that vast for you.&lt;/p&gt;  &lt;p align="justify"&gt;Nevertheless, I remember my first months of my first job as Software Developer. During one of my first team meetings question of failed Unit Tests was raised. Our clients were really concerned about quantity of tests and reasons behind tests failing during nightly builds. I clearly remember that passionate discussion and someone saying “… or are there guys who don’t know what Unit Test is?” and loud laugh after that. I made smile on my face. I maybe heard once or twice about such combination of words, resulting in abbreviation UT, but it didn’t ring a bell. I wasn’t brave enough to ask. Now I think I wasn’t one in that room who didn’t know, otherwise why would we had problems in the first place?&lt;/p&gt;  &lt;p align="justify"&gt;Because of coincidences and my eagerness, when I was about to leave many considered me as internal expert in Unit Testing. No surprises, I have many posts on &lt;a href="http://www.andriybuday.com/search/label/UnitTesting"&gt;UnitTesting&lt;/a&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;Reading this book forced me to think twice about some of the testing techniques I use. Probably I changed my mind about some code I write, both in test and outside. I took some notes for myself.&lt;/p&gt;  &lt;h5&gt;Now bit of critics&lt;/h5&gt;  &lt;p align="justify"&gt;Good indicator if book is for beginners is if it has something like “right click on...” - Yes, this book has few mouse clicks.&lt;/p&gt;  &lt;p align="justify"&gt;Roy introduces many definitions. Some of them are bit contradictional. For example, it might look like there are fakes, stubs and mocks while reading the book, but at some point of time you read this “A fake is a generic term that can be used to describe either a stub or a mock object (handwritten or otherwise), because they both look like the real object.” At least Martin Fowler thinks that fake is different &lt;a href="http://martinfowler.com/articles/mocksArentStubs.html"&gt;from stub and mock&lt;/a&gt;. It is something I also don’t like about definitions in UnitTesting, they are blurred. Every &lt;strike&gt;faking&lt;/strike&gt; mocking framework has its own interpretation and word “mock” is too much overloaded.&lt;/p&gt;  &lt;p align="justify"&gt;As per me, there are some things, which might look not completely professional for the book writer. I mean phrases like this one: “When all else fails and your code is hard to test, you have three choices: use a “super” framework like &lt;em&gt;&lt;font color="#ff8080"&gt;Typemock Isolator&lt;/font&gt;&lt;/em&gt;, change the design, &lt;em&gt;or &lt;font color="#ff8080"&gt;quit your job&lt;/font&gt;.&lt;/em&gt;” I hope you know why Typemock is highlighted as well. :)&lt;/p&gt;  &lt;p align="justify"&gt;Sometimes stuff is over explained. For example, “One test calling another breaks isolation and introduces a dependency” and then goes explanation why this is bad idea with lots of bullet points. Well, I wouldn’t even think about mentioning stupidity of doing such things.&lt;/p&gt;  &lt;p&gt;Book “&lt;a href="http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052"&gt;Working Effectively with Legacy Code&lt;/a&gt;” is referenced really often. It worth reading it. I even have hardcopy of it, but only read few pages.&lt;/p&gt;  &lt;p&gt;Book is really easy to read. It is straight, well structured and formatted. I enjoyed reading it.&lt;/p&gt;  &lt;h5&gt;My personal list of things I can improve about my unit testing&lt;/h5&gt;  &lt;p align="justify"&gt;Caution: this list is my personal, for you it might look completely different. &lt;/p&gt;  &lt;p align="justify"&gt;- I tend to write extremely testable code, which often results in overengineered design with low percentage of “private” code. Roy recommends to not test methods, which are better left private to code under test.&lt;/p&gt;  &lt;p align="justify"&gt;- Stop overspecifying unit tests.&lt;/p&gt;  &lt;p align="justify"&gt;- One mock per test. I would like to violate this rule less frequently.&lt;/p&gt;  &lt;p align="justify"&gt;- Ideally one assert per test.&lt;/p&gt; - Think more about applying some global testing techniques, like separation of integration tests from unit tests, or fast from slow, etc.  &lt;p align="justify"&gt;- Utilize more syntaxes and capabilities of testing/mocking frameworks.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;Do I recommend the book?&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;In short, YES. If you are just starting with Unit Tests this book is excellent for your learning and I highly recommend it. If you have developers in your team who need to learn Unit Testing give them this book. Finally, read it yourself, at least scroll parts 1 and 2, read part 3 and slowly scroll part 4.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/2g42NqRl1WI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/4461850051332388817/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/11/book-review-art-of-unit-testing-with.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4461850051332388817?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4461850051332388817?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/2g42NqRl1WI/book-review-art-of-unit-testing-with.html" title="Book Review: “The Art of Unit Testing: With Examples in .Net”" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/11/book-review-art-of-unit-testing-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMFQ3ozeip7ImA9WhNQFU0.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3805261292851690534</id><published>2012-11-21T01:06:00.001+01:00</published><updated>2012-11-21T14:26:52.482+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-21T14:26:52.482+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Career" /><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><title>Book Review: “Being Geek: The Software Developer's Career Handbook”</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.amazon.com/Being-Geek-Software-Developers-Handbook/dp/0596155409"&gt;&lt;img style="display: inline; float: left" alt="" align="left" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcREU7SkLfNitNNkP4E-kz0KGg34-dfAdrIzosisJCtCLYCLzUTQ" width="225" height="225" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Never heard of such book? Don’t panic, I’m here to help you understand if it worth your time or not.&lt;/p&gt;  &lt;p align="justify"&gt;So, last week I read “&lt;a href="http://www.amazon.com/Being-Geek-Software-Developers-Handbook/dp/0596155409"&gt;Being Geek&lt;/a&gt;” in hope that it will energize me and give some additional inspiration, which I’m lacking it in my new job, but this is topic for separate post.&lt;/p&gt;  &lt;p align="justify"&gt;I’m not completely sure if I’m any kind of geek, but the book describes people who share many similar habits to those I have and very likely many other developers have as well.&amp;#160; &lt;/p&gt;  &lt;p align="justify"&gt;Michael takes you though one reincarnation of your gig from the beginning, when you are just passing an interview until the end, when you are considering to leave. He provides you with lot of hints and tips for any stage of your career, whenever it is negotiating of your salary, creating quality code or leading others.&lt;/p&gt;  &lt;p align="justify"&gt;I’m lucky that I’ve never heard about author’s blog “&lt;a href="http://www.randsinrepose.com/"&gt;Rands in Repose&lt;/a&gt;” before, because otherwise I would not reap anything new accordingly to &lt;a href="http://www.amazon.com/Being-Geek-Software-Developers-Handbook/dp/0596155409"&gt;reviews on Amazon&lt;/a&gt;. I read this book in quick pace, as I usually like short essays talking about our developer’s job. I think that book has increased by baggage of understanding how developers see their profession, how real management should look like, and what are interactions between different types of people in software organization.&lt;/p&gt;  &lt;p align="justify"&gt;Author definitely has much more management experience than average developer has therefore his story is shifted towards company’s core – employees and their interaction. He helps to understand how organizations operate on higher level. I think that this is exactly what I’ve grasped from the book, and what you can also take for yourself.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;Do I recommend the book?&lt;/strong&gt; – Well, if you don’t read Lopp’s blog and if you like career and software craftsmanship books and if you don’t have any other higher priority books in mind, then yes. :)&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/ebKhaAjSSxU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3805261292851690534/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/11/book-review-being-geek-software.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3805261292851690534?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3805261292851690534?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/ebKhaAjSSxU/book-review-being-geek-software.html" title="Book Review: “Being Geek: The Software Developer&amp;#39;s Career Handbook”" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/11/book-review-being-geek-software.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IBSHo8eyp7ImA9WhNSFEo.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3291552748452182685</id><published>2012-10-29T02:52:00.001+01:00</published><updated>2012-10-29T02:52:39.473+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-29T02:52:39.473+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Haskell" /><title>Haskell programming language</title><content type="html">&lt;p align="justify"&gt;&lt;img style="margin: 0px 5px 0px 0px; display: inline; float: left" align="left" src="http://www.haskell.org/wikiupload/4/4a/HaskellLogoStyPreview-1.png" width="128" height="128" /&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;&lt;font style="style"&gt;“Haskell is an advanced &lt;/font&gt;&lt;font style="style"&gt;purely-functional&lt;/font&gt;&lt;font style="style"&gt; programming language. An open-source product of more than twenty years of cutting-edge research, it allows rapid development of robust, concise, correct software.” This &lt;a href="http://www.haskell.org/haskellwiki/Haskell"&gt;official&lt;/a&gt; definition is only missing one point: &lt;/font&gt;Haskell is mind-blowing programming language.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;First of all, let’s start with realizing that Haskell is all about purity as opposite to many other functional languages, which do a lot of compromises, like &lt;a href="http://www.andriybuday.com/2012/09/scala-language.html"&gt;Scala&lt;/a&gt;. It could be due to the fact that this language was created by a group of highly educated people, or better to say researches. I think their intent was exactly to create language which would be some kind of definition of a pure functional language.&lt;/p&gt;  &lt;h5 align="justify"&gt;So what does “pure” mean in this context?&lt;/h5&gt;  &lt;p align="justify"&gt;As per &lt;a href="http://stackoverflow.com/questions/4382223/pure-functional-language-haskell"&gt;Joel Spolsky&lt;/a&gt;, when answering similar question on SO:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;“In a &lt;em&gt;pure&lt;/em&gt; functional language, you can't do anything that has a side effect.&lt;/p&gt;    &lt;p align="justify"&gt;A side effect would mean that evaluating an expression changes some internal state that would later cause evaluating the same expression to have a different result. In a pure functional language you can evaluate the same expression as often as you want with the same arguments, and it would always return the same value, because there is no state to change.&lt;/p&gt;    &lt;p align="justify"&gt;For example, a pure functional language cannot have an assignment operator or do input/output, although for practical purposes, even pure functional languages often call impure libraries to do I/O.”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;Personally I found Haskell to be the most exciting programming language among all I’ve ever touched. It has many interesting paradigms and features. Most of them are present in other languages, some are not. I would like to briefly go through some of them.&lt;/p&gt;  &lt;h5 align="justify"&gt;Currying&lt;/h5&gt;  &lt;p align="justify"&gt;In Haskell there is no function that can accept more than one parameter. What?&lt;/p&gt;  &lt;p align="justify"&gt;Well, of course you can write function&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font style="background-color: #cccccc"&gt;&lt;/font&gt;&lt;font style="style" face="Consolas"&gt;add a b = a + b&lt;/font&gt;&lt;font style="background-color: #cccccc"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;But, under the hood it is always translated into 2 functions. One of them is responsible for taking parameter &lt;font face="Consolas"&gt;a&lt;/font&gt; and applying (+) to result of second function. Second function is there to take first function and apply it on &lt;font face="Consolas"&gt;b&lt;/font&gt;.&lt;/p&gt;  &lt;h5 align="justify"&gt;Partially applied functions&lt;/h5&gt;  &lt;p align="justify"&gt;This allows for partially applied functions, which is completely cool stuff.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;map ( * 2) [1,2,3]&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;In above code ( * 2) is actually partially applied function. We are only supplying one parameter instead of two, expected by the * function. So the result of what we get is a function like (x * 2), accepting parameter x.&lt;/p&gt;  &lt;p align="justify"&gt;This function is then applied to the list [1,2,3] one by one, thus we get: [2,4,6].&lt;/p&gt;  &lt;p align="justify"&gt;As another example, we can extract partially applied function from our &lt;font face="Consolas"&gt;add&lt;/font&gt; to create function, which always adds 1.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;addOne x = add 1&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;So it can be used like &lt;font face="Consolas"&gt;addOne 5&lt;/font&gt; to produce 6. &lt;/p&gt;  &lt;h5 align="justify"&gt;Lazy evaluation, zipping and few other things&lt;/h5&gt;  &lt;p align="justify"&gt;Lazy evaluation isn’t anything new for C# developer. You can think about it as about differed execution in LINQ. Zipping is not something cool, but rather one of the common features of functional languages, but I just wanted to include it here. Below is function every8, which demonstrates mentioned things as well as ranges and recursion.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;module Every8thStartingWithSumOfXandY where      &lt;br /&gt;&amp;#160; everyThird x = x:everyThird(x+3)       &lt;br /&gt;&amp;#160; everyFifth y = [y,(y+5) ..]       &lt;br /&gt;&amp;#160; every8 x y = zipWith (+) (everyThird (x)) (everyFifth (y)) &lt;/font&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;You can later use this code to get [4,12,20,28], like below:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;take 4 (every8 1 3)&lt;/font&gt;&lt;/p&gt;  &lt;h5 align="justify"&gt;List comprehensions&lt;/h5&gt;  &lt;p align="justify"&gt;This code below allows you two have a list, which consists with items which are less than 3:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;[x | x &amp;lt;- [1,2,3,4,5,6], x &amp;lt; 3]&lt;/font&gt;&lt;/p&gt;  &lt;h5 align="justify"&gt;Pattern matching and guars&lt;/h5&gt;  &lt;p align="justify"&gt;For example we can match on head and tail of list to perform reverse of list:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;rev (h:t) = rev t ++ [h]&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Combining pattern matching and list comprehensions we can effectively write quick sort in one line:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Consolas"&gt;qSort (m:r) = qSort [x | x &amp;lt;- r, x &amp;lt; m] ++ [m] ++ qSort [x | x &amp;lt;- r, x &amp;gt;= m]&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;When I wrote this, I was so much amazed if not shocked about how much Haskell is concise and powerful in expressing complex things. I used to write quick sort many times in C++ back in my university days during programming competitions and even it was easy it never took me one minute or one line to write. (Of course, there are performance considerations regarding two implementations, but we are not talking about them now.)&lt;/p&gt;  &lt;h5 align="justify"&gt;Monads&lt;/h5&gt;  &lt;p align="justify"&gt;Don’t be mislead. A lot of other trivial things in Haskell are painful and difficult to implement. To somehow overcome such complexities concept of monads was introduced in functional languages. With them chain of operations can be executed allowing to bypass some data (or state if you will).&amp;#160; “Haskell is overly abstract and seems to complicate the simplest tasks, but once you see how monads unify some of the most difficult concepts in programming: backtracking, continuations, error propagation, state management, and parsing, among many others, you can begin to appreciate how elegant monads really are. But to people not familiar with those topics and their difficulty and who have never seen monadic code, monads are just weird math crap.” said Tac-TIcs. Well, for me they are still very difficult even I can read and understand code with their usage. I’ve prepared some other piece of code, which will probably not bring much light on monads, but it shows usage of build-in &lt;em&gt;Nothing&lt;/em&gt; and &lt;em&gt;Just. &lt;/em&gt;Defining own monads is hard, and worth separate blog post.&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;module Main where&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;look key [] = Nothing     &lt;br /&gt;look key ((k, val):rest)      &lt;br /&gt;&amp;#160; | key == k&amp;#160; = Just val      &lt;br /&gt;&amp;#160; | otherwise = look key rest&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;al = [(1, []), (2, [(22, &amp;quot;something deep inside&amp;quot;)]), (3, [(33, &amp;quot;else&amp;quot;)])]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Which can be used like this:&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;look 2 al &amp;gt;&amp;gt;= look 22&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;So you can basically work around Haskell’s restrictions and call methods one by one, using this smarty-looking operator “&amp;gt;&amp;gt;=”. Haskell made easy things hard and then introduced Monads to make those hard things easy again. Now you can write code with sugar &lt;em&gt;do-syntaxes&lt;/em&gt;.&lt;/p&gt;  &lt;h5 align="justify"&gt;Conclusion&lt;/h5&gt;  &lt;p align="justify"&gt;I’m too new to Haskell to talk about some advanced features and to write programs which are over 10 lines of code. But from what I’ve tried I definitely like the language. This is language for your weekend’s fun. Play with it!&lt;/p&gt;  &lt;p align="justify"&gt;&lt;em&gt;I hope you liked this short Haskell journey.&lt;/em&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/Utovqi5AC_o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3291552748452182685/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/10/haskell-programming-language.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3291552748452182685?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3291552748452182685?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/Utovqi5AC_o/haskell-programming-language.html" title="Haskell programming language" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/10/haskell-programming-language.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4HSXY9fyp7ImA9WhNTGUk.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-810833352987455415</id><published>2012-10-23T01:18:00.001+02:00</published><updated>2012-10-23T01:18:58.867+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-23T01:18:58.867+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><title>Book Review: “The Pragmatic Programmer”</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X"&gt;&lt;img style="margin: 0px 5px 0px 0px; display: inline; float: left" alt="" align="left" src="http://ryanfunduk.com/img/books/the_pragmatic_programmer.gif" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;/p&gt;  &lt;p align="justify"&gt;It took me less than one week to reread &lt;a href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X"&gt;“The Pragmatic Programmer”&lt;/a&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;I like beginning of the book the most, because it introduces pragmatic programmer and I like to think about myself as about such type of programmer.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;So who are pragmatic programmers?&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Pragmatic programmers are guys with willing to outperform, to stand out of the crowd, always trying to see bigger picture in order to produce higher quality code and to bring more value to customers. They learn a lot, they read technical blogs. You are also pragmatic, as very likely you share similar opinions about doing our job. &lt;/p&gt;  &lt;p align="justify"&gt;We don’t stop on achieved, we continue improving. We don’t just do our tasks, we make sure we do the right thing. We have a vision on our career and on what we want from our professional lives. We don’t complain, we solve problems. Cats don’t eat our source code, and we don’t live with broken window. We keep an eye on what is happening so no one can silently boil us as stupid frogs.&lt;/p&gt;  &lt;p align="justify"&gt;As per book pragmatic programmer is &lt;em&gt;early adopter&lt;/em&gt;, &lt;em&gt;inquisitive&lt;/em&gt;, &lt;em&gt;critical thinker&lt;/em&gt;, &lt;em&gt;realistic&lt;/em&gt; and &lt;em&gt;jack of all trades&lt;/em&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;This book is critically outdated when it comes to technologies or tools, because it was written IT centuries ago, in 1999. But it is astonishing how up to date it is about all other things.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;I strongly recommend reading this book.&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;I find ideas expressed in book close to my understanding of software craftsmanship and I have my &lt;a href="http://www.andriybuday.com/2010/01/things-you-need-to-remember-to-become.html"&gt;things to remember to become successful developer&lt;/a&gt;. In book you will find 70 tips, not just 8 as I have in my post!&lt;/p&gt;  &lt;p align="justify"&gt;I think this book is great because it inspires, and thus I would like to read it once again.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/wxuIE8yFmF0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/810833352987455415/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/10/book-review-pragmatic-programmer.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/810833352987455415?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/810833352987455415?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/wxuIE8yFmF0/book-review-pragmatic-programmer.html" title="Book Review: “The Pragmatic Programmer”" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/10/book-review-pragmatic-programmer.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4MRns_fyp7ImA9WhNTFUw.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-1017811560085854945</id><published>2012-10-17T23:54:00.001+02:00</published><updated>2012-10-17T23:56:27.547+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-17T23:56:27.547+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="CodeAndBeer" /><category scheme="http://www.blogger.com/atom/ns#" term="DevMeeting" /><title>Code &amp; Beer: Functional programming languages – Try 1</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.flickr.com/photos/tsevis/90208775/"&gt;&lt;img style="display: inline; float: left" align="left" src="http://farm1.staticflickr.com/30/90208775_8629b74bfb.jpg" width="240" height="240" /&gt;&lt;/a&gt;Last week I’ve failed in organizing internal “Code &amp;amp; Beer” event.&lt;/p&gt;  &lt;p align="justify"&gt;So what I did was just short invite stating that I will be there after working day and whoever wants can come and join. I bought some beer and snacks and mentioned about this as well. At least it should have been a good reason for some to join.&lt;/p&gt;  &lt;p align="justify"&gt;Idea behind this was to learn some new concepts from functional programming, which day-to-day language doesn’t support or encourage explicitly.&lt;/p&gt;  &lt;p align="justify"&gt;As I try to introduce myself to some of the programming languages (including functional), I thought it would be wonderful idea to do this in circle of people who share same attitude to programming.   &lt;br /&gt;&amp;#160; &lt;br /&gt;I didn’t have high expectation to number of attendees. I thought that maybe 5 will join, but even less came. A good dozen of people who promised that they will attend had good excuses. 2 people is not enough for effective code &amp;amp; beer session. Not enough laugh and not enough diversity. But no one of us wasted our time, not sure about those who didn’t join though.&lt;/p&gt;  &lt;p align="justify"&gt;I tried small and it went even smaller, maybe if I try bigger it will be at least small? Who knows. But I’m afraid that there is not enough interested developers in my company so it should be something behind company’s walls.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/xQT1bov2GYo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/1017811560085854945/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/10/code-beer-functional-programming.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/1017811560085854945?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/1017811560085854945?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/xQT1bov2GYo/code-beer-functional-programming.html" title="Code &amp;amp; Beer: Functional programming languages – Try 1" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/10/code-beer-functional-programming.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YCQnc_eCp7ImA9WhJbFU4.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3215142618406040542</id><published>2012-09-24T23:45:00.001+02:00</published><updated>2012-09-25T01:59:23.940+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-25T01:59:23.940+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Conferences" /><title>Professional .NET 2012 – Vienna, Austria</title><content type="html">&lt;p align="justify"&gt;On September 14, 2012 I attended conference for .NET developers here in Vienna, called &lt;a href="http://pronet2012.dotnet-austria.at/"&gt;Professional .NET 2012&lt;/a&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://pronet2012.dotnet-austria.at/"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-C9Oe3aGv1YE/UGDz2VhKMtI/AAAAAAAA7F8/y68Ckc0c9K0/image%25255B6%25255D.png?imgmax=800" width="530" height="154" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;I’m very glad that company has sent me to this conference. Well, it was not any kind of exclusive and expensive conference somewhere abroad, but rather excellent money for value event for employees, who like to improve their professional skills. When I just started I asked about going to Oslo for &lt;a href="http://www.ndcoslo.com/"&gt;NDC&lt;/a&gt;, which is awesome conference. For new developer it was bit too over budget and I understand it - who knows, maybe in reality I’m crap-code writer, which shall be fired the next morning.&lt;/p&gt;  &lt;p align="justify"&gt;Conference took place in some hotel, and from what I understood, not cheap one. So accordingly it resulted in great tasty lunch. This is always a big plus for any conference. Despite it was called “Professional .NET” I have seen a lot of young people which didn’t seem to have years of experience at all. If I were student I wouldn’t take much out of that day.&lt;/p&gt;  &lt;p align="justify"&gt;Intro and 2 side talks were in German, so I cannot say anything about those, for me it was boring. All other sessions were in English.&lt;/p&gt;  &lt;p align="justify"&gt;Two special presenters were invited and they were core for the conference.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://ayende.com/blog"&gt;Ayende Rahien&lt;/a&gt; just turned all things upside-down. Whatever you learnt from any smart patterns books older than few years is just not acceptable. Everything could be written in very simple manner with depth averaging 4. True or false?&lt;/p&gt;  &lt;p align="justify"&gt;Personally I liked very much the way Ayende presented stuff and how he talked about things and also that he made people think. Even flow of his speech was like some continuing brainstorm. What I didn’t like completely is that he is very concentrated only on one side of the problem, talking like all software is just about reading data from database. Yes, I say something against known Ayende, because I’m sure he shows only one side of the coin. Besides, he likes to blame other people, so why not other people blame him a bit.&lt;/p&gt;  &lt;p align="justify"&gt;If you don’t know Ayende, for sure you have heard about his projects. Oren (his real name) has written Rhino Mocks, RavenDB, NhibernateProfier and contributed to tons of open source projects.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://codebetter.com/sebastienlambla/"&gt;Sebastien Lambla&lt;/a&gt; was another special guest. To be honest, I’ve never heard about him before (but I realize now that I read his posts time-to-time). Apparently he has contributed a lot to open source and community, as people, who attended with me knew about him. You maybe heard about OpenWrap or OpenRasta. I just went though this &lt;a href="http://www.codeproject.com/Articles/351849/A-Coder-Interview-With-Sebastien-Lambla"&gt;interview&lt;/a&gt; with him, to understand more about what he does. Steve Ballmer, you should finally respond him with Microsoft’s vision on open-source! &lt;/p&gt;  &lt;p align="justify"&gt;It was interesting conference, but not a revolution.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/duFtHcWU3xQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3215142618406040542/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/09/professional-net-2012-vienna-austria.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3215142618406040542?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3215142618406040542?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/duFtHcWU3xQ/professional-net-2012-vienna-austria.html" title="Professional .NET 2012 – Vienna, Austria" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-C9Oe3aGv1YE/UGDz2VhKMtI/AAAAAAAA7F8/y68Ckc0c9K0/s72-c/image%25255B6%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/09/professional-net-2012-vienna-austria.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcDQXc7eip7ImA9WhJUEkw.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3091781075450602559</id><published>2012-09-04T00:49:00.001+02:00</published><updated>2012-09-09T20:57:50.902+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-09T20:57:50.902+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scala" /><category scheme="http://www.blogger.com/atom/ns#" term="Languages" /><title>Scala Language</title><content type="html">&lt;p align="justify"&gt;Back in university I had few classes dedicated to Scala programming language. Sometimes suddenly things come back to us.&lt;/p&gt;  &lt;p align="justify"&gt;If you never heard about Scala, here is my very short introduction.&lt;/p&gt;  &lt;p align="justify"&gt;Scala was created as bridge between object oriented and functional languages so that it can run on Java Virtual Machine (JVM) and be fully interoperable with Java classes. As Martin Odersky, creator of language, said “I wanted to show that the two paradigms can be unified and that something new and powerful could result from that combination.”&lt;/p&gt;  &lt;p align="justify"&gt;Scala doesn’t force to write in functional style, however it does have all standard features one would expect from functional programming language. The more you prefer OOP, the more likely that your Scala code will look like Java code. If someone starts with functional languages he or she might get impression that Scala isn’t functional language at all. Personally, if I wanted to learn functional programming I would rather go for Haskell which will “force you to eat the whole functional programming burrito”, as Bruce A. Tate, author of “7 languages in 7 weeks” says.&lt;/p&gt;  &lt;p align="justify"&gt;Scala allows for very laconic syntaxes. Sometimes it is way to much of different syntaxes, sometimes syntax is quaint, for example operator “::=” for adding elements to the list, but once you played enough with language you will be able to write shorter pieces of code than what it would take in most conventional languages.&lt;/p&gt;  &lt;p align="justify"&gt;Here is how you could calculate total sum of string lengths in a list:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;val listOfStrings = List(&lt;span class="str"&gt;&amp;quot;a&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;ab&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;abcd&amp;quot;&lt;/span&gt;)
val totLength = (0 /: listOfStrings) { (length, item) =&amp;gt; length + item.length() }
println(totLength)&lt;/pre&gt;

&lt;p&gt;I also wrote generation of permutations in in lexicographic order:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;object&lt;/span&gt; PermutationGenerator extends App {

  var perm = Array[Char](&lt;span class="str"&gt;'a'&lt;/span&gt;, &lt;span class="str"&gt;'b'&lt;/span&gt;, &lt;span class="str"&gt;'c'&lt;/span&gt;, &lt;span class="str"&gt;'d'&lt;/span&gt;)
  printPerm(1, perm)

  &lt;span class="kwrd"&gt;for&lt;/span&gt; (i &amp;lt;- 2 to factorial(perm.length)) {
    perm = nextPermutation(perm)
    printPerm(i, perm)
  }

  def factorial(n: Int): Int = n match {
    &lt;span class="kwrd"&gt;case&lt;/span&gt; 0 =&amp;gt; 1
    &lt;span class="kwrd"&gt;case&lt;/span&gt; x &lt;span class="kwrd"&gt;if&lt;/span&gt; x &amp;gt; 0 =&amp;gt; n * factorial(n - 1)
  }

  def printPerm(i: Int, a: Array[Char]) {
    print(i + &lt;span class="str"&gt;&amp;quot;: &amp;quot;&lt;/span&gt;)
    a.&lt;span class="kwrd"&gt;foreach&lt;/span&gt;(c =&amp;gt; print(c))
    println()
  }

  def swap(a: Array[Char], i: Int, j: Int) {
    val tmp = a(i)
    a(i) = a(j)
    a(j) = tmp
  }

  def nextPermutation(a: Array[Char]): Array[Char] = {

    val k = (a zip a.tail) lastIndexWhere { &lt;span class="kwrd"&gt;case&lt;/span&gt; (x, y) =&amp;gt; x &amp;lt; y }

    val l = a lastIndexWhere { c =&amp;gt; a(k) &amp;lt; c }

    swap(a, l, k)

    &lt;span class="kwrd"&gt;return&lt;/span&gt; a.take(k + 1) ++ a.takeRight(a.length - k - 1).reverse
  }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;Code above isn’t functional or imperative completely but rather some combination. Scala is different from other languages, because it allows for such flexibility. There are languages which make easy things hard and hard thing easy. In Scala it is up to you. For example, to avoid &lt;em&gt;swap&lt;/em&gt; method (mutable operations) I could have wrote this “obvious” statement:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; (a.take(k) :+ a(l)) ++ ((a.takeRight(a.length - k - 1).take(l - k - 1) :+ a(k)) ++ a.takeRight(a.length - l - 1)).reverse&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;Few days ago I also wrote one application to continuously traverse web site and find there some specific links and then send e-mail with complete list of them. But to be honest I gave up debugging it and finding problems, even Scala has more or less accepted integration in eclipse IDE. App was rewritten in C#. My cheating was supposed to win T-shirt to my wife. Surprisingly the site went down next day. My guess is I was not the only one smart-ass to do traversing of the site.&lt;/p&gt;

&lt;p align="justify"&gt;I only took few baby steps, but from what I know now I feel deep sympathy to this language.&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blog.redfin.com/devblog/2010/05/how_and_why_twitter_uses_scala.html"&gt;How and Why Twitter Uses Scala&lt;/a&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href="www.scala-lang.org/node/25"&gt;Scala official introduction&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Have you every programmed in Scala? How was it?&lt;/p&gt;

&lt;p&gt;I imagine that it was fun, but would like to hear from you.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/A_dXoX_I6yY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3091781075450602559/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/09/scala-language.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3091781075450602559?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3091781075450602559?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/A_dXoX_I6yY/scala-language.html" title="Scala Language" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/09/scala-language.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEHQXYzcCp7ImA9WhJXEk0.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3264147680327825554</id><published>2012-08-05T23:53:00.001+02:00</published><updated>2012-08-05T23:53:50.888+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-05T23:53:50.888+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="DevMeeting" /><category scheme="http://www.blogger.com/atom/ns#" term="Success" /><category scheme="http://www.blogger.com/atom/ns#" term="Presentation" /><title>My First Presentation in a New Company</title><content type="html">&lt;p align="justify"&gt;A long time passed since I’ve delivered a technical presentation. Mainly because I now live in another country and establishing myself in a new company.&lt;/p&gt;  &lt;p align="justify"&gt;Well “establishing” is loudly said. I’m just software developer. Probably it worth to write separate post on my experiences in this company, since it is very much different from one I worked in Ukraine and I’m sure from most other companies there. I think I had much better perspectives as speaker before I moved (at least those short-term perspectives).&lt;/p&gt;  &lt;p align="justify"&gt;I talked about OData protocol, starting with introduction (read blog posts &lt;a href="http://www.andriybuday.com/2012/05/odata.html"&gt;OData&lt;/a&gt; and &lt;a href="http://www.andriybuday.com/2012/05/odata-service-with-wcf-and-data-in.html"&gt;OData service with WCF and data in memory&lt;/a&gt;) and finishing with its applicability to a project we do. Thanks to this presentation &lt;strong&gt;I crossed some imaginary mental barrier to more frequent presentations and sharing knowledge, something that I like, and something that I &lt;/strong&gt;&lt;a href="http://www.andriybuday.com/search/label/Presentation"&gt;&lt;strong&gt;started to take solid steps&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; back in Ukraine&lt;/strong&gt;. &lt;/p&gt;  &lt;p align="justify"&gt;Now I’m starting it from the beginning.&lt;/p&gt;  &lt;p align="justify"&gt;Presentation I delivered was rather not official and only team wide. It was first I ever delivered in English, so I was limited in number of language tricks which I can use, and probably it impacted quality. Also I didn’t want to make it look like I’m smart-ass, thus I used pace and tone of a normal working meeting. Well, to be honest, I even didn’t know how to behave in this new environment. But from what I see &lt;strong&gt;guys liked my presentation&lt;/strong&gt;, so this gives me a bright spark of enthusiasm to continue sharing interesting stuff.&lt;/p&gt;  &lt;p align="justify"&gt;There are few pitfalls with continuing, some of them pleasing. For example, developers here on average are more experienced and it would be more difficult to surprise them with something. It means that I would need to prepare more in depth topics, which of course requires more time to prepare. But, in the end, it is great that I work with more experienced programmers than me. On the other hand, I’m afraid that most of guys I know here are not willing to spend their spare time to form or join some community of software developers, and I can understand them.&lt;/p&gt;  &lt;p align="justify"&gt;Since I already mentioned about community, &lt;strong&gt;I have some ideas about organizing something cool here in Vienna/Austria, for foreigner developers, like me&lt;/strong&gt;. Will blog about it soon.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/2pSYVv4Xixk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3264147680327825554/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/08/my-first-presentation-in-new-company.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3264147680327825554?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3264147680327825554?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/2pSYVv4Xixk/my-first-presentation-in-new-company.html" title="My First Presentation in a New Company" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/08/my-first-presentation-in-new-company.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8BRHk_cCp7ImA9WhJRGUQ.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-2291164544979546448</id><published>2012-07-23T00:40:00.001+02:00</published><updated>2012-07-23T00:40:55.748+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-23T00:40:55.748+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>Book Review: Programming WCF Services</title><content type="html">&lt;p&gt;&lt;img style="display: inline; float: left" border="0" align="left" src="http://ebookvn.info/bookimg/29/Programming-WCF-Services-Mastering-WCF-and-the-Azure-AppFabric-Service-Bus0596805489.jpeg" height="280" /&gt;&lt;/p&gt;    &lt;p align="justify"&gt;To be honest, for me this was the most exhausted reading since years. I started reading this book probably year or even more ago. Always coming back to it in hope that at some point of time it will grasp me into normal pace of reading, so I will be able to finish it. But it was not the case.&lt;/p&gt;  &lt;p align="justify"&gt;Though I finished the “&lt;a href="www.amazon.com/Programming-WCF-Services-Mastering-AppFabric/dp/0596805489/"&gt;Programming WCF Services&lt;/a&gt;”, I’m bit disappointed. I thought that the book will serve me with deep insight into advanced topics in easy to consume manner. Instead it jumped from extreme basics to intermediate and to advanced, but always with chunks of code, which were either boring or repeating or difficult to understand by simple reading. When I was about to try something out articles from internet were more helpful for me then code from book.&lt;/p&gt;  &lt;p align="justify"&gt;The book is good in what it does, but now I think about it more like about cookbook and not like about book you read from beginning to the end. It was my mistake to read it like that. &lt;/p&gt;  &lt;p align="justify"&gt;I feel myself comfortable with WCF. Reading this book was to strengthen my knowledge in WCF and to open tough things I didn’t know. I’m afraid that I did not met what I expected. Of course no one can remember all innumerous extension points or tricky security configuration or other wide range of stuff possible with WCF. Probably author of the book knows everything he wrote by heart. I wish I have super memory, but I often forget a lot of things I read about. Pity! If you know basics and understand core principles it should not be a problem to figure out what you need with couple of MSDN pages and some googling. I hope I will manage my further assignments even without knowing all possible combinations of configurations of WCF, even I look stupid not being able to shot people with immediate WCF solutions/answers/ideas.&lt;/p&gt;  &lt;p align="justify"&gt;One more lesson learned: It is better to play more with things you what to learn about than to obdurately read comprehensive book about those things. &lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/SqY6fW_PJao" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/2291164544979546448/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/07/book-review-programming-wcf-services.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/2291164544979546448?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/2291164544979546448?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/SqY6fW_PJao/book-review-programming-wcf-services.html" title="Book Review: Programming WCF Services" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/07/book-review-programming-wcf-services.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QNRHkyfyp7ImA9WhJSF0o.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-61930358073475413</id><published>2012-07-08T21:23:00.001+02:00</published><updated>2012-07-08T21:23:15.797+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-08T21:23:15.797+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="IoLanguage" /><title>Io programming language</title><content type="html">&lt;p align="justify"&gt;I would expect that most of you never heard about such programming language as Io. Very likely programmers would associate Io with “input-output”, but Io language has nothing special to do with it and has no cool in-out features.&lt;/p&gt;  &lt;p align="justify"&gt;Io is extremely tiny language which runs on supermall virtual machine, even your micro-oven can handle. Having that said I don’t mean that Io is not powerful.&lt;/p&gt;  &lt;p align="justify"&gt;Io is prototypical object-oriented language with dynamic typing. For me, as C# guy, it was not easy to “feel” the language. I could very quickly understand syntaxes and mechanisms of language. It will not take for you longer than 20 minutes to start writing simple code, either. I was understanding what I was trying out, but I didn’t feel myself comfortable with realizing that anything can be changed in this language on the fly which could affect all of the prototypes of changed object. Note that there is no difference between class and object, or better to say, there are no classes in Io. If you define method on some object it is ultimately inherited to the clones. It worth to mention that in Io every operation is message. “Hello world” application which would look like:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;“hello world” println&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;Should be understood like: “send message “println” to the string object”. 

&lt;p&gt;Here is bit more code (sheep example cloned from &lt;a href="http://ozone.wordpress.com/2006/03/15/blame-it-on-io/"&gt;this post&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;Sheep := Object clone
Sheep legCount := 4
MutantSheep := Sheep clone
MutantSheep legCount = 7
dolly := MutantSheep clone
MutantSheep growMoreLegs := method(n, legCount = legCount + n)
dolly growMoreLegs(2)&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;The coolest thing about Io is its concurrency model, at least I think so.&lt;/p&gt;

&lt;p align="justify"&gt;Io uses coroutines, actors, yielding and future stuff. If you don’t know what it is about. Here is a bit of explanation. Coroutines in Io are user threads, built on top of kernel threads, which allows for quick switching of contexts and more flexibility in general. For simplicity think about coroutines as about threads. Any object can be sent message asynchronously, by adding @ symbol before the message name. This message is then places in object’s message queue for processing. Object would hold coroutine (thread) for processing those messages. Objects holding coroutine are called Actors. Effectively any object in Io can become Actor. When you call some methods asynchronously, result can be saved into so called “future”, value of which is resolved before it is used. You can switch between actors using “yield”. To demonstrate this, I prepared this small piece of code, which prints numbers 0,1,2,3 one by one:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;oddPrinter := Object clone
evenPrinter := Object clone
oddPrinter print := method(1 println; yield; 3 println; )
evenPrinter print := method(0 println; yield; 2 println; yield)
oddPrinter @print; evenPrinter @print;&lt;/pre&gt;

&lt;p align="justify"&gt;If you found this to be interesting I recommend you to read &lt;a href="http://www.iolanguage.com/scm/io/docs/IoGuide.html"&gt;Io Guide&lt;/a&gt;. There you will find many other interesting features of the Io language, which I didn’t mention.&lt;/p&gt;

&lt;p align="justify"&gt;Here are some links:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;Io language site: &lt;a title="http://www.iolanguage.com/scm/io/docs/IoGuide.html" href="http://www.iolanguage.com/"&gt;http://www.iolanguage.com/&lt;/a&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;A very nice introduction to Io: &lt;a href="http://ozone.wordpress.com/2006/03/15/blame-it-on-io/"&gt;blame it on Io&lt;/a&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;Official &lt;a href="http://www.iolanguage.com/scm/io/docs/IoGuide.html"&gt;Io Guide&lt;/a&gt;.&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;a href="http://en.wikipedia.org/wiki/Actor_model"&gt;Actor model on wiki&lt;/a&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;You may be wondering why I’m writing and learning something about old, small language, which even doesn’t have normal ecosystem.&lt;/p&gt;

&lt;p align="justify"&gt;I’m trying to learn more programming concepts and play with different languages. Recently I was even blamed for writing “enterprise-y code” and suggested to see how code looks like in other programming language communities. Well… of course it is valid and good suggestion, but not that I never thought about it. In my &lt;a href="http://www.andriybuday.com/2012/01/where-do-you-want-to-be-in-year.html"&gt;year plan post&lt;/a&gt; I mentioned that I would like to learn one more programming language and to start with something I picked up interesting book called “&lt;a href="http://pragprog.com/book/btlang/seven-languages-in-seven-weeks"&gt;7 languages in 7 weeks&lt;/a&gt;”. So far I read and tried Ruby, Io and Prolog. Scala, Erlang, Clojure and Haskell are next in a row. After I’m done with book I will pick one language (not compulsory from list) and extend my knowledge in it. Of course there will be a review on the book.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/j9dC1A6uadA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/61930358073475413/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/07/io-programming-language.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/61930358073475413?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/61930358073475413?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/j9dC1A6uadA/io-programming-language.html" title="Io programming language" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/07/io-programming-language.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4MQX85fCp7ImA9WhJSGUk.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3764372060983601872</id><published>2012-07-04T20:47:00.001+02:00</published><updated>2012-07-10T19:23:00.124+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-10T19:23:00.124+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HowTo" /><category scheme="http://www.blogger.com/atom/ns#" term="DistributedCache" /><category scheme="http://www.blogger.com/atom/ns#" term="Errors" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="Opinion" /><title>Application Fabric Cache – an easy, but solid start</title><content type="html">&lt;p align="justify"&gt;I would like to share some experiences of working with Microsoft AppFabric Cache for Windows Server.&lt;/p&gt;  &lt;p align="justify"&gt;AppFabricCache is distributed cache solution from Microsoft. It has very simple API and would take you 10-20 minutes to start playing with. As I worked with it for about one month I would say that product itself is very good, but probably not enough mature. There are couple of common problems and I would like to share those. But before let’s get started!&lt;/p&gt;  &lt;p align="justify"&gt;If distributed cache concept is something new for you, don’t be scary. It is quite simple. For example, you’ve got some data in your database, and you have web service on top of it which is frequently accessed. Under high load you would decide to run many web instances of your project to scale up. But at some point of time database will become your bottleneck, so as solution you will add caching mechanism on the back-end of those services. You would want same cached objects to be available on each of the web instances for that you might want to copy them to different servers for short latency &amp;amp; high availability. So that’s it, you came up with distributed cache solution. Instead of writing your own you can leverage one of the existing. &lt;/p&gt;  &lt;h4 align="justify"&gt;Install&lt;/h4&gt;  &lt;p align="justify"&gt;You can easily download AppFabricCache from &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=15848"&gt;here&lt;/a&gt;. Or install it with Web Platform Installer.&lt;/p&gt;  &lt;p align="justify"&gt;Installation process is straight forward. If you installing it to just try, I wouldn’t even go for SQL server provider, but rather use XML provider and choose some local shared folder for it. (Provider is underlying persistent storage as far as I understand it.)&lt;/p&gt;  &lt;p align="justify"&gt;After installation you should get additional PowerShell console called “Caching Administration Windows PowerShell”.&lt;/p&gt;  &lt;p align="justify"&gt;So you can start your cache using: “&lt;font face="Consolas"&gt;Start-CacheCluster&lt;/font&gt;” command.&lt;/p&gt;  &lt;p align="justify"&gt;Alternatively you can install &lt;a href="http://mdcadmintool.codeplex.com/"&gt;AppFabric Caching Amin Tool&lt;/a&gt; from CodePlex, which would allow you easily do lot of things though the UI. It will show PowerShell output, so you can learn commands from there as well.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-BALD9IGoN8M/T_SPwE_hskI/AAAAAAAA25w/IdMm4xXIV9A/s1600-h/image%25255B27%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-CLyQcW4Bwco/T_SPyJKijLI/AAAAAAAA254/8m7llRDWbZs/image_thumb%25255B17%25255D.png?imgmax=800" width="733" height="476" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Usually you would want to create named cache. I created NamedCacheForBlog, as can be seen above.&lt;/p&gt;  &lt;h4&gt;Simple Application&lt;/h4&gt;  &lt;p&gt;Let’s now create simple application. You would need to add couple of references:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-1CcV-HiyTmM/T_SPzbw2XHI/AAAAAAAA26A/MuQFKqtu4Rw/s1600-h/image%25255B22%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-e2hm8DjG400/T_SP0kfoU6I/AAAAAAAA26I/W5lvYL6wLNE/image_thumb%25255B14%25255D.png?imgmax=800" width="302" height="94" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Add some configuration to your app/web.config&lt;/p&gt;  &lt;pre class="csharpcode"&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;section&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;dataCacheClient&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;allowLocation&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;allowDefinition&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Everywhere&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  
&lt;span class="rem"&gt;&amp;lt;!-- and then somewhere in configuration... --&amp;gt;&lt;/span&gt;
  
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;dataCacheClient&lt;/span&gt; &lt;span class="attr"&gt;requestTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;5000&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;channelOpenTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;10000&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;maxConnectionsToServer&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;20&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;localCache&lt;/span&gt; &lt;span class="attr"&gt;isEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;sync&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;TimeoutBased&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;ttlValue&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;objectCount&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;10000&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;hosts&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="rem"&gt;&amp;lt;!--Local app fabric cache--&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;host&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;localhost&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;cachePort&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;22233&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="rem"&gt;&amp;lt;!-- In real world it could be something like this:&lt;/span&gt;
&lt;span class="rem"&gt;      &amp;lt;host name=&amp;quot;service1&amp;quot; cachePort=&amp;quot;22233&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;      &amp;lt;host name=&amp;quot;service2&amp;quot; cachePort=&amp;quot;22233&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;      &amp;lt;host name=&amp;quot;service3&amp;quot; cachePort=&amp;quot;22233&amp;quot;/&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;      --&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;hosts&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;transportProperties&lt;/span&gt; &lt;span class="attr"&gt;connectionBufferSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;131072&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;maxBufferPoolSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;268435456&amp;quot;&lt;/span&gt;
                       &lt;span class="attr"&gt;maxBufferSize&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;134217728&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;maxOutputDelay&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;channelInitializationTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;60000&amp;quot;&lt;/span&gt;
                       &lt;span class="attr"&gt;receiveTimeout&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;600000&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;dataCacheClient&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Note, that above configuration is not the minimal one, but rather more realistic and sensible. If you are about to use AppFabric Cache in production I definitely recommend you to read &lt;a href="http://msdn.microsoft.com/en-us/library/ee790816%28v=azure.10%29.aspx"&gt;this MSDN page&lt;/a&gt; carefully.&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;Now you need to get DataCache object and use it. Minimalistic, but wrong, way of doing it would be:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; DataCache GetDataCacheMinimalistic()
{
    var factory = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataCacheFactory();
    &lt;span class="kwrd"&gt;return&lt;/span&gt; factory.GetCache(&lt;span class="str"&gt;&amp;quot;NamedCacheForBlog&amp;quot;&lt;/span&gt;);
}&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Above code would read configuration from config and return you DataCache object.&lt;/p&gt;

&lt;p&gt;Using DataCache is extremely easy:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;object&lt;/span&gt; blogPostGoesToCache;
&lt;span class="kwrd"&gt;string&lt;/span&gt; blogPostId;
dataCache.Add(blogPostId, blogPostGoesToCache);
var blogPostFromCache = dataCache.Get(blogPostId);
&lt;span class="kwrd"&gt;object&lt;/span&gt; updatedBlogPost;
dataCache.Put(blogPostId, updatedBlogPost);&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h4&gt;DataCache Wrapper/Utility&lt;/h4&gt;

&lt;p align="justify"&gt;In real world you would probably write some wrapper over DataCache or create some Utility class. There are couple of reasons for this. First of all DataCacheFactory instance creation is very expensive, so it is better to keep one. Another obvious reason is much more flexibility over what you can do in case of failures and in general. And this is very important. Turns out that AppFabricCache is not extremely stable and can be easily impacted. One of the workarounds is to write some “re-try” mechanism, so if your wrapping method fails you retry (immediately or after X ms).&lt;/p&gt;

&lt;p&gt;Here is how I would write initialization code:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; DataCacheFactory _dataCacheFactory;
&lt;span class="kwrd"&gt;private&lt;/span&gt; DataCache _dataCache;
&lt;span class="kwrd"&gt;private&lt;/span&gt; DataCache DataCache
{
    get
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (_dataCache == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            InitDataCache();
        }
        &lt;span class="kwrd"&gt;return&lt;/span&gt; _dataCache;
    }
    set
    {
        _dataCache = &lt;span class="kwrd"&gt;value&lt;/span&gt;;
    }
}

&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; InitDataCache()
{
    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        &lt;span class="rem"&gt;// We try to avoid creating many DataCacheFactory-ies&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (_dataCacheFactory == &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            &lt;span class="rem"&gt;// Disable tracing to avoid informational/verbose messages&lt;/span&gt;
            DataCacheClientLogManager.ChangeLogLevel(TraceLevel.Off);
            &lt;span class="rem"&gt;// Use configuration from the application configuration file&lt;/span&gt;
            _dataCacheFactory = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataCacheFactory();
        }

        DataCache = _dataCacheFactory.GetCache(&lt;span class="str"&gt;&amp;quot;NamedCacheForBlog&amp;quot;&lt;/span&gt;);

        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;
    }
    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (DataCacheException)
    {
        _dataCache = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;DataCache property is not exposed, instead it is used in wrapping methods:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Put(&lt;span class="kwrd"&gt;string&lt;/span&gt; key, &lt;span class="kwrd"&gt;object&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;, TimeSpan ttl)
{
    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        DataCache.Put(key, &lt;span class="kwrd"&gt;value&lt;/span&gt;, ttl);
    }
    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (DataCacheException ex)
    {
        ReTryDataCacheOperation(() =&amp;gt; DataCache.Put(key, &lt;span class="kwrd"&gt;value&lt;/span&gt;, ttl), ex);
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;ReTryDataCacheOperation performs retry logic I mentioned before:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; ReTryDataCacheOperation(Func&amp;lt;&lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; dataCacheOperation, DataCacheException prevException)
{
    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        &lt;span class="rem"&gt;// We add retry, as it may happen,&lt;/span&gt;
        &lt;span class="rem"&gt;// that AppFabric cache is temporary unavailable:&lt;/span&gt;
        &lt;span class="rem"&gt;// See: http://msdn.microsoft.com/en-us/library/ff637716.aspx&lt;/span&gt;
        &lt;span class="rem"&gt;// Maybe adding more checks like: prevException.ErrorCode == DataCacheErrorCode.RetryLater&lt;/span&gt;

        &lt;span class="rem"&gt;// This ensures that once we access prop DataCache, new client will be generated&lt;/span&gt;
        _dataCache = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

        Thread.Sleep(100);
        var result = dataCacheOperation.Invoke();

        &lt;span class="rem"&gt;//We can add some logging here, notifying that retry succeeded&lt;/span&gt;
        &lt;span class="kwrd"&gt;return&lt;/span&gt; result;
    }
    &lt;span class="kwrd"&gt;catch&lt;/span&gt; (DataCacheException)
    {
        _dataCache = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;You can go further and improve retry logic to allow for many retries and different intervals between retries and then put all that stuff into configuration.&lt;/p&gt;

&lt;h4&gt;RetryLater&lt;/h4&gt;

&lt;p align="justify"&gt;So, why the hell all this retry logic is needed?&lt;/p&gt;

&lt;p align="justify"&gt;Well, when you open MSDN page for &lt;a href="http://msdn.microsoft.com/en-us/library/ff637716.aspx"&gt;AppFabric Common Exceptions&lt;/a&gt; be sure RetryLater is the most common one. To know what exactly happened you need to verify ErrorCode.&lt;/p&gt;

&lt;p align="justify"&gt;So far I’ve see this sub-errors of the RetryLater:&lt;/p&gt;

&lt;p align="justify"&gt;&lt;strong&gt;There was a contention on the store.&lt;/strong&gt; – This one is quite frequent one. Could happen when someone is playing some concurrent mess with cache. Problem is that any client can affect the whole cluster.&lt;/p&gt;

&lt;p align="justify"&gt;&lt;strong&gt;The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown.&lt;/strong&gt; – This usually has nothing to do with object size. Even if configuration is correct and you save small objects you can still get this error. Retry mechanism is good for this one.&lt;/p&gt;

&lt;p align="justify"&gt;&lt;strong&gt;One or more specified cache servers are unavailable, which could be caused by busy network or servers.&lt;/strong&gt; – Have no idea how frequent this one could be, but it can happen.&lt;/p&gt;

&lt;p align="justify"&gt;&lt;strong&gt;No specific SubStatus.&lt;/strong&gt; – Amazing one!&lt;/p&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;AppFabricCache is very nice distributed cache solution from Microsoft. It has a lot of features. Of course not described here, as you can read it elsewhere, say &lt;a href="http://download.microsoft.com/download/7/F/8/7F8BD8A0-EB05-4DB5-A5A4-DD1D3C909A0A/Introducing_Windows_Server_AppFabric.pdf"&gt;here&lt;/a&gt;. But to be able to go live with it you should be ready for AppFabricCache not being extremely stable &amp;amp; reliable, so you better put some retry mechanisms in place.&lt;/p&gt;

&lt;p align="justify"&gt;To be honest if I was one to make decision if to use this dcache, I would go for another one. But who knows, maybe other are not much better… I’ve never tried other distributed caches.&lt;/p&gt;

&lt;h4&gt;Links&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://download.microsoft.com/download/7/F/8/7F8BD8A0-EB05-4DB5-A5A4-DD1D3C909A0A/Introducing_Windows_Server_AppFabric.pdf"&gt;Introduction white paper (pdf direct link)&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.slideshare.net/markginnebaugh/microsoft-windows-server-appfabric"&gt;Slides from MIX10&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-US/windowsserver/ee695849.aspx"&gt;AppFabric on MSDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you, and hope this is of some help.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/kmsnAbCp1yI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3764372060983601872/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/07/application-fabric-cache-easy-but-solid.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3764372060983601872?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3764372060983601872?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/kmsnAbCp1yI/application-fabric-cache-easy-but-solid.html" title="Application Fabric Cache – an easy, but solid start" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-CLyQcW4Bwco/T_SPyJKijLI/AAAAAAAA254/8m7llRDWbZs/s72-c/image_thumb%25255B17%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/07/application-fabric-cache-easy-but-solid.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8EQnc6cCp7ImA9WhVUFUU.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-3109284139787245950</id><published>2012-05-21T00:14:00.001+02:00</published><updated>2012-05-21T09:53:23.918+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-21T09:53:23.918+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="OData" /><title>OData service with WCF and data in memory</title><content type="html">&lt;p align="justify"&gt;In &lt;a href="http://andriybuday.blogspot.com/2012/05/odata.html"&gt;previous blog post&lt;/a&gt; I briefly touched OData protocol by showing quick usage of OData feed and then implemented ever simple WCF data service with using Entity Framework.&lt;/p&gt;  &lt;p align="justify"&gt;Now, let’s imagine that we have some data in memory and would like to expose it. Is it hard or easy?&lt;/p&gt;  &lt;h4 align="justify"&gt;Querying in memory data&lt;/h4&gt;  &lt;p align="justify"&gt;If you can represent your data as &lt;em&gt;IQueryable&lt;/em&gt; then, for most cases, you are fine. There is an extension method to &lt;em&gt;IEnumerable&lt;/em&gt; called &lt;em&gt;AsQueryable&lt;/em&gt;, so as long as your data can be accessed as &lt;em&gt;IEnumerable&lt;/em&gt; you can make it &lt;em&gt;IQueryable&lt;/em&gt;.&lt;/p&gt;  &lt;h5 align="justify"&gt;Sample data kept in memory&lt;/h5&gt;  &lt;p align="justify"&gt;Now, let’s create some sample data:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; IList&amp;lt;Sport&amp;gt; _sports = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Sport&amp;gt;();
&lt;span class="kwrd"&gt;private&lt;/span&gt; IList&amp;lt;League&amp;gt; _leagues = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;League&amp;gt;();

&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Populate()
{
    _sports = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Sport&amp;gt;();
    _leagues = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;League&amp;gt;();

    _sports.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sport() { Id = 1, Name = &lt;span class="str"&gt;&amp;quot;Swimming&amp;quot;&lt;/span&gt;});
    _sports.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sport() { Id = 2, Name = &lt;span class="str"&gt;&amp;quot;Skiing&amp;quot;&lt;/span&gt;});

    var sport = &lt;span class="kwrd"&gt;new&lt;/span&gt; Sport() { Id = 3, Name = &lt;span class="str"&gt;&amp;quot;Football&amp;quot;&lt;/span&gt;};
    var league = &lt;span class="kwrd"&gt;new&lt;/span&gt; League() { Id = 1, Name = &lt;span class="str"&gt;&amp;quot;EURO2012&amp;quot;&lt;/span&gt;, Region = &lt;span class="str"&gt;&amp;quot;Poland&amp;amp;Ukraine&amp;quot;&lt;/span&gt; };
    sport.AddLeague(league);
    var league1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; League() { Id = 2, Name = &lt;span class="str"&gt;&amp;quot;UK Premier League&amp;quot;&lt;/span&gt;, Region = &lt;span class="str"&gt;&amp;quot;UK&amp;quot;&lt;/span&gt; };
    sport.AddLeague(league1);
    _sports.Add(sport);

    var league2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; League() { Id = 3, Name = &lt;span class="str"&gt;&amp;quot;Austria Premier League&amp;quot;&lt;/span&gt;, Region = &lt;span class="str"&gt;&amp;quot;Austria&amp;quot;&lt;/span&gt; };
    _leagues.Add(league);
    _leagues.Add(league1);
    _leagues.Add(league2);

    _sports.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sport() { Id = 4, Name = &lt;span class="str"&gt;&amp;quot;Tennis&amp;quot;&lt;/span&gt;});
    _sports.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Sport() { Id = 5, Name = &lt;span class="str"&gt;&amp;quot;Volleyball&amp;quot;&lt;/span&gt;});
}&lt;/pre&gt;

&lt;p align="justify"&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;Absolutely nothing smart or difficult there, but at least to give you an idea about dataset we have.&lt;/p&gt;

&lt;h5 align="justify"&gt;Few things to make it happen&lt;/h5&gt;

&lt;p align="justify"&gt;To expose sports and leagues we would need to add public properties to our data service implementation like below:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;Sport&amp;gt; Sports { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _sports.AsQueryable(); } }
&lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;League&amp;gt; Leagues { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _leagues.AsQueryable(); } }&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Another important thing about exposing data is that you have to indicate key for your entities with &lt;em&gt;DataServiceKey&lt;/em&gt; attribute.&lt;/p&gt;

&lt;p&gt;To make our service bit more realistic I’m going to add caching as well. &lt;/p&gt;

&lt;h5&gt;Complete source code of service&lt;/h5&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SportsWcfDataService : DataService&amp;lt;SportsData&amp;gt;
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InitializeService(DataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, EntitySetRights.AllRead);
        config.SetEntitySetAccessRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, EntitySetRights.AllRead);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        &lt;span class="rem"&gt;// To know if there are issues with your data model&lt;/span&gt;
        config.UseVerboseErrors = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; HandleException(HandleExceptionArgs args)
    {
        &lt;span class="rem"&gt;// Put breakpoint here to see possible problems while accessing data&lt;/span&gt;
        &lt;span class="kwrd"&gt;base&lt;/span&gt;.HandleException(args);
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; SportsData CreateDataSource()
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; SportsData.Instance;
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnStartProcessingRequest(ProcessRequestArgs args)
    {
        &lt;span class="kwrd"&gt;base&lt;/span&gt;.OnStartProcessingRequest(args);
        var cache = HttpContext.Current.Response.Cache;
        cache.SetCacheability(HttpCacheability.ServerAndPrivate);
        cache.SetExpires(HttpContext.Current.Timestamp.AddSeconds(120));
        cache.VaryByHeaders[&lt;span class="str"&gt;&amp;quot;Accept&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
        cache.VaryByHeaders[&lt;span class="str"&gt;&amp;quot;Accept-Charset&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
        cache.VaryByHeaders[&lt;span class="str"&gt;&amp;quot;Accept-Encoding&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
        cache.VaryByParams[&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;] = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
    }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SportsData
{
    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; SportsData _instance = &lt;span class="kwrd"&gt;new&lt;/span&gt; SportsData();

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; SportsData Instance
    {
        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _instance; }
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; SportsData()
    {
        Populate();
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Populate()
    {
        &lt;span class="rem"&gt;// Population of data&lt;/span&gt;
        &lt;span class="rem"&gt;// Above in this post &lt;/span&gt;
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; IList&amp;lt;Sport&amp;gt; _sports = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Sport&amp;gt;();
    &lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;Sport&amp;gt; Sports { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _sports.AsQueryable(); } }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; IList&amp;lt;League&amp;gt; _leagues = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;League&amp;gt;();
    &lt;span class="kwrd"&gt;public&lt;/span&gt; IQueryable&amp;lt;League&amp;gt; Leagues { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _leagues.AsQueryable(); } }
}

[DataServiceKey(&lt;span class="str"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Sport
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AddLeague(League league)
    {
        _leagues.Add(league);
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; IList&amp;lt;League&amp;gt; _leagues = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;League&amp;gt;();
    &lt;span class="kwrd"&gt;public&lt;/span&gt; IEnumerable&amp;lt;League&amp;gt; Leagues { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; _leagues; } }
}

[DataServiceKey(&lt;span class="str"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; League
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Region { get; set; }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h5 align="justify"&gt;Some results of our work&lt;/h5&gt;

&lt;p align="justify"&gt;With this URL &lt;a title="http://localhost:49936/SportsService.svc/" href="http://localhost:49936/SportsService.svc/"&gt;http://localhost:49936/SportsService.svc/&lt;/a&gt; service can be seen:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&amp;lt;service xml:base=&lt;span class="str"&gt;&amp;quot;http://localhost:49936/SportsService.svc/&amp;quot;&lt;/span&gt;&amp;gt;
 &amp;lt;workspace&amp;gt;
  &amp;lt;atom:title&amp;gt;Default&amp;lt;/atom:title&amp;gt;
  &amp;lt;collection href=&lt;span class="str"&gt;&amp;quot;Sports&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;atom:title&amp;gt;Sports&amp;lt;/atom:title&amp;gt;&amp;lt;/collection&amp;gt;
  &amp;lt;collection href=&lt;span class="str"&gt;&amp;quot;Leagues&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;atom:title&amp;gt;Leagues&amp;lt;/atom:title&amp;gt;&amp;lt;/collection&amp;gt;
 &amp;lt;/workspace&amp;gt;
&amp;lt;/service&amp;gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;Now, you can access data via URL or by writing C# Linq queries if connected with client app or LinqPad. Following request:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:49936/SportsService.svc/Leagues()?$filter=Name eq 'EURO2012'&amp;amp;$select=Region"&gt;http://localhost:49936/SportsService.svc/Leagues()?$filter=Name eq 'EURO2012'&amp;amp;$select=Region&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would produce result containing this:&lt;/p&gt;

&lt;pre&gt;&amp;lt;d:Region&amp;gt;Poland&amp;amp;amp;Ukraine&amp;lt;/d:Region&amp;gt;&lt;/pre&gt;

&lt;h4 align="justify"&gt;What if you need to edit data?&lt;/h4&gt;

&lt;p align="justify"&gt;If you need your data to be updatable, your &lt;em&gt;SportsData&lt;/em&gt; would need to implement &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.services.iupdatable.aspx"&gt;System.Data.Services.IUpdatable&lt;/a&gt; interface.&lt;/p&gt;

&lt;h4 align="justify"&gt;What if your datasource is not just few collections in memory?&lt;/h4&gt;

&lt;p align="justify"&gt;What if you have very special data source, or you cannot simply keep your data in memory like collections of some data? This could be tricky or very tricky, depending on your data source, of course. But anyway you would need to implement interface &lt;em&gt;IQueryable&lt;/em&gt; by hand if not provided by your data source.&lt;/p&gt;

&lt;p align="justify"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb546158.aspx"&gt;Here&lt;/a&gt; is step-by-step walkthrough on msdn. Only by size of article you could imagine it is not trivial task to do. But if you managed to do it you can be proud, because you can implement your own Linq provider. (Do you remember NHibernate introducing support of Linq? It was big feature for product, roughly all they did was implementation of &lt;em&gt;IQueryably&lt;/em&gt; by their &lt;em&gt;NhQueryable&lt;/em&gt;.)&lt;/p&gt;

&lt;h4 align="justify"&gt;Why do I learn OData?&lt;/h4&gt;

&lt;p align="justify"&gt;First of all I have to investigate if my team can use it. (Depending on outcome you might see more posts on this topic from me.) And another reason is that it is very exciting topic, about which I knew so little.&lt;/p&gt;

&lt;p align="justify"&gt;Very disappointing to admit that I start to really understand things when I touch them for reason and that reading dozen of blog posts on topic is useless unless I do something meaningful related to matters in those posts.&lt;/p&gt;

&lt;p align="justify"&gt;So, my Dear Reader, if you are reading this post and have read &lt;a href="http://andriybuday.blogspot.com/2012/05/odata.html"&gt;my previous post&lt;/a&gt;, but never tried OData I would be really pleased if you invest 10-30 or more minutes of your time to play with OData.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/fGqlgI8M1bA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/3109284139787245950/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/05/odata-service-with-wcf-and-data-in.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3109284139787245950?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/3109284139787245950?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/fGqlgI8M1bA/odata-service-with-wcf-and-data-in.html" title="OData service with WCF and data in memory" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/05/odata-service-with-wcf-and-data-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ENR3c7fip7ImA9WhVUFU4.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-4725242792733789494</id><published>2012-05-20T19:19:00.001+02:00</published><updated>2012-05-20T19:41:36.906+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-20T19:41:36.906+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="OData" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>ODATA</title><content type="html">&lt;p&gt;Let’s talk about OData.&lt;/p&gt;  &lt;h4&gt;At first glance&lt;/h4&gt;  &lt;p align="justify"&gt;I would propose to start our OData journey with the best thing about it. Which is openness of data, easy of accessing and working with it. Client applications no longer need to depend on some specific service methods or formats if there is OData feed available. Consuming OData is simple and enjoyable.&lt;/p&gt;  &lt;p align="justify"&gt;For example, I want to know how many users with name ‘Andriy’ are there on StackOverflow with reputation higher than 500. No one at StackOverflow would develop special method in API which would allow me to request exactly this data.&lt;/p&gt;  &lt;p align="justify"&gt;But as StackOverflow exposes OData feed we can connect to it with LinqPad (&lt;a href="http://www.linqpad.net/"&gt;get it here&lt;/a&gt;) and simply write normal C# linq query, like this one:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;Users.Where(x=&amp;gt;x.DisplayName.Contains(&lt;span class="str"&gt;&amp;quot;Andriy&amp;quot;&lt;/span&gt;) &amp;amp;&amp;amp; x.Reputation &amp;gt; 500).OrderBy(x=&amp;gt;x.Reputation)&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-lCIuB54JwF8/T7knnvWu46I/AAAAAAAAvQA/0MxujQNe40U/s1600-h/image%25255B11%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-PIueWdsLAbQ/T7knpim4wDI/AAAAAAAAvQI/wd985lYuBCY/image_thumb%25255B5%25255D.png?imgmax=800" width="730" height="376" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;You can see same data if you use URL below. This URL was built by LinqPad to request data:&lt;/p&gt;

&lt;p align="justify"&gt;&lt;a href="http://data.stackexchange.com/stackoverflow/atom/Users()?$filter=substringof('Andriy',DisplayName) and (Reputation gt 500)&amp;amp;$orderby=Reputation"&gt;http://data.stackexchange.com/stackoverflow/atom/Users()?$filter=substringof('Andriy',DisplayName) and (Reputation gt 500)&amp;amp;$orderby=Reputation&lt;/a&gt; 

  &lt;br /&gt;&lt;/p&gt;

&lt;p align="justify"&gt;(View page source if you don’t like how your browser rendered that feed).&lt;/p&gt;

&lt;p align="justify"&gt;So, no magic. You just build special URL and get your data of interest in preferred format. You can use &lt;a href="http://www.odata.org/libraries"&gt;wide set of libraries both for client and server&lt;/a&gt; to implement and use OData.&lt;/p&gt;

&lt;p align="justify"&gt;Whenever you see this icon &lt;a href="http://lh3.ggpht.com/-nk0fG9-x1D8/T7knqgEzQvI/AAAAAAAAvQQ/X5u5NXldzBE/s1600-h/Datafeeds16%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="Datafeeds16" border="0" alt="Datafeeds16" src="http://lh4.ggpht.com/-5tkemuhp9Lc/T7knrtrobfI/AAAAAAAAvQY/5p47VUvjQxI/Datafeeds16_thumb%25255B1%25255D.png?imgmax=800" width="16" height="16" /&gt;&lt;/a&gt; it is good indication that there is OData feed available. There are many applications/web sites that already utilize this protocol. Do you use Nuget? It works through OData. Know ebay? They expose its catalog via OData. Need more examples? Go to &lt;a href="http://www.odata.org/ecosystem"&gt;ecosystem page of OData&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;So what is OData?&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p align="justify"&gt;&lt;font color="#400000"&gt;The &lt;strong&gt;Open Data Protocol (OData)&lt;/strong&gt; is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as &lt;/font&gt;&lt;a href="http://www.w3.org/Protocols/"&gt;&lt;font color="#400000"&gt;HTTP&lt;/font&gt;&lt;/a&gt;&lt;font color="#400000"&gt;, &lt;/font&gt;&lt;a href="http://www.ietf.org/rfc/rfc4287.txt"&gt;&lt;font color="#400000"&gt;Atom Publishing Protocol&lt;/font&gt;&lt;/a&gt;&lt;font color="#400000"&gt; (AtomPub) and &lt;/font&gt;&lt;a href="http://json.org/"&gt;&lt;font color="#400000"&gt;JSON&lt;/font&gt;&lt;/a&gt;&lt;font color="#400000"&gt; to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years.&amp;#160; OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p align="right"&gt;…from &lt;a title="http://www.odata.org/" href="http://www.odata.org/"&gt;http://www.odata.org/&lt;/a&gt;&lt;/p&gt;

&lt;p align="left"&gt;Continue your reading about OData on its documentation page &lt;a href="http://www.odata.org/media/30002/OData.html#overview"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p align="left"&gt;If you have time, I would recommend to watch this “OData: There’s Feed for That” MIX10 &lt;a href="http://channel9.msdn.com/events/MIX/MIX10/FT12#"&gt;video&lt;/a&gt;.&lt;/p&gt;
&lt;!--&lt;iframe style="width: 725px; height: 467px" src="http://channel9.msdn.com/Events/MIX/MIX10/FT12/player?w=725&amp;amp;h=467" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;video controls poster="http://channel9.msdn.com/events/MIX/MIX10/FT12"&gt;&lt;source type="video/mp4" src="http://ecn.channel9.msdn.com/o9/mix/10/mp4/FT12.mp4" /&gt;&lt;/video&gt;--&gt;

&lt;h4&gt;Let’s build our first OData service&lt;/h4&gt;

&lt;p align="justify"&gt;As OData was initially introduced by Microsoft no wonder it is extremely easy to put it in place when you are on MS stack of technologies. If you are using EF there is almost nothing you have to do to make it happen.&lt;/p&gt;

&lt;p&gt;Add “WCF Data Service” to your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-w_X1x5O8J2s/T7kntBaFo8I/AAAAAAAAvQ0/ayw5IteN-gs/s1600-h/image%25255B17%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Hzlwbb9ZLJA/T7knutDUuTI/AAAAAAAAvQ4/ri2NCVePBog/image_thumb%25255B9%25255D.png?imgmax=800" width="720" height="409" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will get following code:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WcfDataService1 : DataService&amp;lt; &lt;span class="rem"&gt;/* TODO: put your data source class name here */&lt;/span&gt; &amp;gt;
{
    &lt;span class="rem"&gt;// This method is called only once to initialize service-wide policies.&lt;/span&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InitializeService(DataServiceConfiguration config)
    {
        &lt;span class="rem"&gt;// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.&lt;/span&gt;
        &lt;span class="rem"&gt;// Examples:&lt;/span&gt;
        &lt;span class="rem"&gt;// config.SetEntitySetAccessRule(&amp;quot;MyEntityset&amp;quot;, EntitySetRights.AllRead);&lt;/span&gt;
        &lt;span class="rem"&gt;// config.SetServiceOperationAccessRule(&amp;quot;MyServiceOperation&amp;quot;, ServiceOperationRights.All);&lt;/span&gt;
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    }
}&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Assuming that you have your data model generated on Northwind db. All you would need is something like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; WcfDataService1 : DataService&amp;lt;NorthwindContext&amp;gt;
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; InitializeService(DataServiceConfiguration config)
    {
        config.SetEntitySetAccessRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, EntitySetRights.All);
        config.SetServiceOperationAccessRule(&lt;span class="str"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;, ServiceOperationRights.All);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; NorthwindContext CreateDataSource()
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; NorthwindContext(ConfigurationManager.ConnectionStrings[&lt;span class="str"&gt;&amp;quot;NorthwindContext.EF.MsSql&amp;quot;&lt;/span&gt;].ConnectionString);
    }
}&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p align="justify"&gt;And now clients can do whatever they like with your data. Of course, you can restrict them as you wish. OData is not about putting your database into web, you can control what you expose and to which extent. Also you can play with your service by adding caching, intercepting queries, changing behaviors and much-much more.&lt;/p&gt;

&lt;p align="justify"&gt;&lt;/p&gt;

&lt;p align="justify"&gt;In next post I will show how we can build OData service for custom data you keep in memory.&lt;/p&gt;

&lt;p align="justify"&gt;In meantime you can checkout another video from &lt;a href="http://www.ndc2011.no/"&gt;NDC2011&lt;/a&gt; by &lt;a href="http://bloggingabout.net/blogs/vagif/default.aspx"&gt;Vagif Abilov&lt;/a&gt;. Video is called “Practical OData with and without Entity Framework”. Follow this link to &lt;a href="http://ndc2011.macsimum.no/mp4/Day1%20Wednesday/Track6%201740-1840.mp4"&gt;direct mp4 video file&lt;/a&gt;.&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/w5nlrHqGUug" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/4725242792733789494/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/05/odata.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4725242792733789494?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/4725242792733789494?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/w5nlrHqGUug/odata.html" title="ODATA" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-PIueWdsLAbQ/T7knpim4wDI/AAAAAAAAvQI/wd985lYuBCY/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/05/odata.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08ESX47fyp7ImA9WhVVFE4.&quot;"><id>tag:blogger.com,1999:blog-5787990191349742069.post-2446034750402946320</id><published>2012-05-08T00:58:00.001+02:00</published><updated>2012-05-08T01:03:28.007+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-08T01:03:28.007+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><title>Book Review: “The Mythical Man-Month: Essays on Software Engineering”</title><content type="html">&lt;p align="justify"&gt;&lt;a href="http://www.amazon.com/The-Mythical-Man-Month-Engineering-Anniversary/dp/0201835959"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 16px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://lh4.ggpht.com/-8P736zwhmT0/T6hTj0t4NCI/AAAAAAAAsLA/vTTsJMuCQEE/image%25255B9%25255D.png?imgmax=800" width="161" height="244" /&gt;&lt;/a&gt;For good reasons many people recommend book “&lt;a href="http://www.amazon.com/The-Mythical-Man-Month-Engineering-Anniversary/dp/0201835959"&gt;The Mythical Man-Month: Essays on Software Engineering&lt;/a&gt;” when it comes to management of software projects. Reason is that it is one of the classical books on this matter. Recently I was also recommended this book. After reading it I realized that I grasped no new ideas or things that I did not know before. It is not because book is not good enough, but rather because it is very old and many other publications, I’ve read, have provided me with lots of up-to-date information. Not to mention, that many of these publications have been influenced by exactly this book.&lt;/p&gt;  &lt;p align="justify"&gt;Same was true for other person flying in same plane with Brooks, author of book:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;&lt;em&gt;The plane droned through the night toward LaGuardia. Clouds and darkness veiled all interesting sights. The document I was studying was pedestrian. I was not, however, bored. The stranger sitting next to me was reading The Mythical Man-Month, and I was waiting to see if by word or sign he would react. Finally as we taxied toward the gate, I could wait no longer:       &lt;br /&gt;“How is that book? Do you recommend it?”        &lt;br /&gt;“Hmph! Nothing in it I didn’t know already.” I decided not to introduce myself.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;On the other hand, I got some insights into how software development looked like back in 70th.&lt;/p&gt;  &lt;p align="justify"&gt;Yes, I spelled it right. Book survived many years, mainly “&lt;em&gt;because building things, including software, has always been as much about people as it has been about materials or technology - and people don't change much in only &lt;strike&gt;25&lt;/strike&gt;&amp;#160;&lt;/em&gt;[35]&lt;em&gt; years.&lt;/em&gt;”&lt;/p&gt;  &lt;p align="justify"&gt;I think that the strongest generalization from the book is this one:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;“&lt;em&gt;Assigning more programmers to a project running behind schedule, may make it even more late.&lt;/em&gt;”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;To the topic, but not that much related. In book there is mentioning of Conway’s Law, which could sound like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;&lt;em&gt;“Organizations which design systems are constrained to produce systems which are copies of the communication structures of these organizations.”&lt;/em&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;The other day I came across nice article called “&lt;a href="http://elegantcode.com/2012/04/07/seeing-the-team-in-the-code/"&gt;Seeing the team in the code&lt;/a&gt;”. As per me lack of opened and frequent technical communication between developers, like code reviews, could make source code not really what team wants it to be. On the other hand, it could help make code less coupled, if everything is made by contract. Conway's law sounds like fun, but each joke is based on truth behind. There is even Microsoft research paper on this: &lt;a href="http://research.microsoft.com/pubs/70535/tr-2008-11.pdf"&gt;http://research.microsoft.com/pubs/70535/tr-2008-11.pdf&lt;/a&gt;. (Not easy to read or to follow.)&lt;/p&gt;    &lt;p align="justify"&gt;I would recommend this book in two cases: you have little or no clue of how development and management of big software projects is done OR if you want to just make sure you are familiar with this work to have more coherent view on the topic. In case you are average developer, who frequently reads recent books or posts on management/leadership/etc in software it is very likely that you will not enjoy this book. I also did not enjoy it very much, I probably fall into case number 2.&lt;/p&gt;  &lt;p align="justify"&gt;Thanks for reading…&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/DevelopersRoadmapToSuccess/~4/-LzL8ERh5u8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.andriybuday.com/feeds/2446034750402946320/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.andriybuday.com/2012/05/book-review-mythical-man-month-essays.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/2446034750402946320?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5787990191349742069/posts/default/2446034750402946320?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/DevelopersRoadmapToSuccess/~3/-LzL8ERh5u8/book-review-mythical-man-month-essays.html" title="Book Review: “The Mythical Man-Month: Essays on Software Engineering”" /><author><name>Andriy Buday</name><uri>http://www.blogger.com/profile/09181254564747384052</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_kD34xgIwKhc/TLId2O4SkHI/AAAAAAAAB3E/iZyeeh4CXjc/S220/AndriyBuday_MiddleOfficial_984_PlusLogo_Face_Star.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-8P736zwhmT0/T6hTj0t4NCI/AAAAAAAAsLA/vTTsJMuCQEE/s72-c/image%25255B9%25255D.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.andriybuday.com/2012/05/book-review-mythical-man-month-essays.html</feedburner:origLink></entry></feed>
