<?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/"
	>

<channel>
	<title>Annoyed.ca &#187; Work</title>
	<atom:link href="http://annoyed.ca/category/life/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://annoyed.ca</link>
	<description>Life - Technology</description>
	<lastBuildDate>Fri, 30 Mar 2012 21:58:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Why Are We Still Using Internet Explorer 6? &#8211; Part Two</title>
		<link>http://annoyed.ca/2010/11/14/why-are-we-still-using-internet-explorer-6-part-two/</link>
		<comments>http://annoyed.ca/2010/11/14/why-are-we-still-using-internet-explorer-6-part-two/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 02:24:24 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.ca/2010/11/14/why-are-we-still-using-internet-explorer-6-part-two/</guid>
		<description><![CDATA[Nearly a year and a half ago I wrote this post about why many large organizations are still using Internet Explorer 6. Every now and again, the post is re-discovered and is re-circulated and I get some great feedback about &#8230; <a href="http://annoyed.ca/2010/11/14/why-are-we-still-using-internet-explorer-6-part-two/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Nearly a year and a half ago I wrote <a href="http://annoyed.ca/2009/07/27/why-are-we-still-using-internet-explorer-6/">this post about why many large organizations are still using Internet Explorer 6</a>. Every now and again, the post is re-discovered and is re-circulated and I get some great feedback about it. I’ve decided that it is time for a bit of an update on the subject, so here goes.</p>
<p>I’m going to assume that you’ve read my original post, but in one line, the reason many large organizations still use Internet Explorer 6 is application compatibility. My employer (a large government department) has recently experienced this first-hand, having had to postpone deployment of Internet Explorer 8 after discovering compatibility issues (mid-deployment) with some important business applications. I have no idea how come they only discovered the issues after starting to deploy. Either someone didn’t do due diligence and test before-hand, or worse, they were completely clueless about the risks of incompatibilities. Either way, as a fellow IT employee in the same organization, it’s down right embarrassing.</p>
<p>One of the most frequent comments I receive as feedback on my original post is that folks get the compatibility issues, but they believe that we wouldn’t be in this situation if these incompatible applications had been written using web standards. It’s the fault of the application developers that their applications only work properly with Internet Explorer 6.</p>
<p>  <span id="more-1127"></span>
<p>It is definitely true that Internet Explorer 6 isn’t very standards compliant… well, not by 2010 standards anyways. Thing is, these incompatible apps weren’t written last week, or last year. The state of web standards was very different when many of these applications were written.</p>
<p>Time for a little web history lesson. Let’s go back in time, about 13 years or so to late 1997.</p>
<p>HTML 3.2 is an W3C recommendation (HTML 4.0 will be a recommendation by the end of 1997, but will be updated and re-published again in April 1998). CSS level 1 is also a W3C recommendation. In the world of browsers, the world is basically using Netscape 4.0 or Internet Explorer 4.0 (I’m ignoring Opera, cause lets face it, most other folks did too). Both of the 4.0 browsers support HTML 3.2 and some CSS 1, but both browsers have serious bugs in their CSS implementations. At this point, other than HTML 3.2, neither browser is really “standards compliant”. Opera was closer, but web site designer/developers weren’t about to implement standards compliant sites if it would only work in Opera.</p>
<p>Fast forward a couple years to 1999. HTML 4.0 has been published (twice) as a W3C recommendation, as has CSS level 2. Internet Explorer is now at version 5.0 and Netscape has… essentially vanished from the scene. The Netscape story is a long and interesting one, but in a nutshell, they open sourced a large part of the code, started building version 5 on top of that, but discovered that the code was a complete disaster. So they tossed it out and started from scratch. Netscape 5.0 would never see the light of day. Internet Explorer 5 on the other hand included improved CSS and HTML standards support. In fact, Internet Explorer 5.0 for Mac was the first browser to achieve full support of CSS 1 (it had even better standards support than Opera). Internet Explorer 5.0 was also the first browser to include XMLHttpRequest, the basis for AJAX, the technology on which almost every major web site today depends (there is no “#NewTwitter” without AJAX &amp; XMLHttpRequest). XMLHttpRequest in IE5.0 wasn’t script accessible, but it was there behind the scenes.</p>
<p>Move forward another year to 2000. Nothing has changed in the world of W3C web standards (they went off and focussed on XML, XSLT, etc. for the next few years, I think) Netscape 6 is re-born, with a largely re-written codebase. But the browser is bloated, and generally doesn’t work well on any PC that isn’t relatively new. By the time a couple of minor versions (6.1 &amp; 6.2) come along to improve the performance situation, the world has been introduced to Internet Explorer 6.0. Shortly thereafter, the world is also introduced to Windows XP, with which comes a bundled IE6. This is about where I (and a huge chunk of the rest of the world) made the switch to Internet Explorer as my personally preferred web browser. Both of the IE and Netscape 6.x browsers support the current W3C standards, but the realm of CSS 2 in particular there is a huge difference in the implementation. Both products still contains major bugs and in many cases each product has interpreted some aspects of CSS 2 differently (so-called CSS 2 errata, clarified in CSS 2.1). In fact, the next revision of CSS, version 2.1 will drop parts that nobody implemented correctly, and will change other parts to match how the browsers of the day actually worked. The browsers drove CSS 2.1, rather than the other way around. By this time, it is important to note, Internet Explorer 6.0 accounts for almost +90% of the browser market share. Internet Explorer 6.0 is for all intents and purposes, <strong>the</strong> standard. It has bugs in its implementation of CSS (most notably in the box model). But in the first few years of the 21st century, if you build a site to 100% W3C standards, it’s going to be broken in +90% of the worlds browsers.</p>
<p>This is the era in which these applications which are incompatible today, in 2010, were built. To the Internet Explorer 6 de facto web standard.</p>
<p>Over the next 4 years, the situation doesn’t change much. HTML stays at 4, CSS stays at 2. Netscape and Opera (and several other smaller browsers) continue to release updates with improved implementations of W3C standards, but can’t seem to gain (or re-gain) any significant market share. In fact, Internet Explorer remains at version 6 (with a couple of service packs added) and peaks at +95% market share. Of course Microsoft is also been investigated for anti-trust issues related to their bundling of Internet Explorer with their operating systems. All this to say that frankly they haven’t got much motivation to release newer browser versions. The only other significant thing to come out of these years is XHTML, which frankly was a misguided detour which thankfully will likely be abandoned as a result of the adoption of HTML 5. The reasons why deserve their own post, but in a nutshell, there isn’t a single released version of Internet Explorer available today which supports XHTML. At least not when served by a web server using the correct MIME-type (application/xhtml+xml). So most web servers deliver XHTML with a MIME-type of text/html which most browsers parse as HTML (not XML or XHTML). Even if your site is XHTML compliant, if you serve it with the correct MIME-type to a supported browser, it won’t look the way you’d expect. Only a tiny percentage of sites are XHTML coded and served, on purpose and by design, using the correct MIME-type. And most of those are owned by computer science academics and grad students. But I digress.</p>
<p>Things begin to change at the end of 2004, when a little browser known as Firefox begins to actually take a chunk out of Internet Explorer’s market share. What made Firefox different from the dozens of other browsers that had tried before? I honestly couldn’t tell you. Probably just a good example of right place at the right time. I know I jumped on Firefox at about 1.0 and haven’t looked back. But Firefox re-ignited the so-called browser-wars of the late 1990’s, but in the 2000’s one of the things that earns you points is standards compliance. It also re-ignited the actual <strong>development</strong> of web standards: CSS 2.1 (2005 &amp; 2007), CSS 3 (2005) and HTML 5 (2008 draft).</p>
<p>The thing I want you to take away from this post is that these critical business applications which today are holding us back from moving forward with more standards compliant browsers were in fact developed to the standard that existed in their day. Namely, Microsoft Internet Explorer 6’s (buggy) interpretation of HTML 4 and CSS 1&amp;2. With +90% market share, for better or for worse, Internet Explorer 6’s version of the standard was <strong>THE</strong> standard.</p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2010/11/14/why-are-we-still-using-internet-explorer-6-part-two/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why Are We Still Using Internet Explorer 6?</title>
		<link>http://annoyed.ca/2009/07/27/why-are-we-still-using-internet-explorer-6/</link>
		<comments>http://annoyed.ca/2009/07/27/why-are-we-still-using-internet-explorer-6/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 01:25:07 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.ca/?p=442</guid>
		<description><![CDATA[There has been some discussion online recently between public servants about how the public service is still overwhelmingly using Microsoft Internet Explorer 6. I got involved when someone tweeted a link to this site: http://hey-it.com/download.html. The site provides cute posters &#8230; <a href="http://annoyed.ca/2009/07/27/why-are-we-still-using-internet-explorer-6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There has been some discussion online recently between public servants about how the public service is still overwhelmingly using Microsoft Internet Explorer 6. I got involved when someone tweeted a link to this site: <a title="http://hey-it.com/download.html" href="http://hey-it.com/download.html">http://hey-it.com/download.html</a>. The site provides cute posters asking the IT folks to basically get off their arses and give us a newer web browser. I responded back that there are other issues involved when upgrading web browsers, such as legacy application compatibility, and that things aren’t as clear cut as it may seem from the perspective of someone outside IT.</p>
<p>Well, responses to that included “don’t punish users for your deployment issues” and “are you afraid of losing your job if I upgrade my own browser”? Oh, and the term “visionless IT geeks” was tossed around. My response to this was a flurry of tweets quoting other folks rhyming off reasons why large organizations all over still use Internet Explorer 6. I then signed off Twitter and did not log back in for two days.</p>
<p>I essentially had a hissy-fit.</p>
<p> <span id="more-442"></span><br />
<blockquote>
<p>Screw you guys… I’m going home! – Eric Cartman</p>
</blockquote>
<p>Not particularly mature, but what can I say. I’m passionate about IT and took things a bit more personally than I should have. But I’ve spent several days since thinking about it and have decided there is an opportunity here to share some knowledge of how the IT group in a large organization views a web browser upgrade. As folks who know me can attest, I am not one to miss an opportunity to share (or receive) knowledge, so here goes.</p>
<p>First, a little about me for the sake of context.</p>
<ul>
<li>I am an IT guy. My entire professional career has been IT, all within the same department (the name has changed more times than I can count, but it’s still the same department). I am NOT a LAN support/Helpdesk person. I am NOT an IT standards person. I am NOT an IT Security person.     </p>
<p>In other words I personally have NO control what so ever about what gets installed or not installed on your GoC workstation (nor do I have anything to do with what Internet sites are blocked, by the way). I am simply a programmer, and like everyone else, I have to deal with the consequences of what “IT” deems suitable.</li>
<li>While my entire career has been IT, I spent the first several years of it OUTSIDE the IT group, in what would be labelled a shadow IT group. A shadow IT group is basically folks that the business people deal with to get things done. They get stuff done independently, and regardless of what the official IT group says. We had our own servers, our own un-filtered Internet connection and our own, separate network and workstations (we ran Linux on our desktops). To be clear though, our stuff was completely separate from the corporate stuff. We were a much smaller threat than the average shadow IT shop (I don’t mean threat to IT jobs, but threat to the security/stability of the department).
<p>So I know first hand the “I/We can do it better than IT” mentality that exists in large organizations, outside of the IT group. Been there, done that.</li>
<li>I also side-line as a web developer/designer. I own a company that started life as a web design firm. I am VERY well aware of the limitations of Internet Explorer 6. Access to my own stuff is broken when I am at work.</li>
</ul>
<p>So, why one standard browser?</p>
<p>Once upon a time there was a large government department with some 24,000 employees and two Internet browsers, Netscape 4 and Internet Explorer 4. This was in the height of the so-called browser wars and things that worked in one browser didn’t necessarily work in the other. Applications were increasingly being developed as web-based applications, because it was simpler: they can be centrally managed and there is no need to worry about incompatibilities between products on workstations. Think about it: standardize on one web browser, make your web application work for that web browser, and your application will just work for everyone! Bliss!</p>
<p>And that’s exactly what happened. Internet Explorer was likely chosen because it is basically built right in to the Windows operating system. You can’t really uninstall Internet Explorer, like you can Netscape. So Internet Explorer it is. I suspect the same story played out in other departments, and in fact in other corporations around the world.</p>
<p>One browser also has the advantage that it means only one product to monitor for vulnerabilities and patches/security updates. Internet Explorer updates, additionally, can be deployed using the same infrastructure that is publishing Windows operating system updates, Office Suite updates, etc.</p>
<p>Time marched on, Netscape all but disappeared from the scene and for awhile Internet Explorer was just about the only game in town. During this time, internal applications continued to be developed targeting Internet Explorer 6. Third-party companies developing software for large organizations could also pretty much guarantee that those organizations were using Internet Explorer 6 so they to targeted their software at that platform.</p>
<p>Fast forward to today and that 24,000 employee department has 100s (if not 1000s) of applications that were built to target Internet Explorer 6. Some just work in Internet Explorer 7, others have some minor things that don’t, and some just don’t work at all. And the story is even worse when we contemplate a switch to a completely difference browser, such as Firefox, Opera, Safari or Chrome.</p>
<blockquote><p>But Internet Explorer 7 is free. There is no cost to upgrade.</p>
</blockquote>
<p>Okay, let’s talk about where that reasoning breaks down. Say that in our 24,000 employee organization, 500 use Product X, sold to us 7 years ago by Company ABC. Product X works with Internet Explorer 6, but doesn’t work at all with Internet Explorer 7. Product X is an essential tool for those 500 people to do their jobs.&#160; We contact Company ABC for an update for IE 7, but it turns out Company ABC was bought 2 years ago by its competitor, Company 123. Company 123 has no update, but instead has their Product Z with works with IE 7. And it will only cost $10 million for licenses. And $1 million for a consultant to help migrate data from Product X to Product Z. And $1 million to train the users on Product Z.</p>
<p>But you know what? I don’t think we can’t legally just upgrade from one company’s product to another. We have to go through a Request For Proposal process, to allow other company’s to also compete on the contract. Optimistically that’s a 2 year process, just to acquire the new software. The process also requires the business area’s time, because it’s their software. They have to make sure that the replacement is capable of handling everything they need it too. Oh, and the business area has to pony up the money too.</p>
<p>Think about that from the business side’s point of view. You’ve got 500 employees working each day, happy doing their jobs. Then IT comes to you and says “We’re going to upgrade to IE 7. But first we need 2 years of you time (for the RFP alone, plus deployment, migration and training) and $12 million of your dollars (doesn’t include salary dollars). I know what my response would be, but I am too polite to actually publish it here.</p>
<p>And that conversation would replay 100s of times across the organization.</p>
<p>Internet Explorer 7 is nowhere near free. Not even close.</p>
<p>Internally, or in-house, developed applications are a similar story. They need to be upgraded, but the resources that would be used for the upgrade have to be prioritized. Government, business/program and IT priorities all have to be balanced. So instead of upgrading existing applications for Internet Explorer 7, IT is implementing Common Look and Feel 2.0 before the Treasury Board deadline passes, or they’re re-themeing existing web sites because the old red and white theme was too “Liberal” for the current government’s tastes (seriously, this is what you tax dollars get spent on).</p>
<p>Oh, by the way. Internet Explorer 7 requires Microsoft Windows XP or better. For a 24,000 employee organization, an on-going migration from Windows 2000 to Windows XP is an expensive and time consuming task, which suffers from its own set of compatibility issues (they are applications in use that don’t work in Windows XP).</p>
<p>Upgrading a web browser on your PC at home is an easy task. In a large government department however, it’s a huge tangled web of issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2009/07/27/why-are-we-still-using-internet-explorer-6/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Working from Home</title>
		<link>http://annoyed.ca/2008/12/17/working-from-home/</link>
		<comments>http://annoyed.ca/2008/12/17/working-from-home/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 03:18:45 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.ca/2008/12/17/working-from-home/</guid>
		<description><![CDATA[In case you weren&#8217;t aware, we are on day 8 of a transit strike here in Ottawa. I don&#8217;t drive (at all) so I normally rely heavily on the bus system here (which, in my mind, is top notch, when &#8230; <a href="http://annoyed.ca/2008/12/17/working-from-home/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you weren&#8217;t aware, we are on day 8 of a transit strike here in Ottawa. I don&#8217;t drive (at all) so I normally rely heavily on the bus system here (which, in my mind, is top notch, when it&#8217;s running). Fortunately the nature of my work (and my manager) has allowed me to work from home on most of the strike days so far.</p>
<p>I was a little worried about working from home. I wasn&#8217;t sure how productive I&#8217;d be. But as it turns out, I am more productive at home than I am in the office. Here is a quick pro and con list of my experience working from home so far:</p>
<p>Pros:</p>
<ul>
<li>I control the work environment (temperature, lighting, etc.)
<li>Quiet! I am all by myself all day (heaven for an introvert like me)
<li>More screen real-estate. At the office I have dual 17&#8243; monitors (both @ 1280&#215;1024). At home I am using a laptop (@ 1600&#215;1050), plus the laptop is hooked into my 2nd monitor via the KVM (@ 1280&#215;1024) PLUS I have my 24&#8243; monitor (@ 1920&#215;1200) connected to my home PC, which I can use for web browsing, media, etc). That&#8217;s over 5 million pixels in all!
<li>Quiet! I can get focused and stay focused (again, for an introvert, getting focused, or getting back into focus, can be difficult)
<li>Lunch and snacks are closer, and cheaper.
<li>I have full access to the office network (via VPN) and my office PC&#8217;s hard drive.
<li>Better chair than the one in my office.
<li>I can play my music as loud as I want!</li>
</ul>
<p>Cons (both relatively easy to resolve):</p>
<ul>
<li>The laptop only has 1 GB of RAM!
<li><strike>I haven&#8217;t been able to get the laptop to share my mouse and keyboard (the mouse works, but it&#8217;s laggy. No wonder though: USB Mouse -&gt; USB to PS/2 adapter -&gt; KVM -&gt; KVM Cable -&gt; PS/2 to USB adapter -&gt; laptop)</strike>. <strong>Update</strong>: Resolved via laptop docking station borrowed from the office.</li>
</ul>
<p>Here&#8217;s my home office setup:</p>
<p align="center"><a href="http://annoyed.ca/wp-content/uploads/2008/12/windowslivewriterworkingfromhome-13043img-2150-2.jpg" target="" rel="lightbox[160]"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="250" alt="IMG_2150" src="http://annoyed.ca/wp-content/uploads/2008/12/windowslivewriterworkingfromhome-13043img-2150-thumb.jpg" width="326" border="0"></a> <a href="http://annoyed.ca/wp-content/uploads/2008/12/windowslivewriterworkingfromhome-13043img-2151-2.jpg" rel="lightbox[160]"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="250" alt="IMG_2151" src="http://annoyed.ca/wp-content/uploads/2008/12/windowslivewriterworkingfromhome-13043img-2151-thumb.jpg" width="327" border="0"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2008/12/17/working-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Investigating a .Net Web Application&#8217;s Performance Issues</title>
		<link>http://annoyed.ca/2008/11/08/investigating-a-net-web-applications-performance-issues/</link>
		<comments>http://annoyed.ca/2008/11/08/investigating-a-net-web-applications-performance-issues/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 03:28:26 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.ca/2008/11/08/investigating-a-net-web-applications-performance-issues/</guid>
		<description><![CDATA[Yesterday my boss and I meet with a group that has been having some significant performance issues with one of their web applications. It&#8217;s a basic .Net web forms application (in C#). Their issue was that they had one page &#8230; <a href="http://annoyed.ca/2008/11/08/investigating-a-net-web-applications-performance-issues/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday my boss and I meet with a group that has been having some significant performance issues with one of their web applications.</p>
<p>It&#8217;s a basic .Net web forms application (in C#). Their issue was that they had one page that was taking upwards of 75 seconds to load! Seriously. 75 seconds! They said they were using NHibernate and they had tracked the issue down to one method that was taking up the majority of those 75 seconds. They also said they had tried some direct database (Oracle) queries that returned MUCH faster than the NHibernate.</p>
<p>We suggested that they look at caching the results of the database queries and that they confirm exactly what queries NHibernate is making on their behalf (I think they assumed it would execute the same query they had tested directly, which may or may not be the case).</p>
<p>Now I am a fan of NHibernate, and I have done some things with it that resulted in less than stellar performance, but I&#8217;ve always found tweak things to near direct database performance levels without much effort by changing/correcting some basic assumptions I had about the data and model. So when I left the meeting I felt that NHibernate had unfairly been labelled as the source of the performance issues, so I decided to have a look at the code for myself.</p>
<p>After grabbing a local copy of the code from their source control repository, I ran the code in debug mode and quickly came to the conclusion that the method they had identified as taking a long time to execute was in fact really taking a long time to execute. So I had a closer look at that method, and here (essentially) is what I saw:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #008000">/* ... */</span>
IQuery query = CreateQuery(<span style="color: #006080">"SELECT ..."</span>);

<span style="color: #0000ff">for</span> (i = 0; i &lt; query.List().Count; i++)
{
    <span style="color: #0000ff">if</span> ((!((<span style="color: #0000ff">object</span>[])(<span style="color: #0000ff">new</span> ArrayList(query.List())[i]))[0] == <span style="color: #0000ff">null</span>)
       &amp;&amp; (!((<span style="color: #0000ff">object</span>[])(<span style="color: #0000ff">new</span> ArrayList(query.List())[i]))[2] == <span style="color: #0000ff">null</span>))
    {
        String <span style="color: #0000ff">value</span> = (((<span style="color: #0000ff">object</span>[])(<span style="color: #0000ff">new</span> ArrayList(query.List())))[2]).ToString();
    }
}
<span style="color: #008000">/* ... */</span></pre>
</div>
<p>I am &#8220;paraphrasing&#8221; a bit (the real code was worse).</p>
<p>The query.List() call returns an IList instance containing all the results of the SQL query. I don&#8217;t know if each call to query.List() actually executes the database query again (there may be some caching involved somewhere) but each call to query.List() did involve some database activity (according to my network sniffer). You notice that query.List is being called 3 times per loop (in the real code it was more like 6 times per loop)!</p>
<p>Changing this code to make one call to query.List, storing the results in a local IList variable and subsequently re-using that local variable shaved nearly 50 seconds of the response time.</p>
<p>On top of that there would also be improvements by removing the code that creates 3 ArrayLists per loop (again in the real code, 6 ArrayLists per loop), copies the IList of database results into each ArrayList, uses each of those ArrayLists to access only one single item and them discards the ArrayLists (only to recreate them again on the next loop).</p>
<p>NHibernate wasn&#8217;t the source of their problem&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2008/11/08/investigating-a-net-web-applications-performance-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Day Spent Refactoring Code</title>
		<link>http://annoyed.ca/2008/10/28/a-day-spent-refactoring-code/</link>
		<comments>http://annoyed.ca/2008/10/28/a-day-spent-refactoring-code/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 01:09:02 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.ca/2008/10/28/a-day-spent-refactoring-code/</guid>
		<description><![CDATA[I spent a good part of today refactoring some code I&#8217;ve inherited. It&#8217;s a VB.Net wrapper around some commercial address verification software. Two examples of the type of functionality the software provides are address correction and address formatting. Here is &#8230; <a href="http://annoyed.ca/2008/10/28/a-day-spent-refactoring-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent a good part of today refactoring some code I&#8217;ve inherited. It&#8217;s a VB.Net wrapper around some commercial address verification software. Two examples of the type of functionality the software provides are address correction and address formatting. </p>
<p>Here is a simplified version of three of the classes I was given to work with: Address, CorrectedAddress and FormattedAddress. An Address is what you would provide to the verification software and the other two classes would be returned from either the address correction or address formatting functionality.</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> Address
    <span style="color: #0000ff">Public</span> AddressLine <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> City <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> Province <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> PostalCode <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> Country <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> CorrectedAddress : <span style="color: #0000ff">Inherits</span> Address
    <span style="color: #0000ff">Public</span> Status <span style="color: #0000ff">As</span> CorrectedAddress.Status
    <span style="color: #0000ff">Public</span> Message <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>

    <span style="color: #0000ff">Public</span> <span style="color: #0000ff">Enum</span> Status
        Valid
        Invalid
        Corrected
        [<span style="color: #0000ff">Error</span>]
    <span style="color: #0000ff">End</span> <span style="color: #0000ff">Enum</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> FormattedAddress
    <span style="color: #0000ff">Public</span> AddressLineOne <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> AddressLineTwo <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> AddressLineThree <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>

    <span style="color: #0000ff">Public</span> Status <span style="color: #0000ff">As</span> FormattedAddress.Status
    <span style="color: #0000ff">Public</span> Message <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>

    <span style="color: #0000ff">Public</span> <span style="color: #0000ff">Enum</span> Status
        Valid
        Invalid
        [<span style="color: #0000ff">Error</span>]
    <span style="color: #0000ff">End</span> <span style="color: #0000ff">Enum</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<p>Note that CorrectedAddress inherits from Address, but FormattedAddress does not. Both CorrectedAddress and FormattedAddress have a Status and Message properties (implemented as public fields above only for brevity). The Status properties both return similar, but not identical enumerations. In the actual code there were six classes like these two, but I am focusing only on these two for simplicity.</p>
<p>The whole thing didn&#8217;t seem quite right to me, and I struggled a bit to put my finger on how this should have been implemented. But then it hit me. CorrectedAddress isn&#8217;t really an Address. It&#8217;s a result of an address correction (that happens to have an address). &#8220;Is A&#8221; versus &#8220;Has A&#8221;. Remember the oft quoted Object-Oriented design principle:</p>
<blockquote>
<p>Favour Composition over Inheritance</p>
</blockquote>
<p>So I pulled the Address class out of the inheritance hierarchy, renamed CorrectedAddress and FormattedAddress to CorrectedResult and FormattedResult respectively and even threw in some Generics stuff to deal with the similar but different Status enumerations.</p>
<p>The result (the Address class was left as-is):</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">MustInherit</span> <span style="color: #0000ff">Class</span> Result(Of T <span style="color: #0000ff">As</span> <span style="color: #0000ff">Structure</span>)
    <span style="color: #0000ff">Public</span> Status <span style="color: #0000ff">As</span> T
    <span style="color: #0000ff">Public</span> Message <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> CorrectedResult : <span style="color: #0000ff">Inherits</span> Result(Of CorrectedResultStatus)
    <span style="color: #0000ff">Public</span> Address <span style="color: #0000ff">As</span> Address

    <span style="color: #0000ff">Public</span> <span style="color: #0000ff">Enum</span> CorrectedResultStatus
        Valid
        Invalid
        Corrected
        [<span style="color: #0000ff">Error</span>]
    <span style="color: #0000ff">End</span> <span style="color: #0000ff">Enum</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">Public</span> <span style="color: #0000ff">Class</span> FormattedResult : <span style="color: #0000ff">Inherits</span> Result(Of FormattedResultStatus
    <span style="color: #0000ff">Public</span> AddressLineOne <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> AddressLineTwo <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>
    <span style="color: #0000ff">Public</span> AddressLineThree <span style="color: #0000ff">As</span> <span style="color: #0000ff">String</span>

    <span style="color: #0000ff">Public</span> <span style="color: #0000ff">Enum</span> FormattedResultStatus
        Valid
        Invalid
        [<span style="color: #0000ff">Error</span>]
    <span style="color: #0000ff">End</span> <span style="color: #0000ff">Enum</span>
<span style="color: #0000ff">End</span> Class</pre>
</div>
<p>Much better!</p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2008/10/28/a-day-spent-refactoring-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a hectic day at work&#8230;</title>
		<link>http://annoyed.ca/2007/05/10/a-hectic-day-at-work/</link>
		<comments>http://annoyed.ca/2007/05/10/a-hectic-day-at-work/#comments</comments>
		<pubDate>Fri, 11 May 2007 01:06:32 +0000</pubDate>
		<dc:creator>Christopher Hyne</dc:creator>
				<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://annoyed.marge.bluephyre.com/?p=6</guid>
		<description><![CDATA[&#8230;for everyone but me. I must have pissed lot of people off yesterday. I wasn&#8217;t included in anything today despite being the project&#8217;s senior programmer/analyst. The day just seemed to drag on&#8230;]]></description>
			<content:encoded><![CDATA[<p>&#8230;for everyone but me. I must have pissed lot of people off yesterday. I wasn&#8217;t included in anything today despite being the project&#8217;s senior programmer/analyst. The day just seemed to drag on&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://annoyed.ca/2007/05/10/a-hectic-day-at-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

