<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Software. Efficiency. Scalability.</title>
	<atom:link href="http://opletayev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://opletayev.com</link>
	<description>Entia non sunt multiplicanda praeter necessitatem</description>
	<lastBuildDate>Mon, 05 Dec 2011 20:50:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='opletayev.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Software. Efficiency. Scalability.</title>
		<link>http://opletayev.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://opletayev.com/osd.xml" title="Software. Efficiency. Scalability." />
	<atom:link rel='hub' href='http://opletayev.com/?pushpress=hub'/>
		<item>
		<title>Simple Made Easy</title>
		<link>http://opletayev.com/2011/10/31/simple-made-easy/</link>
		<comments>http://opletayev.com/2011/10/31/simple-made-easy/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 17:58:33 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=550</guid>
		<description><![CDATA[An outstanding presentation on what &#8220;easy&#8221; means and what &#8220;complex&#8221; means by Rich Hickley, the author of Clojure. If you are somehow related to the software development it will be absolutely worth your time to watch it. http://www.infoq.com/presentations/Simple-Made-Easy Tagged: development, theory<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=550&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>An outstanding presentation on what &#8220;easy&#8221; means and what &#8220;complex&#8221; means by Rich Hickley, the author of Clojure.</p>
<p>If you are somehow related to the software development it will be absolutely worth your time to watch it.</p>
<p><a href="http://www.infoq.com/presentations/Simple-Made-Easy">http://www.infoq.com/presentations/Simple-Made-Easy</a></p>
<br /> Tagged: <a href='http://opletayev.com/tag/development/'>development</a>, <a href='http://opletayev.com/tag/theory/'>theory</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/550/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/550/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/550/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=550&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2011/10/31/simple-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>On software patents</title>
		<link>http://opletayev.com/2011/06/01/on-software-patents/</link>
		<comments>http://opletayev.com/2011/06/01/on-software-patents/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 15:20:49 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[legal]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[lodsys]]></category>
		<category><![CDATA[patent]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=528</guid>
		<description><![CDATA[Lodsys story is generating a lot of buzz on the net. People argue that the whole software patent system is screwed up. Personally, I tend to agree that copyright is enough in software as, generally speaking, the implementation of the idea is much more complex than the idea. Think app store &#8212; it&#8217;s one thing to come up with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=528&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lodsys story is <a href="http://www.avc.com/a_vc/2011/06/enough-is-enough.html">generating</a> a <a href="http://www.macrumors.com/2011/05/31/lodsys-responds-to-apple-files-lawsuits-against-app-developers/">lot</a> of <a href="http://fosspatents.blogspot.com/2011/05/lodsys-sues-7-app-developers-in-eastern.html">buzz</a> on the net.</p>
<p>People argue that the whole software patent system is screwed up. Personally, I tend to agree that copyright is enough in software as, generally speaking, the implementation of the idea is much more complex than the idea. Think app store &#8212; it&#8217;s one thing to come up with an idea of it and quite another thing to create a viable platform, create libraries, attract developers, go through the approval process, etc.</p>
<p>The other part of the problem is that software patents are supposed to protect a small inventor against bigger players that can copy his or her work. Well, that doesn&#8217;t work too well because enforcing a perfectly valid patent against a larger corporation can cost millions of dollars in litigation costs. It&#8217;s quite cost prohibitive and there are just not so many cases of this. Also, most of the big players on the market have huge patent portfolios and can always counter-sue either increasing the cost of litigation or making it a wash. There are just not so many of the successful examples of where a small guy got protected by the patent system.</p>
<p>Having said that, I don&#8217;t believe for a second the government will have the audacity to abolish the software patent system. Even suspension of granting new software patents while the system is kept intact would be too big of a pull to swallow. However, there are certainly ways the government could deal with the issue.</p>
<p>A big part of the problem is granting crazy patents such as <a href="http://fosspatents.blogspot.com/2011/05/worse-than-lodsys-macrosolves-sues.html">MacroSolve&#8217;s</a> one. USPTO is swarmed with patent application and has a multi year backlog. It doesn&#8217;t have enough of the qualified personal to evaluate all the patents properly and compare them against the prior art. In this case, the solution could be crowd-sourcing. There are a lot of interested parties out there that would be happy to help USPTO with the research and try to invalidate rogue applications before they become full fledged patents.</p>
<p>There are plenty of concerned organizations and people and this process can be designed to make a financial sense for large companies and concerned groups to voluntarily participate in the process and provide USPTO with their research on prior art and validity of patents.</p>
<p>Another thing the government could do is to prohibit several areas of software from being patentable. User interfaces, file formats, protocols, things like that. Explicitly prohibit patenting different data types: if you communicate a piece of data over the network and store it on the server it doesn&#8217;t matter if it&#8217;s a geo-location or a credit card charge. Has anyone send information from a phone to the server and stored it there? Then it&#8217;s a prior art.</p>
<p>Overall, an open process with some adjustments to what&#8217;s patentable and what&#8217;s not could result in much better patent system. I have a feeling that guys like Lodsys will eventually generate enough will in the community to break the status quo and push for a reform.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/apple/'>Apple</a>, <a href='http://opletayev.com/tag/google/'>google</a>, <a href='http://opletayev.com/tag/lodsys/'>lodsys</a>, <a href='http://opletayev.com/tag/patent/'>patent</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/528/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=528&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2011/06/01/on-software-patents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Concurrency in new and existing programming languages</title>
		<link>http://opletayev.com/2010/12/07/concurrency-in-new-and-existing-programming-languages/</link>
		<comments>http://opletayev.com/2010/12/07/concurrency-in-new-and-existing-programming-languages/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 17:56:53 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[async]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[scalability]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=477</guid>
		<description><![CDATA[New languages New languages are popping up almost every other day. If you consider languages being under major development (including core syntax and library changes) there is Go, Rust, Scala, F#, Gosu, just to name a few. In the wake of the immense popularity of dynamic languages such as Ruby, Groovy and Python, these new languages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=477&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>New languages</h2>
<p>New languages are popping up almost every other day. If you consider languages being under major development (including core syntax and library changes) there is <a href="http://golang.org/">Go</a>, <a href="https://github.com/graydon/rust/wiki/Language-FAQ">Rust</a>, <a href="http://www.scala-lang.org/">Scala</a>, <a href="http://msdn.microsoft.com/en-us/fsharp/default.aspx">F#</a>, <a href="http://gosu-lang.org/">Gosu</a>, just to name a few. In the wake of the immense popularity of dynamic languages such as Ruby, Groovy and Python, these new languages are statically typed.  It is quite obvious that there are some issues that current languages don&#8217;t address. These issues are pressing enough for people to undertake such an expensive exercise as creating a new language.</p>
<p>To understand things better I look at 5 major categories: memory management, libraries, readability, scalability, and deployment.</p>
<ul>
<li><strong>Memory management</strong> has arguably brought about the biggest productivity gain in the last 2 decades. Major imperative languages, such as Java and C# gained Garbage Collector (GC) and <a href="http://opletayev.com/2010/01/11/understanding-gc-allocating-memory-part-ii/">made developers stop about allocating memory</a>.</li>
<li><strong>Libraries</strong> are important for writing meaningful applications. Good libraries make a world of difference. For instance, WinForms is head and shoulders better than Swing. It has nothing to do with the language per say (even though C# support for events makes a huge difference for GUI libraries), but it certainly reflects on the language. One of the major problem for the new languages is lack of libraries.</li>
<li><strong>Readability</strong> of the code is paramount for a language. If developers have hard time reading code written in the language, they will be much less likely to use it. On top of that, languages that are hard to read make support and maintenance more expensive. If you have ever spent hours trying to figure out what a piece of code does, you understand what I mean.</li>
<li><strong>Scalability </strong>implies that software written in your language should be able to scale on modern hardware. For instance, a language with a single threaded model can&#8217;t take advantage of multi-core processors. A language without support for concurrency will make writing scalable apps much harder.</li>
<li><strong>Deployment</strong> is important because it&#8217;s when the software actually gets to work. There is always cost associated with deployment. Choosing Ruby will likely require more servers. Choosing C# or F# will require Windows licenses when you deploy. C# will enable you to deploy on <a href="http://www.microsoft.com/windowsazure/" target="_blank">Windows Azure</a> , while Ruby will give you an option of <a href="http://heroku.com/" target="_blank">Heroku</a>.</li>
</ul>
<p>Applying these 5 categories to the mainstream languages makes it easier to see why there is a need for new languages.</p>
<h2>C</h2>
<ul>
<li>Unmanaged</li>
<li>Good basic libraries</li>
<li>Poor readability</li>
<li>Fast code, no built-in concurrency support</li>
<li>Runs everywhere</li>
</ul>
<h2>Java</h2>
<ul>
<li>Managed (GC)</li>
<li>Great deal of libraries and frameworks</li>
<li>Poor readability, verbose</li>
<li>lack of proper generics, closures, lambda expressions, events, etc.</li>
<li>VM + JIT, no built-in concurrency support</li>
<li>Runs everywhere</li>
</ul>
<h2>C#</h2>
<ul>
<li>Managed (GC)</li>
<li>Has limited number of libraries and frameworks, Microsoft dominated</li>
<li>Great readability, has support of most modern features (lambda, closures, generics, etc) as well as LINQ</li>
<li>VM + JIT, no built-in concurrency support</li>
<li>Only runs on Windows, license costs might be prohibitive for larger projects. Cloud deployment available with Azure.</li>
</ul>
<h2>Ruby</h2>
<ul>
<li>Managed (GC)</li>
<li>Has a good deal of libraries and frameworks</li>
<li>Great readability, expressive and concise syntax</li>
<li>VM, slow dynamic code,  no built-in concurrency support</li>
<li>Cheap deployment but known to cause problems in larger deployments (e.g. Twitter)</li>
</ul>
<h2>Python</h2>
<ul>
<li>Managed (GC)</li>
<li>Has a <em>great</em> deal of libraries and frameworks</li>
<li>Good readability</li>
<li>VM, slow dynamic code, no built-in concurrency support</li>
<li>Cheap linux deployment but can require more servers for large scale sites</li>
</ul>
<p>Notice a common theme? Check category number 4 for all listed languages. <em>No built-in concurrency support.</em></p>
<p>When all these languages were designed the requirements for the concurrent requests execution were much lower than what we have now. There has been a tremendous shift in volume of requests. <em><br />
</em></p>
<p><span style="font-size:20px;font-weight:bold;">Concurrency: CGI</span></p>
<p>Massive need for concurrency first happened when web applications became available. The first answer to running concurrent scripts was <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" target="_blank">Common Gateway Interface</a> (CGI). It made an HTTP requests look like it was executed by a user, mapped requests parameters to the environment variables, passed input to <em>stdin</em> and sent <em>stdout</em> back to the browser. First implementations would start a process for each request. For instance, if you had a python script it would execute Pyton interpreter for every request. The model relied on OS security and access control and was comfortable at the time as many tools operated with stdin/stdout. However, starting a process for each requests quickly becomes prohibitively expensive.</p>
<h2>Concurrency: FastCGI</h2>
<p>The answer was found in <a href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, where a process wasn&#8217;t closed at the end of the requests but instead re-used to process next request. FastCGI allowed for a pull of processes to serve a lot of incoming requests, allowing for a better scalability. This model is still widely used for many deployments. However, you quickly find out that switching processes is an expensive task and that inter-process communication (IPC) is also expensive. Another problem is sharing of resources. For instance, each process needs its own database connection pool, instead of having a shared one.</p>
<p>Imagine having 100 front end servers each running 5 FastCGI processes. If no SQL queries are executed in parallel you would need 500 connections to the database. Depends on your database, it can be very expensive to have that many simultaneous connections open.</p>
<h2>Concurrency: Thread Pool</h2>
<p>The answer to the problem was found in using <a href="http://en.wikipedia.org/wiki/Thread_pool" target="_blank">thread pool</a>s. Instead of having multiple processes we run one process per application but we create multiple threads withing the process. Threads are much lighter than processes so context switches are much cheaper, you can run many threads per process (normally anywhere between 50 and 250) , and you can have access to shared memory and resources such as DB connection pool. However, for large scale web applications even this model has its limitations. Your code is  expected to be synchronously executed on a single thread that is dedicated to processing your requests. The code blocks your thread while executing. If you have a to access a resource with a slow response time (for instance a web service such as google, facebook, twitter, etc.) your thread has to wait until the sub-requests is executed. If underlying resources are slow, your thread pool will quickly becomes <em>starved</em>: every available thread will be waiting for sub-requests, and no new requests will be processed. This is a very common problem.</p>
<h2>Concurrency: Fibers</h2>
<p>Many people are coming to realize that thread pools are quite ineffective for applications that have massive load. Many people also realize that you don&#8217;t need to be next google to experience these issues; you can have a popular iPhone app or mentioned on Reddit/Digg/Slashdot and find our that your services are bogged down.</p>
<p>The problem with scalability is that you need to be able to survive the burst. It can be extremely cost ineffective to scale hardware to that level. For instance, most of the time your web farm will be doing nothing, but you need to maintain it for that moment when you get mentioned on Twitter and the traffic comes your way.</p>
<p>I mentioned iPhone where a simple free application can become available to millions of users instantly and setting up a web farm with many servers in it is simply not an option. One solution would be to utilize the super powerful servers that you have to the max of their potential. You achieve this by following one simple rule: <strong>don&#8217;t waste resources on waiting if there is something else to work on.</strong></p>
<p><strong> </strong>If you want to achieve maximum throughput you have no choice but to be <a href="http://en.wikipedia.org/wiki/Asynchronous_I/O" target="_blank">asynchronous</a>. Instead of waiting for that Google API request to come back you can start processing new incoming requests and get back to serving the first requests once the data is available. It requires a primitive lesser than a thread. You might have heard names such as &#8220;fiber&#8221;, &#8220;tasklet&#8221;, &#8220;channel&#8221;, &#8220;coroutine&#8221;. Let&#8217;s call it &#8220;fiber&#8221;. Fibers are micro-threads that are executed concurrently. When your fiber encounters a long running operation it schedules it to be executed and yields to another fiber. Essentially, you execute <a href="http://en.wikipedia.org/wiki/Computer_multitasking" target="_blank">cooperative</a> multitasking within <a href="http://en.wikipedia.org/wiki/Preemption_(computing)#Preemptive_multitasking" target="_blank">preemptive</a> multitasking.</p>
<p>An ideal application will execute on top of a thread pool with N threads where N = number of CPU cores. You don&#8217;t need extra threads, as your operations never block. In reality you might want more threads to smooth things out.</p>
<h2>Concurrency: Libraries</h2>
<p>This is by no means a novel idea. There are plenty of solutions written to address this specific issue. There is <a href="http://www.tornadoweb.org/" target="_blank">Tornado</a>, <a href="http://nodejs.org/" target="_blank">Node.js</a>, any many others. I personally think the fact that JavaScript in the browser requires developers to only use non-blocking (another name for asynchronous) calls has advanced the cause greatly. The performance is there, so what&#8217;s the problem? Readability and control flow. Consider this code:</p>
<p><pre class="brush: plain;">
function updateStatus() {
try {
  var status = twitter.getStatus();
  displayStatus( status );
}
catch( error ) {
  displayError( error );
}
</pre></p>
<p>pretty straight forward, huh? Now, imagine writing  this code in a non-blocking way:</p>
<p><pre class="brush: plain;">
function updateStatus() {
  twitter.getStatusAsync( onUpdateStatusSuccess, onUpdateStatusError );
}

function onUpdateStatusSuccess( status ) {
  displayStatus( status );
}

function onUpdateStatusError( error ) {
  displayError( error );
}
</pre></p>
<p>Not nearly as hot. Now imagine that <em>displayStatus </em>and <em>displayError</em> are non-blocking calls either. You will quickly end up with a very fragmented code.</p>
<p>Languages that support <a href="http://en.wikipedia.org/wiki/First-class_function" target="_blank">first class functions</a> or lambdas allow for writing success/error functions inline, however it generally leads to the <a href="http://en.wikipedia.org/wiki/Continuation-passing_style" target="_blank">continuation-passing  style</a> which has same problem across the languages: <strong>non-blocking calls make natural language constructs such as structured exception handling, loops, condition statements, etc. ineffective. </strong></p>
<p>This is a very important thing to understand. Languages designed as they are with a certain control flow in mind. They have control structures in place to assist the developer in accomplishing certain task. For instance, <em>foreach</em> loop can usually be replaced with <em>for</em> and <em>switch/case/default</em> can be replaced with <em>if/elseif/else</em> construct, but they are there for a reason. They serve to increase productivity through providing more concise and expressive code. Non-blocking libraries render you unable to use a lot of the language constructs and produce poorly structured code.</p>
<h2>Concurrency: Language support</h2>
<p>It&#8217;s quite clear that if you want to achieve the best possible scalability and maintain readability, you not only need a non-blocking library, but also a language that supports this specific style of development.</p>
<p>Let me outline this: <strong>to enable  wide-spread, practical use of non-blocking paradigm a programming language needs to provide built-in support for it.</strong></p>
<p>This is the theme of all new languages. Whether it is co-routines in Go, actors in Scala, tasks in Rust, or new <em>async/await</em> keywords in C#, all these languages are trying to get a crack at the same problem: make a concurrent development easier and more available to developers.</p>
<p>All new languages (with notable exception of C# 5 approach)  implement a form of a message exchange. You can send message from one part of your program to another. Unfortunately, I don&#8217;t think this address the issue properly and, while a step forward, is far from the desired solution.</p>
<p>C# is taking a different approach that will reduce code fragmentation a lot better. However it will be a limited success due to the need to explicitly define functions as async and use  of Task&lt;T&gt; and thread pool.</p>
<p>I think there is a better solution to the concurrency issue,  one that could be applied to the existing languages by introducing libraries and compiler magic around those libraries. However, this is a topic for a different conversation.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/async/'>async</a>, <a href='http://opletayev.com/tag/concurrency/'>concurrency</a>, <a href='http://opletayev.com/tag/languages/'>languages</a>, <a href='http://opletayev.com/tag/scalability/'>scalability</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/477/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/477/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/477/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=477&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/12/07/concurrency-in-new-and-existing-programming-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Why people don&#8217;t switch from WinForms to WPF</title>
		<link>http://opletayev.com/2010/11/18/why-people-dont-switch-from-winforms-to-wpf/</link>
		<comments>http://opletayev.com/2010/11/18/why-people-dont-switch-from-winforms-to-wpf/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 18:58:20 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mvvm]]></category>
		<category><![CDATA[winforms]]></category>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=465</guid>
		<description><![CDATA[I posted this as a comment here: http://10rem.net/blog/2010/11/16/windows-forms-developers-tell-me-about-your-applications and figured I&#8217;ll re-post it in my blog. I have a lot of experience designing WinForms apps. Here is a screenshot from my the latest app I designed: http://execqview.com/images/facility-age-gender.gif. This is a very simple screen. There are quite a few of more complex screens with hundreds of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=465&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I posted this as a comment here:</p>
<p><a href="http://10rem.net/blog/2010/11/16/windows-forms-developers-tell-me-about-your-applications" target="_self">http://10rem.net/blog/2010/11/16/windows-forms-developers-tell-me-about-your-applications</a></p>
<p>and figured I&#8217;ll re-post it in my blog.</p>
<p>I have a lot of experience designing WinForms apps. Here is a screenshot from my the latest app I designed: <a href="http://execqview.com/images/facility-age-gender.gif" target="_blank">http://execqview.com/images/facility-age-gender.gif</a>.</p>
<p>This is a very simple screen. There are quite a few of more complex screens with hundreds of controls and a lot of data binding/data entry.</p>
<p>I had an opportunity to move to WPF, however I ran into some problems that prevented me from doing so:</p>
<p>1) Lack of business controls. WinForms doesn&#8217;t have a lot of good controls built in, but there are mature 3rd party libraries like DevExpress. For instance, take one of the most common controls in business apps: data grid. The grid from my screenshot up above comes with bands, multi sorting, totals, column selection, grouping, reordering, filtering, incremental search, custom cell rendering, cell controls, export to excel, and many other features. It can hold 100,000 records without any consequences to performance whatsoever. This is just one example. Tree view, tree list, scheduling controls, layouts, menu controls, ribbon controls, tab controls, charts, etc. All these things are readily available for WinForms development and provide an amazing productivity boost. The market for WPF controls is a lot weaker. Even established vendors like DevExpress have rather weak libraries for WPF.</p>
<p>2) Incredibly complicated design system. In WinForms you have controls that you can anchor to other controls- a very simple concept. In WPF you have different layouts that are cumbersome and yet inferior to anchoring in terms of real work. On top of it, you have access to myriads of properties such as gradients, layouts, panes, paths, resources, templates, 3D, timelines, and many other things. It&#8217;s just crazy complicated and almost assumes that you have to have a designer on the team. Setting up even a simple application requires a lot more work with WPF which results in lower productivity.</p>
<p>3) As a developer, you can&#8217;t leverage almost anything from your WinForms experience. Literally, you have to throw what you know away, clear your mind, and embrace all kinds of new concepts such as MVVM, new data binding, new control structure and design, resources, etc. You have to learn new tools such as Blend. It takes a while to get productive using all these new concepts and tools. We are talking about a serious learning curve here, a curve that is not easily justified at the moment.</p>
<p>4) Most WPF applications don&#8217;t have a good feel to them. I am sorry, but it&#8217;s true. They are slow, clunky, and non-native looking. You CAN make them look slick and flashy, but it requires a lot of effort and a set of strong artistic skills. Unfortunately, most GUI applications are written by businesses for businesses. Teams don&#8217;t have access to designers and have very strict time lines. Not a lot of mainstream developers have a luxury of turning their apps into a piece of art.</p>
<p>Essentially, it takes a lot more effort and time to write WPF applications and unless you need a very flashy app there are no clear benefits that you gain. There is</p>
<br /> Tagged: <a href='http://opletayev.com/tag/net/'>.net</a>, <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/microsoft/'>microsoft</a>, <a href='http://opletayev.com/tag/mvvm/'>mvvm</a>, <a href='http://opletayev.com/tag/winforms/'>winforms</a>, <a href='http://opletayev.com/tag/wpf/'>wpf</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/465/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/465/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/465/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=465&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/11/18/why-people-dont-switch-from-winforms-to-wpf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>The Fallacy of Premature Optimization</title>
		<link>http://opletayev.com/2010/09/08/the-fallacy-of-premature-optimization/</link>
		<comments>http://opletayev.com/2010/09/08/the-fallacy-of-premature-optimization/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 16:12:23 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[performance]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=453</guid>
		<description><![CDATA[A great read by Randall Hyde: http://www.acm.org/ubiquity/views/v7i24_fallacy.html.acm.org/ubiquity/views/v7i24_fallacy.html More by Joe Duffy: http://www.bluebytesoftware.com/blog/default,date,2010-09-06.aspx The important part to understand is that performance, just anything else, is a feature of your software product. Your product must perform at a certain level in order to be successful. Ignoring this simple fact leads to fail whales. Just being aware of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=453&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A great read by Randall Hyde:</p>
<p><a href="http://www.acm.org/ubiquity/views/v7i24_fallacy.html.acm.org/ubiquity/views/v7i24_fallacy.html" target="_blank">http://www.acm.org/ubiquity/views/v7i24_fallacy.html.acm.org/ubiquity/views/v7i24_fallacy.html</a></p>
<p>More by Joe Duffy:</p>
<p><a href="http://www.bluebytesoftware.com/blog/default,date,2010-09-06.aspx" target="_blank">http://www.bluebytesoftware.com/blog/default,date,2010-09-06.aspx</a></p>
<p>The important part to understand is that performance, just anything else, is a feature of your software product. Your product must perform at a certain level in order to be successful. Ignoring this simple fact leads to <a href="http://www.google.com/images?q=twitter+fail+whale" target="_blank">fail whales</a>.</p>
<p>Just being <em>aware</em> of performance while designing a  product will help tremendously- just like how one of the better ways to diet is to calculate how many calories you ingest every meal.</p>
<p>Writing efficient code doesn&#8217;t take much more of your time, if any. In fact, it can easily be argued that writing efficient code actually saves you a lot of time in the long run. Not only you won&#8217;t have to spend all that time down the road trying to re-factor your code, you will likely end up having a generally better designed system, which speeds things up.</p>
<p>The number of clients on the internet has been growing exponentially. Each day hundreds of thousands of internet-available smart phones are activated. Tablets, net books, web services, crawlers, etc. Ignoring this traffic and hoping to stay below the radar is not something you want to do.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/development/'>development</a>, <a href='http://opletayev.com/tag/optimization/'>optimization</a>, <a href='http://opletayev.com/tag/performance/'>performance</a>, <a href='http://opletayev.com/tag/software/'>software</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/453/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=453&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/09/08/the-fallacy-of-premature-optimization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Monitoring .NET application performance</title>
		<link>http://opletayev.com/2010/09/02/monitoring-net-application-performance/</link>
		<comments>http://opletayev.com/2010/09/02/monitoring-net-application-performance/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 20:34:51 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[performance]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=446</guid>
		<description><![CDATA[If you need to troubleshoot a poorly performing ASP.NET application here is a couple tips for you. GC Performance Counters GC is the lungs of the application. It needs to breathe freely to perform well. The rhythm is as important as oxygen intake. First of all, look at the list of the available performance counters [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=446&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you need to troubleshoot a poorly performing ASP.NET application here is a couple tips for you.</p>
<h3><strong>GC Performance Counters</strong></h3>
<p>GC is the lungs of the application. It needs to breathe freely to perform well. The rhythm is as important as oxygen intake. First of all, look at the list of the available performance counters for .NET GC:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx">http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx</a></p>
<p>The counters you want to watch for are: <strong># Gen 1 Collections</strong>, <strong># Gen 2 Collections</strong>, <strong>% Time in GC</strong>, <strong># Bytes in all Heaps</strong>, and <strong>Large Object Heap size</strong></p>
<p>The best way to monitor a .NET application memory performance is to run a performance counter with the maximum resolution (1 sec) over 2-5 minutes. It’s a bit like getting an <a href="http://en.wikipedia.org/wiki/Electrocardiography" target="_blank">EKG</a>: you want a detailed diagram of a short period, not an approximation over a longer period.</p>
<p>Here is what you watch for:</p>
<ol>
<li> Normal <strong>% Time in GC </strong>is around 10-12%. Over 30% is where it starts getting bad. Over 50% is really bad. That means 50% of the processing time is spent managing memory. By design, .NET memory manager will stop all active threads for garbage collection (GC), and no requests will be processed at the time of collection. All new requests will have to wait in the queue.</li>
<li><strong># Gen 2 Collections </strong>should be 10 times or so lower than <strong># Gen 1 Collections</strong>. Gen1 collections are relatively cheap. Gen2 collections are expensive. If the ratio is much lower than 10, it can cause potential latency delays. A ration of 1-to-1 or 1-to-2 indicates severe issues with memory management.</li>
<li><strong>Large Object Heap size</strong>. LOH is never compacted so it can get fragmented easily. It is also collected as a part of Gen2 collection, which is expensive.</li>
</ol>
<h3><strong>W3SCV_W3WP counters</strong></h3>
<p>Another set of counters to look at are called <strong>W3SVC_W3WP</strong> counters. These performance counters allow you to monitor IIS worker processes for application pools. Worker process instance counters are named PID_APPPOOLNAME. You can get all instances using *_APPPOOLNAME for a specific app pool.</p>
<p>The counters to watch for are <strong>Active Threads Count, Total Threads Count,</strong> and <strong>Maximum Threads Count</strong>.</p>
<p>Each request requires a thread to execute. Thread Pool is a mechanism in .NET that manages worker threads. It can dynamically grow the number of threads up to the <strong>Maximum Threads Count</strong>. If GC is the lungs of your app, Thread Pool is the heart. If it stops beating your app will freeze.</p>
<p><strong>Total Threads Count </strong>indicates the currently utilized number of threads. If this number gets close to <strong>Maximum Threads Count, </strong>it means that the pool has at some point expanded to its limit. It’s a thing to watch for, but it’s not very critical.</p>
<p><strong>Active Threads Count </strong>indicates how many threads are currently busy. If this number is close or equal to <strong>Maximum Threads Count </strong>it means the Thread Pool is reaching its capacity. The lack of available threads in the Thread Pool can cause requests to be delayed or denied (you will likely to see 500 HTTP error with ‘too busy’ in details).</p>
<p>Long running requests can cause Thread Pool <em>starvation</em>. It’s a situation where all (or most) worker threads are busy waiting for a response from a web service or long running database query. The utilization of the server is very low (close to 0%) but no new requests can be processed. All new requests will either get denied or delayed until one of the worker threads gets available for processing. Imagine all lanes in a supermarket waiting for a manager at the same time. Everybody’s busy and no work gets done at the same time.</p>
<h3><strong>ASP.NET Counters</strong></h3>
<p>The last things I am going to mention are general ASP.NET counters.</p>
<p>Take a look at <strong>ASP.NET\Request Execution Time</strong> and <strong>ASP.NET\Request Wait Time</strong> counters. They show execution time and wait time, respectively, for the last request. While these numbers are arbitrary, you can quickly estimate the max throughput of your Thread Pool. For instance, if your execution time is 5 seconds and your Maximum Thread Count is 50 you will not be able to process more than 10 requests a second.</p>
<p><strong> </strong></p>
<p>Separate application pools have separate thread pools. Collecting performance counter data during peak hours can help understand any potential performance bottlenecks in .NET applications.</p>
<h3><strong>Conclusion</strong></h3>
<p>By no means these are the only things you should look at, but it&#8217;s a good place to start.</p>
<p>If you want to understand how .NET GC works (and it&#8217;s a pretty sophisticated GC), Doug Strewart compiled a great index to Maoni Stephens&#8217;s GC blog:</p>
<p><a href="http://blogs.msdn.com/b/dougste/archive/2010/02/18/an-index-to-maoni-s-blog-posts-about-the-gc.aspx" target="_blank">http://blogs.msdn.com/b/dougste/archive/2010/02/18/an-index-to-maoni-s-blog-posts-about-the-gc.aspx</a></p>
<br /> Tagged: <a href='http://opletayev.com/tag/net/'>.net</a>, <a href='http://opletayev.com/tag/memory/'>memory</a>, <a href='http://opletayev.com/tag/optimization/'>optimization</a>, <a href='http://opletayev.com/tag/performance/'>performance</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=446&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/09/02/monitoring-net-application-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Technical tax</title>
		<link>http://opletayev.com/2010/08/23/technical-tax/</link>
		<comments>http://opletayev.com/2010/08/23/technical-tax/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 19:57:53 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[technical tax]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=423</guid>
		<description><![CDATA[In the previous post, I talked about technical debt. It&#8217;s an essential part of any software project that has shipped with time line in mind. However, at the same time it&#8217;s one of the major reasons why projects have to be rewritten from the scratch so often. You do want to manage your technical debt [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=423&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://opletayev.com/2010/08/16/technical-debt/" target="_self">previous post</a>, I talked about technical debt. It&#8217;s an essential  part of any software project that has shipped with time line  in mind. However, at the same time it&#8217;s one of the major reasons why  projects have to be rewritten from the scratch so often.</p>
<p>You do want to manage your technical debt and there are ways to manage it.</p>
<p><strong>All you need is time</strong></p>
<p>As  I mentioned before, there are only 2 ways to get rid of debt: repay it  and default on it. If you are trying to avoid a default, you don&#8217;t  have a lot of options. You have to repay it.</p>
<p>Debt is a claim on future labor. That labor needs to be provided, which means <strong>someone needs to put the hours in</strong>.  It is possible that you will need to spend more hours down the road  than you would have spent initially. That&#8217;s fair; it&#8217;s the interest you  pay.</p>
<p>The problem becomes getting these  hours from the management. It needs to be timed right and explained in a way they can understand.</p>
<p><strong>Feature holiday</strong></p>
<p>One of the most straight forward ways to deal with the problem is to set aside a period of time <em>right after the release</em>. No new features, only bug fixes and re-factoring. Depends on your release cycle it can be a couple weeks to a month. Either way it needs to be a significant amount of time so that you can actually go and implement important changes.</p>
<p>The upside of it is you can ask for this time <em>before</em> release, while your management is focused on getting there. It won&#8217;t seem like such a big deal to do it right after the release, and it might be an easy sell. The downside of this approach is that you don&#8217;t know how much time you need. Sometimes you need more time, but sometimes you need less or not much at all.</p>
<p><strong>Technical Tax</strong></p>
<p>Another way to get the time needed is to tax your business people for hours they spend.</p>
<p>Management generally can comprehend the idea of maintenance and  doing some re-factoring. Depending on your organization type, you can  explain it using different methods. Say, If you are in the Agile camp, you can say it&#8217;s in <span style="text-decoration:line-through;">the Bible</span> <a href="http://agilemanifesto.org/principles.html" target="_blank">Manifesto</a>: &#8220;Continuous attention to technical excellence and good design enhances agility.&#8221; Just ask them if they want to increase agility, or if they don&#8217;t believe in <span style="text-decoration:line-through;">Jesus </span>Martin Fowler.</p>
<p>What it really comes  down to is taxing your business people for hours you need to spend on maintenance. They don&#8217;t get to have those. Those hours are not theirs. The  rate can go up or down, depending on the situation, but the hours need  to be taxed until the debt is repaid. Let&#8217;s call it Technical Tax.</p>
<p><strong>How to tax hours</strong></p>
<p>Lets assume that as a developer you work 40 hours a week. The actual number is irrelevant, some  companies use points, some allow to work 1 day a week on your personal  project, etc. But say you work 40 hours a week. You have 3 people on  your team, that comes down to 120 hours a week.</p>
<p>Your team worked 240 hours a week for half a year to get the first  release shipped. You worked so hard that your girlfriend left, but you only realized  it when you accidentally turned on your phone and listened to your voice  mail. It was the only message there, as everybody else pretty much gave  up on calling you. However, there is a new day and the project is now  shipped. You can relax and work your 40 hours a week, like a normal  person.</p>
<p>Of course, you cut a lot of corners trying to ship your software.  Now you need to go back and fix it, refactor bad code, implement all the  little optimizations you had in mind. This is where you find out that  your product manager insists on implementing a list of new features that  the sales want in order to close a big client. You are told that re-factoring something that works is &#8220;bad ROI&#8221;.</p>
<p>This is where your team needs to tell management that paying debt is NOT an investment and start taxing the hours that business people get. Figure out what refactoring you need to do,  create a plan, go to your business, and tell them you need XX hours a  week to fix what needs to be fixed. Just like &#8216;feature holiday&#8217;, the best time to implement something like this is right after a release. It may vary from project to project,  but it should be around 10-30% of the total hours. At 15% your team will  get 18 hours a week, which means one of you can spend 2 days per week  repaying the debt, refactoring code, etc. Business people get to play  with the rest of the hours, but they can&#8217;t touch these hours under any  circumstances.</p>
<p>If you feel it&#8217;s not enough &#8212; negotiate a rate increase. It&#8217;s not  going to be easy; nobody likes tax hikes. The trick is, though, once you  have the tax system in place, <strong>you will be debating how many hours you spend paying off your technical debt, not whether you do it or not!</strong></p>
<p>If you have too much debt, you might need get more people on your  team or improve your practices. If you need to release something fast  you can announce a tax holiday, but always set the end day for it and  always try to get more hours after it&#8217;s done.</p>
<p><strong>How to manage technical tax</strong></p>
<p>If taxes go  too high, people will try and avoid them. The same is applicable to the  technical tax. Keep it as low as possible and people will justify it by  having a better product. Less technical debt means you will be  implementing features faster, your product will perform faster, it will  scale better, it will require less maintenance. Before you know, business people will fight to get the credit for implementing it and boast around  how they outsmarted the developers.</p>
<p>There are a couple things you need to watch out for:</p>
<ol>
<li>The  tax will only work if you use it to repay the debt. It&#8217;s not your &#8216;do  whatever you want&#8217; time. You do what needs to be done and then it will  work.</li>
<li>If you run out of critical things to do, you should reduce  the tax. Always remember that it&#8217;s a necessity and that the goal is to  minimize the debt, not maximize it.</li>
</ol>
<p>It&#8217;s OK if the tax goes to a very low amount, say 2 hours a week for just reviewing that everything looks good. Just make sure it doesn&#8217;t go away so you don&#8217;t have to have a debate about implementing it again.<br />
<strong><br />
Conclusion</strong></p>
<p>Use technical tax to strengthen your  project and to keep it in a state where it&#8217;s ready to expand, ready to  accept new clients, ready to scale, ready to be deployed on more  servers. You&#8217;ll never want to rewrite your application from scratch ever again.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/process/'>process</a>, <a href='http://opletayev.com/tag/technical-tax/'>technical tax</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=423&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/08/23/technical-tax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Technical Debt</title>
		<link>http://opletayev.com/2010/08/16/technical-debt/</link>
		<comments>http://opletayev.com/2010/08/16/technical-debt/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 15:57:38 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[technical debt]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=417</guid>
		<description><![CDATA[Technical debt You have probably heard the term &#8220;Technical Debt&#8221;. All-knowing Wikipedia describes it as: Neologistic metaphors referring to the eventual consequences of slapdash software architecture and hasty software development Sometimes when you need to ship or make a release you have to cut corners. You know it&#8217;s not the best thing to do, but it&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=417&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Technical debt</strong></p>
<p>You have probably heard the term &#8220;Technical Debt&#8221;. All-knowing Wikipedia <a href="http://en.wikipedia.org/wiki/Technical_debt" target="_blank">describes</a> it as:</p>
<blockquote><p>Neologistic metaphors referring to the eventual consequences of slapdash <a title="Software architecture" href="http://en.wikipedia.org/wiki/Software_architecture" target="_blank">software architecture</a> and hasty <a title="Software development" href="http://en.wikipedia.org/wiki/Software_development" target="_blank">software development</a></p></blockquote>
<p>Sometimes when you need to ship or make a release you have to cut corners. You know it&#8217;s not the <em>best</em> thing to do, but it&#8217;s a <em>quick</em> thing thing to do, and you need to ship your product.</p>
<p>There is nothing wrong with cutting corners to make a release. In  fact, if you don&#8217;t have to cut corners, you are shipping too late.  Virtually every single software project that shipped had to cut some  corners. Sometimes more, sometimes less. No matter what, there is technical debt  associated with each project.</p>
<p><strong>Understanding technical debt</strong></p>
<p>It&#8217;s  important to understand what debt is. Debt is a claim on future labor.  It&#8217;s an obligation to either do something later or provide resources (money,  for instance) that are equivalent to labor.</p>
<p>When you owe money,  there are 3 ways to get rid of debt: pay up, default, or print money (if  you are a government). Now, most of us can&#8217;t print money, so it boils  down to either paying the debt or defaulting on it.</p>
<p>The last  important thing to understand about debt is interest. Because you get  something right away and promise to pay for it later, you usually have to  pay for it in a form of interest. This is why, when you borrow money  from a bank to pay for your house, you have to pay interest to the bank.  You get get the house right away, and the banks makes money.</p>
<p>Technical debt is not an exemption to any of these rules:</p>
<ol>
<li>It&#8217;s  a claim on future labor. You promise to go back and fix some of the  issues that you didn&#8217;t have time to do right in the current release.</li>
<li>Down  the road you have a choice between working on those items or defaulting  on your debt by doing nothing. Just like with normal debt, defaulting  on a debt comes with consequences. I will describe them in a moment.</li>
<li>Fixing  something way down the road tends to be more expensive than fixing it  right away. Partly because developers move on and don&#8217;t remember all the  details, partly because there can be new components that expect you to  work in current non-optimal way.  This is the interest you pay.</li>
</ol>
<p><strong>Why no-one repays technical debt</strong></p>
<p>While  there are always intentions to fix something down the road, more often  than not it doesn&#8217;t happen. New issues arise, new features need to be  shipped, priorities change, etc. It is a lot more common for businesses  to pay technical interest until it becomes unbearable, default  on the debt, and then file for bankruptcy in the form of deciding to rewrite  the whole damn thing from the scratch.</p>
<p>Let&#8217;s get this straight:  rewriting your software from the ground up is an expensive thing to do.  Yes, you lose your technical debt, but you also lose a lot of your <em>assets</em>.  Just like when you file for bankruptcy, you are likely to lose some of  your assets. Usually, a very significant portion of them. The same rule  applies to software project: you will lose all the good code that you&#8217;ve  written, tested, debugged over the years. It represents a big  investment. While some of it might be salvaged, a lot of it will be  gone. It will have to be re-written, re-tested, re-debugged. New  deadlines will have to be met and guess what? New technical debt will be  accumulated!</p>
<p>We see this cycle over and over again.  Companies abandon old projects and announce moving to the &#8220;new and  better&#8221; projects all the time. Why?</p>
<p>There are several major factors contributing to it and they explain why it happens so often:</p>
<ol>
<li><strong>Business  people don&#8217;t see technical debt.</strong> If you think they understand your  blabbering about re-factoring a piece of code to work faster you are  wrong. They can humor you by pretending they understand but they don&#8217;t.  If it works – it&#8217;s done. They want new features for new customers. New  customers bring new revenues and bigger bonuses. System being sluggish  and crashing often is not their problem, it&#8217;s the fault of developers and  hosting people.</li>
<li><strong>Perceived low ROI.</strong> This is a direct  consequence of #1. When  talking to business people you can often hear &#8220;It doesn&#8217;t generate us  new revenue so it&#8217;s  low ROI&#8221;. The problem is that ROI stands for &#8220;Return On Investment&#8221; and  we are not talking about investment! We are talking about paying off <em>debt</em>.  Debt is not an investment, it&#8217;s something you owe. When you buy a house  you borrow money from the bank, creating debt. Then you invest borrowed  money into the house. If your house goes up in value you made a  successful investment, but it doesn&#8217;t change the fact that you still owe  the bank. Now, think about it as saying that repaying your mortgage has a  low ROI since, you know, you already have the house.</li>
<li><strong>Developers don&#8217;t like repaying technical debts.</strong> Well, let me correct myself. They <em>despise</em> it! Writing new code is more fun then fixing old code. Especially if  its not written by you. Developers might not like creating technical  debt (gah, have to cut corners again!) but fixing old code is not  something developers crave to do either. Let&#8217;s be honest about it:  developers would rather bitch about how the whole thing stinks than fix  it. Oh, it&#8217;d smell like roses if only they had a chance to rewrite the  whole damn thing.</li>
<li><strong>Development processes don&#8217;t focus on it. </strong>Modern development processes  gravitate towards features and bugs and tend to ignore technical debt.  There are no user stories for products requiring a lot more servers to  scale, for having to struggle with strange joins because database schema  is designed badly, for developers spending extra hours working around  legacy code quirks, or for having a much steeper learning curve for the new  people. The list goes on and on. Unless it gets unbearable and produces  acute disruptions to the business process (outages, slow beyond  reasonable, etc.), modern development methodologies tend to discourage  long running maintenance projects.</li>
</ol>
<p>All these things contribute to not repaying technical debts. Nobody likes it, but that&#8217;s just the way it works.</p>
<p><strong>Conclusion</strong></p>
<p>When working on complex software projects, technical debt is a fact of  life. It&#8217;s created often and willingly and it&#8217;s extremely hard to repay.  Once enough debt is accumulated the project is deemed &#8216;old and crappy&#8217;  and a &#8216;new and shiny&#8217; project emerges. While it&#8217;s a terrible business  practice and comes with a huge cost in time and money, it&#8217;s more of a  norm than an exception in the modern software engineering.</p>
<p>In the next post I will show one way to repay your technical debt on  time and have a stable technical economy for your project.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/business/'>business</a>, <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/process/'>process</a>, <a href='http://opletayev.com/tag/technical-debt/'>technical debt</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/417/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=417&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/08/16/technical-debt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 7 HDD Mirror Issue, SyncQueue TaskGroup</title>
		<link>http://opletayev.com/2010/07/05/windows-7-hdd-mirror-issue-syncqueue-taskgroup/</link>
		<comments>http://opletayev.com/2010/07/05/windows-7-hdd-mirror-issue-syncqueue-taskgroup/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 18:32:45 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[async]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=404</guid>
		<description><![CDATA[I run Windows 7 on my workstation with SSD + RAID1 setup. The SSD contains Windows, Visual Studio, and some other tools that I use. The mirrored HDDs contain all data files and a backup copy of the SSD. This setup has been working fairly well for me because it gives an outstanding performance of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=404&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I run Windows 7 on my workstation with SSD + RAID1 setup. The SSD contains Windows, Visual Studio, and some other tools that I use. The mirrored HDDs contain all data files and a backup copy of the SSD. This setup has been working fairly well for me because it gives an outstanding performance of the SSD drive (Windows 7 boots up in under 8 sec) and a stability of RAID1 which prevents any significant data loss.</p>
<p>The only disappointing issue so far has been Windows mirror fail once in a while. It&#8217;s hard to say why, but it seems that sometimes the mirror just breaks and needs to be restored. It takes a LONG time. By that I mean it&#8217;s been running for over 30 hours now and it&#8217;s 48% complete. No data has been lost, but it&#8217;s still rather annoying when it happens. Last time I blamed a power failure but this time there was none. The mirror just broke while my workstation was running. I am not sure what&#8217;s the deal with it as the HDDs are new and checkdisk doesn&#8217;t seem to find any issues.</p>
<p>As promised,here is  a little example of how to use SyncQueue with TaskGroup when you need to queue multiple requests and wait until all of them come back. This is a fairly common situation that is not addressed by the standard BackgroundWorker control.</p>
<p>Here is a piece of working code from one of the projects I&#8217;ve been working on. It searches and fetches all health care claims that belong to a specific hospital visit and displays the visit once all the claims are fetched:</p>
<p><pre class="brush: plain;">
private void FetchVisitData() {
  // create new SyncTaskGroup in the constructor
  Global.TaskQueue.Append( new SyncTask( this, new SyncTaskGroup() ) {
    Action = task =&gt; {
      // find all claims that belong to the visit
      var claims = Global.Claims.Search( Data.Claims.ClaimSearchAction.VisitId,
                      VisitId, 500, Data.Claims.ClaimSearchKind.Equals );
      ListData list = new ListData();
      foreach( Data.Claims.ClaimSearchResult info in claims.Items ) {
        // when we queue a task, pass the group from the parent task as the first argument
        Global.TaskQueue.Append( task.Group, new SyncTask( this ) {
          Context = info,
          Action = task2 =&gt; {
            // fetch claim data from the server
            MapData map = GetClaimData( (Data.Claims.ClaimSearchResult)task2.Context );
            // add claim to the list, lock as this happens concurrently
            lock( list ) { list.Add( map ); }
          },
          Error = Global.ReportTaskError,
          // completion of the child task notifies the group
          Complete = task.Group.TaskComplete
        } );
      }
      task.Result = list;
      // in a concurrent environment (especially multi-CPU) the first group task can
      // complete BEFORE the 2nd task is queued, therefore triggering a premature
      // completion of the whole group. To address this a task group needs to be manually
      // released when all child tasks are queued
      task.Group.Release();
    },
    Error = Global.ReportTaskError,
    Complete = task =&gt; {
      // we will only get here when all the claims have been fetched and the group task is completed
      Visit = new MapData( &quot;Claims&quot;, (ListData)task.Result );
      RenderVisit();
    }
  });
}
</pre></p>
<br /> Tagged: <a href='http://opletayev.com/tag/net/'>.net</a>, <a href='http://opletayev.com/tag/async/'>async</a>, <a href='http://opletayev.com/tag/code/'>code</a>, <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/hardware/'>hardware</a>, <a href='http://opletayev.com/tag/windows/'>windows</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=404&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/07/05/windows-7-hdd-mirror-issue-syncqueue-taskgroup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
		<item>
		<title>SyncQueue</title>
		<link>http://opletayev.com/2010/06/20/syncqueue/</link>
		<comments>http://opletayev.com/2010/06/20/syncqueue/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 03:04:38 +0000</pubDate>
		<dc:creator>Mikhail Opletayev</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[async]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://opletayev.com/?p=378</guid>
		<description><![CDATA[As promised, here is a little library that allows for background queuing of long running synchronous operations.  Unlike the standard BackgroundWorker component, it&#8217;s not a visual component. Additionally,  it allows a little bit more control over what&#8217;s going on.  Also, I personally prefer lambdas over events, because  it keeps all the code relevant to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=378&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As promised, here is a little library that allows for background queuing of long running synchronous operations.  Unlike the standard BackgroundWorker component, it&#8217;s not a visual component. Additionally,  it allows a little bit more control over what&#8217;s going on.  Also, I personally prefer lambdas over events, because  it keeps all the code relevant to the background process in the same place.</p>
<p>Here is the code:<br />
<a href="http://code.google.com/p/syncqueue/source/browse/syncqueue.cs" target="_blank">http://code.google.com/p/syncqueue/source/browse/syncqueue.cs</a></p>
<p>Here is how you can use it:</p>
<p><pre class="brush: plain;">
// create a new queue with 4 worker threads
TaskQueue queue = new TaskQueue( 4 );

// 'this' must inherited from System.Windows.Forms.Control
SyncTask task = new SyncTask( this )  {

    Action = task =&gt; {
       // task action, execute your background task here
       // executed on a worker thread
       // use task.Result to return values
    },

    Complete = task =&gt; {
      // task complete without errors, called on the main thread
    },

    Error = task =&gt; {
      // an error occurred during execution, called on the main thread
      // exception is stored in task.Exception
      // if an exception if thrown in this method it will be ignored
    },

    Finally = task =&gt; {
      // if exists, always called at the end on the main thread
    }

};

// en-queue the task for execution
queue.Append( task );
</pre></p>
<p>The library also allows for spawning sub-tasks using SyncTaskGroup class. I will illustrate how it can be used in the next post.</p>
<br /> Tagged: <a href='http://opletayev.com/tag/net/'>.net</a>, <a href='http://opletayev.com/tag/async/'>async</a>, <a href='http://opletayev.com/tag/code/'>code</a>, <a href='http://opletayev.com/tag/dev/'>dev</a>, <a href='http://opletayev.com/tag/sync/'>sync</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opletayev.wordpress.com/378/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opletayev.wordpress.com/378/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opletayev.wordpress.com/378/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opletayev.com&amp;blog=5991243&amp;post=378&amp;subd=opletayev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opletayev.com/2010/06/20/syncqueue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ddead0a74699963f2e560a2f0b1fe3ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">opletayev</media:title>
		</media:content>
	</item>
	</channel>
</rss>
