<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://martinparry.com/cs/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Martin Parry</title><link>http://martinparry.com/cs/blogs/mparry_software/default.aspx</link><description>It's Only Code</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.0 (Build: 60526.2668)</generator><item><title>Debugging FileNotFoundException</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/08/15/1322.aspx</link><pubDate>Fri, 15 Aug 2008 15:54:03 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1322</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1322.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1322</wfw:commentRss><description>&lt;p&gt;Recently in our app we were getting a System.IO.FileNotFoundException.&amp;nbsp; The trouble was, the exception detail didn't tell us what particular file was missing.&amp;nbsp; Our .NET app has a dependency on a COM DLL, which in turn has good, old-fashioned, dynamic-linkage dependencies on other DLLs.&lt;/p&gt; &lt;p&gt;Initially, I tried Process Monitor from sysinternals to log all filesystem access, but no joy there.&amp;nbsp; This clearly wasn't normal File I/O, it was a module load that was failing.&amp;nbsp; By the way, you can run those sysinternals utilities directly from &lt;a href="http://live.sysinternals.com"&gt;http://live.sysinternals.com&lt;/a&gt; now, which is handy.&lt;/p&gt; &lt;p&gt;There might be a simple way to resolve this problem, but I couldn't think of it, so I resorted to a fairly obscure method, involving WinDbg.&amp;nbsp; When I was at Microsoft we used to joke that Microsoft really has only one tool, and WinDbg is it.&amp;nbsp; You can do everything in there.&amp;nbsp; It's not easy to get started with it, but I do recommend persevering.&amp;nbsp; It's best if you work near someone that already knows it, and get them to show you.&lt;/p&gt; &lt;p&gt;I guessed that the failure was occurring in a call to LoadLibrary or LoadLibraryEx, so I wanted to put a breakpoint on those functions and look at the string that was passed in - the name of the module to load.&amp;nbsp; Here are the commands I entered into WinDbg...&lt;/p&gt; &lt;p&gt;&lt;font face="Consolas" size="2"&gt;bp kernel32!LoadLibraryW "r $t0 = ebp+8; r $t1 = @@c++( *((long *)@$t0 )); dc $t1 L64; g"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Consolas" size="2"&gt;bp kernel32!LoadLibraryExW "r $t0 = ebp+8; r $t1 = @@c++( *((long *)@$t0 )); dc $t1 L64; g"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;Each command sets a breakpoint in the relevant function, and defines a command to run when the debugger hits that breakpoint.&amp;nbsp; In each case I find a pointer to the first parameter (which is at ebp+8), then I dereference this pointer and dump out 64 characters found at that address.&amp;nbsp; The final "g" is to make the debugger automatically continue from the breakpoint.&lt;/p&gt; &lt;p&gt;What did this achieve?&amp;nbsp; Well, running the app in the debugger dumped out all the names of the modules that were loaded by these two functions.&amp;nbsp; When the FileNotFoundException was thrown, I just had to look at the most recent filename dumped out and that was the module that failed to load.&lt;/p&gt; &lt;p&gt;Almost done, but not quite.&amp;nbsp; The name I just found is of the module that couldn't be loaded, but it could be found alright.&amp;nbsp; Let's call it "banana.dll".&amp;nbsp; It couldn't be loaded because it had a dependency on another DLL that couldn't be found.&amp;nbsp; To find out what that might be, I did a "dumpbin /imports banana.dll".&amp;nbsp; That told me what DLLs are imported by banana.dll.&amp;nbsp; I just had to look through that list to find the one that was missing from my filesystem.&lt;/p&gt; &lt;p&gt;This is a case of "blogging for posterity" in case I ever need to do this again.&amp;nbsp; Hopefully others can benefit from it too, though :-)&lt;/p&gt; &lt;p&gt;Finally, I have to question the wisdom of using FileNotFoundException to represent module load failures.&amp;nbsp; No wonder the exception detail couldn't tell me which file was missing.&amp;nbsp; Perhaps there should be a separate exception class for this?&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1322" width="1" height="1"&gt;</description></item><item><title>On the Nature of Blogging</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/08/08/1321.aspx</link><pubDate>Fri, 08 Aug 2008 13:55:48 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1321</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1321.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1321</wfw:commentRss><description>&lt;p&gt;When I look at the viewing statistics for my blog I see that last month was the biggest month ever, in spite of the fact that I didn't post much, and that I was on holiday for half of the month.&amp;nbsp; Actually, there was quite a big increase compared with the previous month.&amp;nbsp; This leads me to suppose that blog stats can only ever go up.&lt;/p&gt; &lt;p&gt;When I worked at Microsoft, "the management" collected bloggers' stats each month.&amp;nbsp; In fact, it was a key metric that our performance was measured on, and one that I never excelled in.&amp;nbsp; I don't think I'm giving away any secrets there.&amp;nbsp; Sure, when you read a blog that's from a Microsoft employee you can probably expect that blogging is a part of his/her job that they're measured on, but that doesn't make the blog less valuable.&amp;nbsp; Although there are a few worthless ones :-)&lt;/p&gt; &lt;p&gt;In general I think bloggers are seen as people donating their knowledge out of a spirit of generosity, and for a great many that is so, but you should always keep in mind that quite a few blogs are created and maintained just because the boss says so.&lt;/p&gt; &lt;p&gt;I'm sure other technology companies encourage blogging among their staff too.&amp;nbsp; This is not a "Microsoft is evil" post. Blogging has become a very important marketing channel for technology companies.&lt;/p&gt; &lt;p&gt;The good news is that most bloggers who do well at achieving high stats do so because their content is high quality and they keep it coming at a prodigious rate, whether or not their boss is keeping score.&amp;nbsp; But I must say I have known a couple of blogs that managed to achieve high numbers without seeming (to me) very worthwhile.&amp;nbsp; There are all kinds of tricks a wise blogger can carry out that will hugely inflate their stats, more quickly than generating a lot of useful content that a lot of people want.&amp;nbsp; Unfortunately, many employers can't see beyond the raw numbers.&amp;nbsp; Quantity beats quality every time.&lt;/p&gt; &lt;p&gt;When you're reading blogs, why not see if you can tell whether the blogger is playing a numbers game...?&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1321" width="1" height="1"&gt;</description></item><item><title>Visual Studio and Stability</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/07/09/1318.aspx</link><pubDate>Wed, 09 Jul 2008 11:33:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1318</guid><dc:creator>martin</dc:creator><slash:comments>1</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1318.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1318</wfw:commentRss><description>&lt;P&gt;I was just reading the lastest &lt;A href="http://msdn.microsoft.com/en-gb/flash/default.aspx"&gt;MSDN UK Flash&lt;/A&gt; newsletter, and was very interested in the survey results.&amp;nbsp; For the uninitiated, each issue of the Flash contains a survey that readers can respond to.&amp;nbsp; In the next issue, they show the results of that survey.&amp;nbsp; The most recent survey question was "What would interest you most around new versions of Visual Studio?" and the largest response (34%) was for "Stability, Reliability, Performance".&amp;nbsp; I find this quite surprising.&lt;/P&gt;
&lt;P&gt;In the 8 years I worked at Microsoft, I went through several versions of Visual Studio, including pre-release builds a lot of the time, and I must say I always found its stability and reliability pretty good.&amp;nbsp; Performance was never a problem for me either.&amp;nbsp; This was also true in my life before Microsoft.&lt;/P&gt;
&lt;P&gt;But in all those roles I actually installed Visual Studio myself, from a disc or from the network using Microsoft's supplied setup.exe.&amp;nbsp; In addition, I never had cause to install any non-Microsoft add-in for Visual Studio.&lt;/P&gt;
&lt;P&gt;Recently I've been using Visual Studio on a machine managed by a customer of mine.&amp;nbsp; They use a 3rd-party packaging system to deploy everything to their managed desktops.&amp;nbsp; I don't know the details of how this works, but I'm guessing that it's some kind of registry/filesystem snapshot.&lt;/P&gt;
&lt;P&gt;It's clear to anyone that's installed Visual Studio from a disc that the process is considerably more complex that dumping stuff straight into the registry and the filesystem.&amp;nbsp; Maybe it shouldn't be - I could happily support that view - but it's clear that it is more complex than that.&amp;nbsp; Otherwise why on earth would it take so long, and why would it display messages like "generating scripts"...?&lt;/P&gt;
&lt;P&gt;So if we accept that VS is somehow "hard to install" we should probably believe that any 3rd-party packaging tool is unlikely to deduce all the correct logic to use when installing VS.&amp;nbsp; In fact, I find VS decidedly less stable on this managed desktop than I've ever found it to be in the past, on systems where I used Microsoft's setup.exe.&lt;/P&gt;
&lt;P&gt;Also, this managed desktop has several add-ins for VS installed.&amp;nbsp; Occasionally VS has crashed and I've caught it in WinDbg, so I know it was at least one of the add-ins that caused the problem.&amp;nbsp; I guess that VS has become a platform in its own right and people are blaming it for faults in components that they've installed&amp;nbsp;on top.&lt;/P&gt;
&lt;P&gt;Microsoft used to get the blame for all blue screens in Windows&amp;nbsp;but I think these days most users realise that it's more likely to be a 3rd-party device driver at fault.&amp;nbsp; Microsoft had to educate its customers by capturing data about their software failures and publishing data about the results.&amp;nbsp; Kind of like "naming and shaming" except I don't think they ever published the names of the culprits.&lt;/P&gt;
&lt;P&gt;I wonder how many of the survey respondents were using some "odd" deployment tool, or some 3rd-party add-in.&amp;nbsp; Did they think about whose code was running when they experienced those stability issues?&lt;/P&gt;
&lt;P&gt;So this survey result makes me think that perhaps the most useful features in future versions of VS would be to capture and publish data about which add-ins are crashing it, and to simplify the setup to the extent that a simple registry/filesystem snapshot is all you need to deploy it reliably.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1318" width="1" height="1"&gt;</description></item><item><title>Herding Sheep</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/24/1316.aspx</link><pubDate>Tue, 24 Jun 2008 17:32:33 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1316</guid><dc:creator>martin</dc:creator><slash:comments>1</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1316.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1316</wfw:commentRss><description>&lt;p&gt;One of the things I find most interesting about software development is the people who do it.&amp;nbsp; I think you can spot personality traits by reading people's code :-)&amp;nbsp; A few years ago, I was introduced to the &lt;a href="http://www.myersbriggs.org/"&gt;Myers-Briggs Type Indicator&lt;/a&gt;, and I was interested that it seems to categorize people according to 4 axes.&amp;nbsp; I was a little dismissive of it at the time because, of course, a personality is more than 4-dimensional.&amp;nbsp; But as time has passed, and I've met more software developers, and read more of their code, I've started to realize that there are common traits, and there probably are ways to categorize developers.&lt;/p&gt; &lt;p&gt;I should say, this is just idle chat.&amp;nbsp; I am not suggesting that there's anything useful to be gained from this sort of analysis.&amp;nbsp; I just find it interesting.&amp;nbsp; In particular, I don't much care for the idea that an employer might try to assemble a team based on different &lt;em&gt;types&lt;/em&gt;.&amp;nbsp; But some days, a difference between types of developer hits me right between the eyes, and today is one such day.&lt;/p&gt; &lt;p&gt;Have you ever read some code and found a comment like "was getting unexpected exceptions here, but with this Sleep(500) it works ok".&amp;nbsp; To my mind, the person who wrote this didn't feel &lt;em&gt;in control&lt;/em&gt; of the machine.&amp;nbsp; It's like "&lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/One_man_and_his_dog"&gt;one man and his dog&lt;/a&gt;&lt;/em&gt;".&amp;nbsp; I mean, the shepherd and his dog might consider themselves to be in control, but in reality the sheep have brains too.&amp;nbsp; Ultimately it's their decision whether they walk into the little pen.&amp;nbsp; I guess their thought process is something like "I might as well go where he wants, otherwise it's another 15 mins of being chased around the hillside".&lt;/p&gt; &lt;p&gt;But computers are even more stupid than sheep.&amp;nbsp; You can try to coax it into doing what you want with little things like Sleep(500), but it has no concept of "you've been debugging me for hours now, I'll just give in".&amp;nbsp; So coaxing and goading a computer into doing what you want is not an effective approach.&amp;nbsp; You need to grab hold of it and make it do your bidding.&amp;nbsp; Instead of the Sleep(500), when the exception happens, debug it.&amp;nbsp; Find out exactly what's happening and then stop it happening.&amp;nbsp; Master the machine.&lt;/p&gt; &lt;p&gt;So some developers are masters of the machine, while some are shepherds.&amp;nbsp; In truth, I don't think it's a binary choice, it's more like a spectrum; master at one end, shepherd at the other.&amp;nbsp; So...&lt;/p&gt; &lt;p&gt;M &amp;lt;------|------&amp;gt; S&lt;/p&gt; &lt;p&gt;...whereabouts would you put yourself on that spectrum?&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1316" width="1" height="1"&gt;</description></item><item><title>SQL 2008 and SQL Compact 3.5</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/20/1315.aspx</link><pubDate>Fri, 20 Jun 2008 12:33:17 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1315</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1315.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1315</wfw:commentRss><description>&lt;p&gt;I've been using &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx"&gt;SQL Server Compact Edition v3.5&lt;/a&gt; for a little while now, and while the database engine has performed faultlessly so far, the same cannot be said of the management tool that's built into VS2008.&amp;nbsp; Perhaps that has improved with SP1 of VS2008, I haven't checked yet.&lt;/p&gt; &lt;p&gt;Today, I downloaded the &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/trial-software.aspx"&gt;release candidate of SQL Server 2008&lt;/a&gt;, just to get the management tools and see if I can connect to my SQLCE3.5 database from there.&amp;nbsp; I can, and it seems to work well.&amp;nbsp; I must say that I haven't spent long working with it yet, but it's great to have access to some of the features I'm familiar with from "normal" SQL Server, such as a graphical view of the execution plan.&lt;/p&gt; &lt;p&gt;Of course, it's still a release candidate.&amp;nbsp; My early optimism might soon wear off :-)&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1315" width="1" height="1"&gt;</description></item><item><title>DesignMode in Windows Forms control development</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/17/1314.aspx</link><pubDate>Tue, 17 Jun 2008 13:21:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1314</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1314.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1314</wfw:commentRss><description>&lt;P&gt;I'm currently working on an app that has to run on v2.0 of the .NET platform (with no SP applied).&amp;nbsp; The particular behaviour I'm talking about may have changed in more recent versions - I haven't had time to check - but I was struck by something and just had to write about it.&lt;/P&gt;
&lt;P&gt;When you're working on a UserControl, Visual Studio sets the value of a property &lt;EM&gt;DesignMode&lt;/EM&gt; to true whenever it loads your control into the visual designer.&amp;nbsp; This allows you to ensure that any code that depends on runtime artifacts doesn't run in the designer.&amp;nbsp; But if you search, you'll find lots of folks bemoaning the fact that &lt;EM&gt;DesignMode&lt;/EM&gt; isn't set before&amp;nbsp;the constructor of your control runs.&amp;nbsp; Again, maybe this has changed, I should check...&lt;/P&gt;
&lt;P&gt;That means you have a problem if code in your constructor depends on constructs that are only available at runtime.&amp;nbsp; There are a number of workarounds posted on the web, but none of them struck me as very nice, and some just didn't work for me.&amp;nbsp; So I did the "obvious" workaround.&amp;nbsp; I took the code that couldn't run in the designer, moved it out of my constructor and into a separate function, and did a check for &lt;EM&gt;DesignMode&lt;/EM&gt; there.&amp;nbsp; It works fine.&lt;/P&gt;
&lt;P&gt;Now my control has a simpler constructor.&amp;nbsp; It just initialises fields with values that are always the same.&amp;nbsp; All the logic that calls into other parts of the app has been moved into my new function.&amp;nbsp; I feel that my control is somehow "less-coupled" to other parts of the app now that I can construct it without those things being there.&amp;nbsp; It feels more correct.&lt;/P&gt;
&lt;P&gt;What's the catch?&amp;nbsp; Well, something has to call my new function.&amp;nbsp; That could be the code that instantiates my control, or I could call it from my own control's Load event handler, or from some other event handler inside my control.&amp;nbsp; In my case, I chose to let the calling code do it.&amp;nbsp; it worked fine but I still walked away thinking I'd made my codebase more complex to workaround an "issue" in VS2005.&lt;/P&gt;
&lt;P&gt;But today I was doing further development against my control.&amp;nbsp; It struck me that the additional function I introduced has actually allowed me greater freedom in the way I initialize the control and has actually &lt;EM&gt;simplified&lt;/EM&gt; my codebase in the end.&amp;nbsp; The feeling of correctness I got from refactoring the constructor was borne out in my ability to reuse this control in ways I didn't anticipate.&lt;/P&gt;
&lt;P&gt;There's a lesson in that.&amp;nbsp;&amp;nbsp;You might feel coerced into writing code a certain way, just to workaround a quirk in your tools or platform, but that doesn't mean the workaround is actually worse than what you originally intended.&amp;nbsp; It could be better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1314" width="1" height="1"&gt;</description></item><item><title>The Campaign Against .NET Obfuscation</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/13/1313.aspx</link><pubDate>Fri, 13 Jun 2008 12:27:53 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1313</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1313.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1313</wfw:commentRss><description>&lt;p&gt;I've started a one-man campaign. In fact I started it years ago when .NET obfuscation first appeared. I don't like any of the .NET obfuscation technologies. I don't think obfuscation is worth bothering with, and it makes the developer's life just a little bit harder. So don't do it.  &lt;p&gt;Think about it...  &lt;p&gt;1. Obfuscation is not encryption. That's really important.  &lt;p&gt;2. People being able to see your code is not a bad thing most of the time.  &lt;p&gt;3. If you have a case where it's really necessary to hide your code then, by definition, obfuscation isn't good enough. You need to encrypt that really sensitive piece of code, perhaps using something like Microsoft's &lt;a href="http://www.microsoft.com/slps/default.aspx"&gt;SLPS&lt;/a&gt;.&amp;nbsp; Even then, only encrypt the sensitive stuff, not the whole app.  &lt;p&gt;4. .NET didn't change anything. Native code is not encrypted either. If someone can benefit from reverse-engineering your code, they are just as likely to do that to a native-code app as for a .NET app.  &lt;p&gt;5. Obfuscation might deter the very casual observer, but how many casual observers fire up ildasm or Reflector? Honestly? And how much harm do you think casual observers will do to your business?  &lt;p&gt;6. The ability to run ildasm and Reflector over my code is very useful to me, and makes me more productive.  &lt;p&gt;7. Obfuscation might give your company a feeling of protection that it really doesn't offer.  &lt;p&gt;8. No matter what the obfuscation-tool vendors do, the debug process is always slightly more complicated for an obfuscated app. If there was some value in obfuscating, this might be ok. But there just isn't.&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1313" width="1" height="1"&gt;</description></item><item><title>Why I Don't Use Windows Forms DataBinding</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/13/1312.aspx</link><pubDate>Fri, 13 Jun 2008 12:25:20 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1312</guid><dc:creator>martin</dc:creator><slash:comments>1</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1312.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1312</wfw:commentRss><description>&lt;p&gt;I have two reasons to eschew Windows Forms databinding. Complexity and Performance. As is usually the case, these two are related. You see, Microsoft designed databinding to accommodate a wide variety of controls, and an equally wide variety of datastructures. Because they couldn't predict exactly what we'd build, they designed a very flexible framework. But flexible often means complex, and slow, and in my opinion both are true here.  &lt;p&gt;Controls and datastructures that are built into the .NET Framework typically "just work" when you bind them to each other. At least, that's been my experience. I think the same is true when you use controls that are supplied by any competent vendor. But if you try to create your own controls and datastructures and bind them together using Windows Forms databinding, you might find things get rather difficult.  &lt;p&gt;As I've said before, &lt;a href="http://martinparry.com/cs/blogs/mparry_software/archive/2008/05/15/1308.aspx"&gt;don't use a tool if you don't understand what it does&lt;/a&gt;, and to fully understand Windows Forms databinding takes quite a bit of work.  &lt;p&gt;Let's say you build a form and bind that to some complex datastructure of your own. First you have to understand databinding well enough to make it work as expected. Remember, you'll create the associations between controls on your form and data items in your datastructure, but the exact moment that values get copied backwards and forwards is not under your control. That single fact makes your code hard to maintain, in my opinion. Anyone trying to modify your form or your datastructure needs to fully understand databinding in order to know that it will continue to work as expected. And if at some point the binding isn't working as expected, someone will have to fully understand databinding in order to figure out where it's going wrong. Before you know it, everyone in the team has to understand databinding.  &lt;p&gt;What's wrong with that? Well, surely to goodness the whole point of abstracting relationships between controls and data is to simplify. If everyone has to go and learn a somewhat complicated body of code in order to maintain your app, that simplification goal has gone awry.  &lt;p&gt;Remember, Microsoft built databinding because they didn't know what types of controls, and what types of datastructure, we were going to create. To bind our controls to their data, or their controls to our data, we can use databinding. When we own the controls and the datastructures, we just don't need a flexible binding framework that can bind anything-to-anything. We can actually write obvious code that works intuitively to copy values from A to B. That might mean more lines of source code in our app, but it's a lot fewer lines of code being executed at runtime, and it's a lot more straightforward to maintain.  &lt;p&gt;Ok, that's the complexity issue dealt with. I just want to say a little about performance. I accept that for most desktop apps Windows Forms databinding performs perfectly adequately. I happen to work on an app that's unusual in that, at times, it needs to update a lot of data on the screen very rapidly. I mean, much quicker than a human being can actually absorb. But we can't predict which value the user will want to look at, and when they look at it, it's got to be a very recent value. I mean, certainly no more than 100ms stale. If you know how Windows Forms databinding works, you'll know it doesn't lend itself to updating a lot of data that rapidly. This isn't a criticism of databinding, but it's worth knowing. I guess it wasn't designed to do this.  &lt;p&gt;Because databinding towards the control is triggered from a property change in the underlying datastructure, any such change has to happen on the UI thread. You know you can't modify controls from some background thread. But when you're getting a lot of updates, you really need to minimize the work being done on your UI thread. I mean, it should really just be painting the screen and nothing else. I don't want to be managing my datastructure on the UI thread, rebuilding indexes and so forth. I want that to happen on another thread, then my UI thread can simply ask 10 times per second "what value should I draw here?". . And I certainly don't want to be creating objects to describe the property that just changed, simply to communicate that change to my control in a totally extensible and flexible way. I know what my datatypes are and I don't want to see source code that passes around property names as strings. That stuff just gives me the colliwobbles.  &lt;p&gt;So there are two reasons why I'd rather not use Windows Forms databinding in my current project. The performance reason probably doesn't matter for most apps, and perhaps not for certain parts of my own app. The complexity reason on the other hand, well, that's the big one.&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1312" width="1" height="1"&gt;</description></item><item><title>Simplicity in Software</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/06/13/1311.aspx</link><pubDate>Fri, 13 Jun 2008 12:21:20 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1311</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1311.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1311</wfw:commentRss><description>&lt;p&gt;I think most of us developers would agree that keeping our software as simple as possible is a noble aim. I guess there are some developers who like to make things unnecessarily complex, but I for one hope not to spend too much of my life maintaining their code. I'm sure that no reader of my blog would fall into that category. No, we're talking about "other people" now.  &lt;p&gt;Anyway, simplicity. What does that actually mean? I can think of a few definitions; I'm sure there are others...  &lt;p&gt;1. Fewest possible lines in your source code.  &lt;p&gt;I'm sure we've all seen those pathological examples where a whole lot of meaning is crammed into a few characters. Normally these examples are in C although I've seen good ones in Ruby and Perl too.&amp;nbsp; So clearly simplest != fewest characters.  &lt;p&gt;No, these things are clearly not "simple" in any practical sense. But, to some extent at least, trying to minimize lines of source code is a good idea. If you can make things clearer by removing code, do so. If removing code makes things less clear, don't do it.  &lt;p&gt;2. Smallest amount of code overall.  &lt;p&gt;I'm not talking about highly-optimized code necessarily. You could write few lines of source code yourself, but behind those few lines could be millions of lines of library or API code. People maintaining your code are probably affected by the complexity of code that yours calls, so it might be a good idea to give some thought to the particular calls you make and just how complex those implementations are. Of course, that has other benefits too.  &lt;p&gt;3. Simplest logic.  &lt;p&gt;Trying not to have too many nested levels of if/else with complicated, inter-related condition clauses. That's probably a good idea.  &lt;p&gt;4. Most "obvious" code.  &lt;p&gt;Is it better to have more lines of code that clearly copies values from A to B, or is it better to use some data-binding API that allows you to set up relationships between A and B, without knowing exactly when the values get copied? Me, I prefer to be in control and I'd rather suffer a few more lines of code if their meaning is explicit. Actually, Windows Forms data-binding is currently out-of-favour with me. I'll write about why in a separate post I think.  &lt;p&gt;All my comments above assume that creating "simple" code is your top priority. In some cases other priorities come first and that's quite natural. Performance, security, or customisability could all lead to more complex code for example. But the goal of creating complex code for its own sake comes nowhere in the top-100 priorities of a software developer. If it's not already clear in your team, why not ask the person in charge to prioritize the various aspects that your system could exhibit...  &lt;p&gt;1. Performance&lt;br&gt;2. Correctness&lt;br&gt;3. Maintainability&lt;br&gt;4. Security&lt;br&gt;5. Scalability&lt;br&gt;6. etc. etc.  &lt;p&gt;...and assuming that Maintainability appears in their list, drill into that a bit further.&amp;nbsp; Do they want the code to be "simple"?&amp;nbsp; What do they mean by "simple"?&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1311" width="1" height="1"&gt;</description></item><item><title>Rant about &amp;quot;Quiet Carriages&amp;quot;</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/05/28/1310.aspx</link><pubDate>Wed, 28 May 2008 12:38:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1310</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1310.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1310</wfw:commentRss><description>&lt;P&gt;Moving away from my normal topic of software development, I just wanted to vent some annoyance about "Quiet Carriages".&amp;nbsp; On the rail service I use, the operator designates 2 of the 8 carriages in the train as "quiet".&amp;nbsp; They request that you don't use mobile phones or personal audio equipment in those carriages.&lt;/P&gt;
&lt;P&gt;Now, here's a non-exhaustive list of the things that other people can do to annoy you while on public transport, in no particular order...&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Hum or whistle a tune&lt;/LI&gt;
&lt;LI&gt;Sniff loudly and incessantly&lt;/LI&gt;
&lt;LI&gt;Clear the throat loudly and incessantly&lt;/LI&gt;
&lt;LI&gt;Laugh out loud for no apparent reason&lt;/LI&gt;
&lt;LI&gt;Rustle their newspaper&lt;/LI&gt;
&lt;LI&gt;Get up and walk around for no apparent reason&lt;/LI&gt;
&lt;LI&gt;Converse&amp;nbsp;on a mobile phone&lt;/LI&gt;
&lt;LI&gt;Converse with fellow passengers&lt;/LI&gt;
&lt;LI&gt;Make lots of beeps from their laptop computer&lt;/LI&gt;
&lt;LI&gt;Type loudly on their laptop computer&lt;/LI&gt;
&lt;LI&gt;Eat smelly food&lt;/LI&gt;
&lt;LI&gt;Suffer from unpleasant body-odour&lt;/LI&gt;
&lt;LI&gt;Sit next to you and take up too much room&lt;/LI&gt;
&lt;LI&gt;Listen to music through earphones that emit that "tickety-tick" noise&lt;/LI&gt;
&lt;LI&gt;Spread their things all over your table&lt;/LI&gt;
&lt;LI&gt;Tap hands or feet in time with some unheard music&lt;/LI&gt;
&lt;LI&gt;etc. etc.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I've certainly experienced all of these things on British trains, and it didn't take me long to produce that list.&lt;/P&gt;
&lt;P&gt;Why then would a train operator pick on just two of those &lt;EM&gt;potentially anti-social&lt;/EM&gt; activities and forbid them in 25% of every train?&amp;nbsp; I say &lt;EM&gt;potentially&lt;/EM&gt; because I've certainly seen people use mobile phones responsibly - in silent mode, keeping their voice down, keeping calls short - and I've sat next to people using personal audio equipment that emitted no external noise detectable to me.&lt;/P&gt;
&lt;P&gt;I've also seen a respectable-looking man run the length of a carriage to berate some unfortunate whose mobile phone rang &lt;EM&gt;in a quiet carriage&lt;/EM&gt;.&amp;nbsp; The poor guy didn't even answer his phone, he was just unlucky enough for it to ring, and he silenced it as quickly as he could.&amp;nbsp; The elder vigilante wore a maniacal expression as he leapt into action and exclaimed loudly "this is supposed to be a &lt;EM&gt;quiet&lt;/EM&gt; carriage".&amp;nbsp; Now, whose action was the more distracting for his fellow passengers?&amp;nbsp; In case you're wondering, the phone user wasn't me, but it might have been.&lt;/P&gt;
&lt;P&gt;I use these trains during peak times, and frankly you're lucky to get a seat at all.&amp;nbsp; For the train operator to suggest you have a choice of sitting in a quiet carriage or not is ridiculous.&amp;nbsp; They just make no sense to me at all.&amp;nbsp; I suppose most people of ticket-buying age can remember a time before mobiles, and before the walkman, so maybe this is an attempt to outlaw the new-fangled tools of distraction.&amp;nbsp; I think when our children are grown up the quiet carriage will be a thing of the past, remembered as a quaint curiosity like when all cars had to be preceded by a man waving a red flag.&lt;/P&gt;
&lt;P&gt;A lot of people either want or need to work while on a train, but surely most of those people work in open-plan offices?&amp;nbsp; I can't believe a train carriage is a more distracting environment than your average office.&amp;nbsp; Perhaps I'm lucky in that I'm able to switch-off from my environment, and so other people's phone calls don't distract me at all.&amp;nbsp; Even if they did I'd have to accept that my distraction was at least as much my fault as theirs.&lt;/P&gt;
&lt;P&gt;In the end, it's a sad commentary on our society that a train operator has to publish rules of politeness.&amp;nbsp; I would be happier though if the rules were about courtesy and respectfulness in general rather than singling-out specific devices, and if we're instructing people on courtesy we should give equal effort to encouraging tolerance.&amp;nbsp; It's a two-way street.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1310" width="1" height="1"&gt;</description></item><item><title>Consulting Nightmares: The Right Tool for the Job</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/05/15/1308.aspx</link><pubDate>Thu, 15 May 2008 07:21:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1308</guid><dc:creator>martin</dc:creator><slash:comments>1</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1308.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1308</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;If I was a builder, and there was a tool in my toolbox that I didn't understand, couldn't tell you what it was for, then I think that tool would stay in the box.&amp;nbsp; I wouldn't decide one day to get that tool out and start trying it out for jobs that I already knew how to do with other tools.&amp;nbsp; I might go out of my way to find out what it's for, of course, but until I knew, I wouldn't be trying to use it.&amp;nbsp; That's common sense I think.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Why then do we, as developers, often not apply the same logic to the "tools" at our disposal?&amp;nbsp; I've seen more cases of this than you might believe, but here's one that stands out because I saw it so many times...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Many years ago, I attended the offices of an ISV to spend 2 days training them on COM+.&amp;nbsp; I knew this ISV and I knew that they'd been using COM+ for at least 2 years.&amp;nbsp; It might therefore seem odd that they wanted training on it now, but "better late than never" I supposed.&amp;nbsp; I started by asking them some questions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Me: "You decided to use COM+ then?"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Them (eagerly): "Oh yes, it was a no-brainer for our app, we knew we needed it."&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Me: "Ok, who can start us off by telling me what COM+ is for?"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;EM&gt;...Silence...&lt;/EM&gt;&lt;BR&gt;Me: "Well, you must have had a reason for deciding to use it?"&lt;BR&gt;A lone voice from the audience volunteers: "Erm, transactions...?"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I can't be too hard on them.&amp;nbsp; I mean, I'm sure that distributed transactions are the reason why most COM+ users came to it.&amp;nbsp; It was a neat trick in its day.&amp;nbsp; But transactions are surely not the heart of COM+.&amp;nbsp; For me, it was all about the execution environment, the thread pool, the work queues, the ability to write STA components (in VB6 even) and have them run on a server.&amp;nbsp; Run quickly and reliably.&amp;nbsp; Whether they agreed with my answer to "what's it for?" is not the point.&amp;nbsp; The point is that they had made a clear decision to use a technology, without being able to explain what that technology is for.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I know people aren't machines, and applying too much logic to human behaviour never works, but there's a distinct lack of common sense here I think.&amp;nbsp; The reason I mention this stuff at all is that real software projects suffer and fail because of this sort of decision-making.&amp;nbsp; The builder analogy works again...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I can use a hammer to bang a screw into a piece of wood, if I hit it hard enough.&amp;nbsp; That doesn't mean a hammer was the right choice of tool.&amp;nbsp; Had I chosen the screwdriver, my life would have been easier, and the results would have been better.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Don't think that this issue is obsolete because I used an older technology as an example.&amp;nbsp; I still see it today.&amp;nbsp; You might also choose to blame the developer marketing people: if they keep trumpeting Silverlight loudly enough, some folks are sure to try and build a device driver with it.&amp;nbsp; I'm afraid it's our job as developers to see through the hype, and learn what all these tools are really for.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1308" width="1" height="1"&gt;</description></item><item><title>BOPS ?</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/05/14/1307.aspx</link><pubDate>Wed, 14 May 2008 17:21:49 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1307</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1307.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1307</wfw:commentRss><description>&lt;p&gt;Earlier, I was looking at &lt;a href="http://www.intel.com/cd/corporate/techtrends/emea/eng/366165.htm"&gt;this page&lt;/a&gt; about quad-core processors from Intel.&amp;nbsp; I know, I must have been bored :-)&lt;/p&gt; &lt;p&gt;Anyway, I spotted something interesting.&amp;nbsp; Towards the bottom of the page, they publish numbers of "Billions of Operations Per Second", and they claim 153,500 of those BOPS.&amp;nbsp; That's pretty impressive, I thought; over 150 trillion operations per second?&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.martinparry.com/cs/BlogPics/BOPS_101E9/bops.jpg"&gt;&lt;img height="159" alt="bops" src="http://www.martinparry.com/cs/BlogPics/BOPS_101E9/bops_thumb.jpg" width="260" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;I followed their "more details" link, and on the next page BOPS was defined as "Business Operations per Second".&amp;nbsp; That's a bit more believable :-)&lt;/p&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1307" width="1" height="1"&gt;</description></item><item><title>Consulting Nightmares: XML</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/05/13/1304.aspx</link><pubDate>Tue, 13 May 2008 07:09:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1304</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1304.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1304</wfw:commentRss><description>&lt;P&gt;In my consulting days, I had quite a few engagements where you might call me a performance&amp;nbsp;troubleshooter.&amp;nbsp; That is, the client had already built an app, in some cases it was even in the hands of users, but performance was unacceptably bad.&amp;nbsp; They turned to their platform vendor for help, and they got me.&lt;/P&gt;
&lt;P&gt;Performance is a feature, but it's an unusual one in that it can be present one day and so easily obliterated the next, sometimes by changing a single line of code.&amp;nbsp; One technology stands out in my memory as being misused more than any other, and creating performance problems along the way.&amp;nbsp; That technology is XML.&amp;nbsp; &lt;A href="http://www.codinghorror.com/blog/archives/001114.html"&gt;This post&lt;/A&gt; from Jeff Atwood prompted me to think about this stuff again.&lt;/P&gt;
&lt;P&gt;First, we should draw a distinction between the XML Infoset and the normal, textual encoding of XML that Jeff talks so eloquently about.&amp;nbsp; Sure, we all think about angle brackets at the mention of XML, but data structured using the XML Infoset can be encoded in much more efficient ways.&amp;nbsp; Note that WCF (in .NET v3.0 at least) uses XML to format all its messages, but can encode them in various different ways, so that performance can be just as good as Microsoft's older, binary, messaging formats.&amp;nbsp; So it's really the textual encoding of XML that gives performance problems, but until recently I think that's all we had.&amp;nbsp; Certainly I was never aware of tools on the Microsoft platform that did anything different.&lt;/P&gt;
&lt;P&gt;Problems usually arose when XML was used as a mechanism for carrying lumps of data between modules, subsystems, call them what you will.&amp;nbsp; Actually, let's think about that.&amp;nbsp; Quite apart from any performance implications, is XML an appropriate "bag" to shift data around - often between components that are sharing an address space?&amp;nbsp; Well, I'd never say "never", but it seems like an odd choice to me.&amp;nbsp; I think in many cases development teams grew tired of typed interfaces between components and thought how much easier life would be if they could pass an XML string.&amp;nbsp; You can put anything in there and it will still compile.&amp;nbsp; That's right: turn all your compile-time errors into runtime ones.&amp;nbsp; Smart move.&amp;nbsp; Going way back I remember ADO Recordsets being used for similar reasons.&amp;nbsp; Now, XML isn't necessarily untyped of course; we do have schema, but to do schema validation simply compounds the performance issues I'm mainly thinking about.&lt;/P&gt;
&lt;P&gt;I saw two uses of XML that gave performance problems.&amp;nbsp; One was where data was formatted as XML, with a textual encoding, into a string, then passed across some interface or other.&amp;nbsp; This process incurs CPU overheads to format, encode, decode, parse, etc. and it's also pretty likely that there are memory overheads associated with transferring data in this way.&amp;nbsp; I daresay though that plenty of systems out there work like this and manage to hit their performance goals.&lt;/P&gt;
&lt;P&gt;The other, more interesting, scenario was where XML document objects were used rather than strings.&amp;nbsp; I saw this done with msxml DOM objects and System.Xml.XmlDocument.&amp;nbsp; The performance in these cases was usually significantly worse than for simple strings, although that does presume the strings were parsed using SAX or the XmlTextReader or similar, rather than loaded into a document object.&amp;nbsp; The XML document objects are quite big, costly things.&amp;nbsp; They maintain indexes across the data they hold, and they have to store the data in&amp;nbsp;a way that allows them to easily&amp;nbsp;read/write the textual encoding.&amp;nbsp; Creating nodes in a document can typically only be done by making a call on a document object, so in some cases I saw people instantiating document objects simply to create nodes that could then be copied into other document objects.&amp;nbsp; Once I saw around 80 document object instantiations to formulate a single data item that would more naturally have been a graph of typed objects.&amp;nbsp; That's a lot of memory and a lot of CPU cycles.&lt;/P&gt;
&lt;P&gt;That leads me to a simple statement that became something of a golden rule for me.&amp;nbsp; If you're going to use a technology, understand it first.&amp;nbsp; In other words, know what it costs.&lt;/P&gt;
&lt;P&gt;It sounds so simple, but I'd say almost all the performance issues I ever saw could be traced back to a failure of this simple rule.&amp;nbsp; The people who built those XML-centric systems weren't fools: if they only knew the cost of what they were doing, they'd have done things differently.&lt;/P&gt;
&lt;P&gt;Today, I hope never to use code if I don't understand the tradeoffs involved.&amp;nbsp; Does&amp;nbsp;that mean I have to have source code for everything I use?&amp;nbsp; No, although I use Reflector quite a bit.&amp;nbsp; It also means that I experiment with alternatives.&amp;nbsp; I build simple standalone apps to try out different algorithms and understand where they're strong and where they're weak.&amp;nbsp; I've &lt;A HREF="/cs/blogs/mparry_software/archive/2008/04/24/1302.aspx"&gt;written before&lt;/A&gt; about "Big O" notation, and that's another big input for me when choosing data structures and algorithms.&lt;/P&gt;
&lt;P&gt;For a long time, at least one of my fellow consultants held the view that XML is evil and should be banned.&amp;nbsp; Of course, XML is a tool, and there are some jobs for which XML is the right tool.&amp;nbsp; I think XML is unusual because, for a while there, a lot of people thought XML was the right tool for &lt;EM&gt;every&lt;/EM&gt; job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1304" width="1" height="1"&gt;</description></item><item><title>The Big O</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/04/24/1302.aspx</link><pubDate>Thu, 24 Apr 2008 19:48:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1302</guid><dc:creator>martin</dc:creator><slash:comments>1</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1302.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1302</wfw:commentRss><description>&lt;P&gt;No, this isn't a post about Roy Orbison :-)&lt;/P&gt;
&lt;P&gt;I consider myself lucky to have had what you might call a classical education in software.&amp;nbsp; I mean, I was taught about principles rather than specific technologies.&amp;nbsp; That means I was exposed to lambda-calculus, finite automata, turing machines, etc., rather than Visual Basic, for example.&lt;/P&gt;
&lt;P&gt;I believe industry &lt;EM&gt;wants&lt;/EM&gt; graduates to have been grounded in current programming technologies, but industry is wrong to want that.&amp;nbsp; What industry &lt;EM&gt;needs&lt;/EM&gt; is graduates whose skills are deeper than the flavour-of-the-month technology at the time of their graduation.&lt;/P&gt;
&lt;P&gt;No offence if you belong to the newer school, by the way.&amp;nbsp; Software development is a broad church, and all that.&lt;/P&gt;
&lt;P&gt;Anyway, now to the point.&amp;nbsp; One of the areas I studied was something called "Algorithmics", including algorithmic complexity.&amp;nbsp; As part of this I was introduced to &lt;EM&gt;asymptotic notiation&lt;/EM&gt;, or "Big O" notation.&amp;nbsp; If you don't know it, Wikipedia has a pretty good introduction &lt;A href="http://en.wikipedia.org/wiki/Big_O_notation"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;My recent work has been focused on efficiently caching large numbers of objects in memory and indexing them in various different ways.&amp;nbsp; I'm using C#.&amp;nbsp; What's great is that the MSDN online documentation for the various collection types in the .NET Framework includes a description of the algorithmic complexity of the various operations.&amp;nbsp; For example, it might state that insertion in a given collection takes &lt;EM&gt;O(log n)&lt;/EM&gt; time, for collection size n.&amp;nbsp; This knowledge is invaluable when trying to choose the right datastructure for the job.&amp;nbsp; If performance is at all relevant to your work, I heartily recommend getting a thorough understanding of algorithmic complexity and "Big O" notation.&amp;nbsp; Not only will you find MSDN documentation more useful, but it'll give you a valuable new way to think about your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1302" width="1" height="1"&gt;</description></item><item><title>Accommodating your Platform - OO Theorist vs. Windows Pragmatist</title><link>http://martinparry.com/cs/blogs/mparry_software/archive/2008/04/23/1301.aspx</link><pubDate>Wed, 23 Apr 2008 16:12:00 GMT</pubDate><guid isPermaLink="false">a9cd9e7a-c797-4030-9c9b-e4e1cca795eb:1301</guid><dc:creator>martin</dc:creator><slash:comments>0</slash:comments><comments>http://martinparry.com/cs/blogs/mparry_software/comments/1301.aspx</comments><wfw:commentRss>http://martinparry.com/cs/blogs/mparry_software/commentrss.aspx?PostID=1301</wfw:commentRss><description>&lt;P&gt;In my years at Microsoft, I spent a lot of time in the performance and scalability lab, helping developers to achieve the maximum amounts of performance and concurrency in their applications.&amp;nbsp; Because of all that experience, for me, it's a no-brainer that to make software systems work well you have to depart from your elegant OO-design at some point and start accommodating the specifics of your chosen implementation platform.&amp;nbsp; I don't think this is obvious to everybody.&lt;/P&gt;
&lt;P&gt;As a consultant, I've encountered some excellent OO designers and software architects who created OO models of their systems.&amp;nbsp; Those models might well have been perfect in every way.&amp;nbsp; Nevertheless, none of the mainstream platform vendors has yet perfected a way to execute those object models in ways that would be useful to our customers.&amp;nbsp; Why is that?&amp;nbsp; Because it's hard.&amp;nbsp; Why is it hard?&amp;nbsp; Because turning an OO model into code that will actually work &lt;EM&gt;well&lt;/EM&gt; on a given platform depends on a highly-involved, intellectually-challenging process that developers carry out on a daily basis.&amp;nbsp; Not to mention that it depends on information most people don't put into OO models, such as "where is performance most important: looking up the customer, or saving the customer's details?"&lt;/P&gt;
&lt;P&gt;So I'd contend that the meaty part of a developer's job is actually figuring out how to make something work &lt;EM&gt;well&lt;/EM&gt; on their chosen platform.&amp;nbsp; OO models are an excellent piece of documentation that enable teams to share one view of their system.&amp;nbsp; I'm all in favour of that, and there are other views of their system that developers could usefully share too.&lt;/P&gt;
&lt;P&gt;You can look upon this as having to "spoil" a clean, elegant, model.&amp;nbsp; But I could also say that a clean, elegant, model "spoils" a finished application if it doesn't work very well on your chosen platform.&amp;nbsp; In most cases, the customer pays for the app, not the model.&lt;/P&gt;
&lt;P&gt;I remember working with COM+, and MTS before it, where the platform dictated that you factored your code into COM objects based on their transactional requirements.&amp;nbsp; Now, you could make those objects the same as the ones in your OO model, but if you did, performance would suck.&amp;nbsp; Doing it &lt;EM&gt;well&lt;/EM&gt; meant accepting that object factorization had real meaning to those platforms, and working &lt;EM&gt;with&lt;/EM&gt; the platform instead of against it.&amp;nbsp; The .NET platform is rather more forgiving.&amp;nbsp; These days I don't think there are many sacrifices that have to be made to accommodate the platform, but I'm sure there are still some.&lt;/P&gt;
&lt;P&gt;And it's not just about accommodating the platform.&amp;nbsp; What about accommodating your team?&amp;nbsp; You might very well choose to "spoil" your model so as to factorize the system in such a way that a team of people, maybe geographically dispersed, can efficiently collaborate on its development.&lt;/P&gt;
&lt;P&gt;Developers have long been aware of the perils of a project plan.&amp;nbsp; We've all worked for project managers that print out the plan and say "this is the truth, anything else is your mistake".&amp;nbsp; In reality of course, the truth is what's in your version control system, and the plan is history as soon as it's been printed.&amp;nbsp; That's not to say plans aren't useful.&amp;nbsp; Clearly they are very useful, as a statement of where the team thinks it's heading.&lt;/P&gt;
&lt;P&gt;I believe that OO design diagrams are very similar.&amp;nbsp; Enormously useful as a shared vision of where the project's going.&amp;nbsp; But probably inaccurate shortly after they've been distributed.&amp;nbsp; The big difference is that project managers usually rehash the plan to accommodate new knowledge about the project, such as a specific task taking longer than expected.&amp;nbsp; Designers seldom go back and change design diagrams to reflect code that's already been written.&lt;/P&gt;
&lt;P&gt;This post is longer than I expected.&amp;nbsp; I suppose it's turned into a treatise on the place and purpose of OO modeling in modern software development. &lt;img src="/cs/emoticons/emotion-1.gif" alt="Smile" /&gt;&lt;/P&gt;&lt;img src="http://martinparry.com/cs/aggbug.aspx?PostID=1301" width="1" height="1"&gt;</description></item></channel></rss>