Archive Of Blog Entries (2009)
secretGeek .:dotnuts about dotnet:.
home .: about .: sign up .: sitemap .: secretGeek RSS

Archive of Blog Entries

blog entries from January to December 2009

Fri, 11 Dec 2009 08:56:14 GMT

The new prisoner's dilemma

A complete stranger who I have never met in my life sent me this little piece today, entitled:

The new prisoner's dilemma

rockin out in jail, computer free

Assuming you're paid X per day on your current project, what multiplier of X would you have to be paid to voluntarily go to prison?

So instead of a 3 month project you do 3 months in stir, for example.

Assume in prison you are unable to see your loved ones, your freedom to do what you want when you want is curtailed, choice of food etc is reduced.

Unlike real prison let's say you're protected from forcible sodomy.

Before deciding on the exact value of X that would suit you, consider the following facts:

There's no internet access of any kind. This means you'll almost never have to worry about cross browser incompatibilities or CSS positioning.

There are no meetings in prison. None. Parole hearings, maybe, but even those are avoidable if you spend enough time in solitary.

What value of X would it take for you to accept?

Naturally the multiplier does not have to be greater than 1.

Read On...


Wed, 09 Dec 2009 08:22:31 GMT

Original Premise for a road movie

I woke up, feverish at 2 AM last night and typed this out. Here goes.

Original Premise for a road movie

Our hero is a nerdy kid, a computer lover. And he's also a fan of a particular rock band.

At 2 AM one morning the kid, our nerd hero, discovers that his favourite band's web domain has expired!

He springs into action and snaps it up -- he becomes the owner of www.WhateverTheBandIs.com -- and writes to them and tells them what happened.

Far from grateful, the band are furious! They demand it back.

Kid responds: he'll only give it back if they make him an official member of the band and take him on tour.

The band talk to their lawyer, it goes like this:

Lawyer: Well, technically the kid hasn't broken any laws. The only state this is a crime in would be (insert state name here). So if you can think of a way to get the kid to that state, then you could have him arrested.

Band: Our tour finishes in [that state].

Lawyer: So take him on tour. Get him to [state name] and arrest the little f*cker.

And that's the premise. Nerdy kid's on tour with a rockband, he tunes their guitars for them, fixes their computers, meets a girl, and is destined to be arrested.

It practically writes itself.

I've done the hard part. Now the rest is up to you.

Note that 'the kid' could instead be an overweight 48 year old bachelor. And 'the rock band' could be an all-girl Japanese rap group. Just sayin.

(Added benefit: changes like that would make me less likely to be sued by Cameron 'Almost Famous' Crowe)

Research needed: do bands actually value their webdomain so much that they'd pretend to have a kid join their band then arrest him?

Way more awesome variation: same story, except the domain that has expired is NASA. Kid snaps it up, tells NASA he wants *in* on the upcoming journey to Mars. NASA look into it and realise that it's the only way to save face, so they reluctantly agree, plus taking a kid top-side is good for publicity. What happens next? This sucker writes itself! So don't just stand there, lick yer pencil and start scribblin.

(Sorry for bleeping the swear word above, [F*cker that is] but this is a family-friendly blog. And sorry for swearing in the first place, but, well, I think we all know that lawyer's are a potty-mouthed bunch of f*ckers)

Read On...


Fri, 04 Dec 2009 07:51:16 GMT

What's a better game than Devshop?

I was away from work, sick, on Wednesday and Thursday this week. Today, Friday, I was well enough to work from home -- but not come into the office.

Working from home was interesting. I setup my usual task board, and tore through the actions.

taskboard by 10 am becomes taskboard by 4pm

Still I missed the physical reality of the office environment. I asked my colleagues what was going on, and they sent through some very enlightening screenshots.

It seems they'd been playing a game even more awesome than DevShop.

Cubicle Attack!

The First Person Shooter in a Peaceful Office Setting.

mike attacks with foamy hot latte becomes the steve strikes back -- the stapler incident
> p1 brandishes foamy hot latte.
> p1 attacks p2.
> p1 misses.
> p2 brandishes blue stapler.
> p2 attacks p1.
> HIT!
> p2 wins.
Play again y/n?|

Which leads me to side with Wally on a possible reason why working from home is so much more productive than going into the office:

my cubicle is surrounded by idiots who make it impossible to work

Ah, 'tis true. But I'll be there Monday.

Read On...


Sun, 29 Nov 2009 10:03:28 GMT

DevShop: The Cool Game that Makes Development Look Fun

sallys spa, you push customers around and upgrade equipment

Despite my earlier protests about the damn thing, I went and bought a bloody iphone.

And on this new device (with which I am utterly utterly obsessed) I've been playing a bunch of games, and hence, have been thinking about inventing new games of my own.

Now one of the most intriguing games I've played is 'Sally's Spa' (pictured at right) from Game's Cafe.

It's a kind of 'lemonade stand' game, tailored around running a day spa, with a few interesting little details.

I played an intense session of this on the way to work one day last week, so when I arrived I was still in a game-trance and couldn't help but see my life as an 'extended bonus round' of Sally's Spa.

an angry mole, actually a failing automated test, annoyed to have been plucked from his burrow to arrive in my subconscious mind when he least expected it

At the 'daily team standup' we were throwing the over-inflated tennis ball around, in a mesmerising, slightly trippy dance, then later the 'build chicken' flew past me, and i saw the automated test failures popping up like members of a cosmic game of whac-a-mole.

Over lunch, while munching my avocado chicken bonus food supplement, I used one hand to draw-up detailed plans for a classic iphone game, based around the establishment and advancement of a software development shop. Let's see what happens as you take your humble development house from the small time to the big time...

So, here's this week's ridiculous plan, complete with iphone scanned images, for a face-melting platform mega killer:

DEVSHOP!

How does it start?

You're a dev who decides to go it alone, and start their own... (wait for it...)... DEVSHOP!1!!

You start out with a crappy office, a few plastic chairs, an old 386 with a 15 inch CRT. Your development tool of choice is 'notepad.exe'. Source control? What's that.

You do have a story wall, a cheap desk for extracting customer requirements and a typewriter for creating invoices, once the product ships.

Here's the basic layout:

devshop: modest start, click for larger image

The only staff member is you. And I'm sorry to tell you, your skill-level is very low in terms of business analysis, development and testing. You're a basic 'Jack of No Trades'. With no other staff, you have to do it all yourself.

As new customers arrive in the bland reception area (lower left), you take them to the meeting 'room' (top left) where they divulge their requirements, which then appear on the story wall (top middle). You head to your cubicle to develop the requirements, then pick up those same requirements for final testing, and finally, if the work passes your testing, to the billing desk where customers are presented with an invoice.

Due to your lack of skills, things can go wrong at every step. The analysis, the coding and the testing are all error prone in multiple ways. Poor analysis can create invalid requirements that need clarification during development, or for which the customer later reject the works (or pays less, or demands re-work). The development itself is slow and buggy, while the testing is inconsistent, and likely to either let bugs through or cause wasteful re-development.

But even with these limitations you can still earn a trickle of dollars to get through those first few awkward rounds.

When each round finishes, you get a chance to invest the money you've accumulated to improve your devshop, and raise the bar.

You might upgrade your equipment. Maybe turn that 15 inch cathode ray tube into a triple-panel flat screen, for added productivity. Replace that plastic chair with an Aeron -- including added lumbar support. Add a lolly jar to the meeting room, to keep customer's happy; or get a work blind or a camo cube.

You can upskill your staff, buying them copies of 'Code Complete' and so forth (the game could be monetized through product placement?) or by sending them on training in a myriad of topics.

Training (and books) are centred around topics that apply to the chief disciplines: Development, Testing and Business Analysis, always with a view to increasing speed of a step (a step is done faster), decreasing turbulence (less steps over all), or improving customer satisfaction (better pay at the end of it).

Really swimming in cash? You might be ready to increase your headcount. Go to the job market to hire extra people. Each candidate advertises a certain competency in terms of Development, Testing and Business Analysis, and they all demand a hefty price. But until you've hired them and seen them in action, you don't really know what you're getting. Unless, of course, you've given yourself enough training in Human Resourcing and you've upgraded your lie-detector to the most expensive model on the market.

Here's how the same office might look once you've hired a bunch of people and equipped them well.

devshop: more advacned

Still, the difficulty for me, is trying to see my life as anything other than an extended, life-size game of 'DevShop'. Maybe if I put the iphone down for just long enough, reality will begin to find its way back into my state of mind.

Reality. There's an app for that, right?

Read On...


Fri, 27 Nov 2009 23:04:34 GMT

Should be purple

Leon!

Desperately need help!
I been racking my brains about this all morning!

Why isn't my HELLO WORLD purple?
<FONT COLOR='BLUE'>
   <FONT COLOR='RED'>
      HELLO WORLD! (should be purple)
   </FONT>
</FONT>
S.R.

?

Read On...


Sat, 21 Nov 2009 09:03:24 GMT

Kitchen Agile

kitchen agile

Well, I can see that this would appear tragic from most angles, but it's working out okay for me.

I setup the kitchen at home to have an 'agile' story wall, for managing my software hobby projects.

This was only a temporary arrangement (no way would Mrs SecretGeek allow me to permanently comandeer a wall in any of the liveable areas of the household, you understand.) The kitchen was briefly devoid of furnishings, while we had the floor repaired. And while the room was in this bare state, there was a big empty wall staring at me, just daring me to use it up with some ridiculous leon ideas.

So I turned it into a story wall to manage all the little hobby projects, web-sites, and applications, that are fighting for my nonexistent spare time.

The workers who repaired the kitchen floor probably realised there was a freak in the house. I can handle that.

kitchen agile

Along the top I put headings, "Project", "Goal", "Backlog", "In Progress" and "Closed" (see orange arrow at right).

Each project forms a swim lane of its own (shown by purple arrow in picture at right). I seem to have 9 projects in flight at the moment.

I use little coloured 'bread-ties' as icons to highlight certain tasks (indicated by green arrows in shot above):

  1. Blue bread tie

    Blue is the 'next-action' -- it's whatever task is top of mind at the moment. (This lets me have multiple projects that are officially in progress, when only one can really be the winner -- usually TimeSnapper).

  2. Red bread tie

    A red bread-tie indicates a task on which i'm blocked, stuck, making no progress.

  3. White bread tie

    White is the next item to work on in my HP-Mini computer (which I only use on the bus to and from work). This bread-tie is like the GTD idea of a context -- some items can only be addressed in a particular location or situation. (in gtd they have '@work', '@car' etc)

  4. Green bread tie

    Green is stuff that I must ask Mrs SecretGeek to do for me. (She is my chief financial officer).

Once the kitchen floor was rpeaired, we moved the furniture back in, and I moved the 'task-wall' into the study. Here's a more recent photo:

kitchen agile, relocated to study

The little cardoard-cutout of R2-D2 seems to have disappeared in the move. A certain toddler will need to be interrogated, Darth Vader style, on its whereabouts.

The projects I've got in flight, according to this wall, are:

(and I've added three more since these photos were taken)

See also:

And here's a similar article from my colleague Ben Arnott, Fatherhood, People Leadership and Agile, where he admits using Agile to manage the kids.

In response to this, someone else at work admitted, very sheepishly, that she uses Agile-style retrospectives at home.

There was also an elegant code podcast episode covering this talk: Agile Practices at Home: Iterating with Children from Agile2009.

Makes me wonder how many people are secretly using these kind of techniques at home with their kids and partners, without having the guts to talk about it in public.

Ever taken your work home in this way?

Read On...


Thu, 12 Nov 2009 09:42:44 GMT

Perhaps "Go" is the new Visual Basic

As a cursed "magpie developer" I can't help but read up on every new thing I hear about.

And the latest shiny thing is Google's "Go" language. (Google Wave is sooo last month).

One of the authors is Ken Thompson, creator of Unix and the 'B' Language (pre-cursor to C).

I'm fascinated by little details, and here's one that I like:

If

In Go a simple if looks like this:

if x > 0 {
    return y
}

Mandatory braces encourage writing simple if statements on multiple lines. It's good style to do so anyway, especially when the body contains a control statement such as a return or break.

No parens required for an if... but braces are required. This is the opposite of other languages, but makes great sense to me!

It's kind of like Visual Basic, if anything.

In fact, there a whole bunch of things that are reminiscent of Visual Basic:

var s string = "";

This is the var keyword, followed by the name of the variable, followed by its type, followed by an equals sign and an initial value for the variable.

This is more than a little reminiscent of VB:

Var s as string = "";

Although with GO:

we could go even shorter and write the idiom

s := "";

Similarities continue...

Functions are introduced with the func keyword

Much like the way the 'Function' keyword is used in Visual Basic, hey?

And nothing like C-family languages that begin a function declaration with the type being returned. (Personally I wish they'd gone a ML-style choice of keyword, and used 'fun' for function.)

How is the return type shown? Almost exactly like VB...

GO:

func Area(side int) int {
   //code goes here
}

VB:

Function Area(side as int) as int
     //code goes here
End function

The similarities end approximately there. Did I miss others?

(Note that the similarities with Javascript are just as pronounced, and just as superficial.)

Another superficial detail I like is that semicolons act as separators, not terminators.

The coolest little language-nerd item for me is that capitalization is used to indicate scoping.

In Go the rule about visibility of information is simple: if a name (of a top-level type, function, method, constant or variable, or of a structure field or method) is capitalized, users of the package may see it. Otherwise, the name and hence the thing being named is visible only inside the package in which it is declared. This is more than a convention; the rule is enforced by the compiler. In Go, the term for publicly visible names is ''exported''.

That is a beautiful little detail. I love the simplicity of this approach. If a language is going to be case-sensitive, then it should *do something* with the casing.

But superficial details aside and onto the important stuff...

Indentation

We use tabs for indentation and gofmt emits them by default. Use spaces only if you must.

Sorry Google, I'm afraid Go is not for me.


References

  1. Effective Go
  2. Go Tutorial
  3. Language Specification

Read On...


Mon, 09 Nov 2009 11:05:37 GMT

zen-coding: turn those CSS selectors upside down

zen-coding, online demonstration

Web developers Sergey Chikuyonok and Vadim Makeev have built a nifty set of plugins called 'zen-coding' that work across a range of IDE's.

The niftiest idea from 'zen-coding' is a way of writing Html very very quickly, by a kind of reverse-application of CSS-selectors.

Ah, I think examples will show what words could never explain...

If you type:

div.name

and press the shortcut-key to invoke 'zen-coding' -- the snippet expands into this piece of html:

<div class="name"></div>

If you type:

div#name>p+p

and invoke 'zen-coding' -- the snippet becomes:

<div id="name">
  <p></p>
  <p></p>
</div>

There are more complicated scenarios as well: if you understand CSS selectors, you'll wrap your head around it very easily.

Hence, zen-coding lets you write markup very very quickly.

I've built an online demonstration, a simple web app that uses the code from Sergey's aptana plugin.

These ideas have been re-implemented for emacs, and there's a vim re-implementation in the wild as well.

There's some very good screencasts around, here's one from Vadim and one from Sergey.

This is a cool idea. In the same way that JScript takes CSS Selector DSL and re-purposes them, 'zen-coding' squeezes extra utility out of this tiny DSL. What other DSL's can be used backwards, forwards, sideways? Can linq expressions be reversed for generating .net classes (rebuilder style)? Can SQL Select Queries be parsed and turned into DDL for creating a database schema? Can XPath be used as an XML generation tool?

It's also gotten me thinking about how this style of code generation can be applied to my favourite little hobby-tool, 'World's Simplest Code Generator'

WSCG has come a long way lately, as I've been using my bus-rides to make WSCG more powerful (typing on the HP-mini I got at Tech-Ed) adding more macros, built-in functions, an extensive help file, and some powerful operators called $ONCE and $EACH.

Read On...


Fri, 06 Nov 2009 06:16:21 GMT

Debugging: It's all about finding Albuquerque.

i shoulda made a left toin at albakoiki
"I knew I shoulda taken that
left turn at Albuquerque!"

Rico Mariani has an excellent series about The History of Visual Studio.

There's one little 'detour' in Part 10 of the story, where Rico describes debugging.

I love his description, he's clearly delivered this bit many times. It's so polished it deserves to be quoted all on its own.

I was the debugger lead in the early 90s and I used to explain the utility of debuggers and debugging tools in this way: Imagine a program with a bug, it has been running along, everything is fine, everything is going wonderful, the flow of execution arrives at a point we'll call Albuquerque, where it turns right. Now as every Bugs Bunny fan knows, the correct thing to do at Albuquerque is to turn left. The program's decision to go right has led it down an incorrect path and sometime later we will observe a problem.

Now if we're very lucky "sometime later" will be very soon, like for instance it might be that we just de-referenced a null pointer and we're going to take an exception about 2 nanoseconds after the mistake. That's an easy bug to fix. On the other hand it could be that "turning right" was more subtle - maybe we corrupted a data structure in a minor way and it might be days before we can see an observable effect - that kind of bug is a nightmare.

Finding "Albuquerque" is what I call The Fundamental Problem of Debugging. The debugger provides you with tools (e.g. breakpoints) that allow you to stop execution while things were still good and slowly approach the point where things first went wrong. The debugger likewise provides you with tools to examine the state afterwards, hoping to find evidence of what went wrong in the recent past that will help you to see the origin. The callstack window is a great example of looking at the past to try to understand what might have already gone wrong.

To find the problem, you might start after the failure and try to look back, finding a previously unobserved symptom and moving closer to the original problem or you might start before the failure and try to move forward slowly, hopefully not overshooting the problem by too much. Or you might do a combination of these things. You might add assertions or diagnostic output to help you to discover sooner that things went wrong, and give you a view of the past. It's all about finding Albuquerque.

Rico nicely covers just about all the things you do, in the desperate search for that elusive bug.

Some say too much time in the debugger is a sign of a bad programmer.

The zero-debugging viewpoint says your code should be so well designed you can reason about it without having to step into it. Others says that the best way to avoid long debugging sessions is consistent use of assertions.

I'll do whatever I can to avoid the existence of bugs in the wild. I'll use any approach I can to cut down the necessity for a deep debugging session.

But all the same, debugging is powerful magic. I expect I'll give up the Joy of Debugging when you pry the debugger from my cold, dead hands.

Read On...


Sun, 01 Nov 2009 01:20:54 GMT

The Real-Time online JQuery Editor

the Real Time online JQuery Editor

Here is it -- 'the Real Time online JQuery Editor', or RTJQE for short.

Where do we start? Paul Stovell built a nifty little wpf app called JQueryPad.

It promises to get rid of the need to Alt-Tab while deving (and debugging) your JQuery code.

No, we have to go back earlier than that: Square free realtime html editor came out years ago... (I blogged about it in 2005)

So I got the two ideas and smashed them together in the large hadron collider that is my tiny brain.

The result is 'the Real Time online JQuery Editor', or RTJQE for short. It's guaranteed to work in every browser, except IE, and you may experience some quirks in Firefox, Chrome, Opera and Safari. ;-)

Read On...


Thu, 29 Oct 2009 10:36:08 GMT

HTML5, a 3 minute guide

Mark Pilgrim (one of the internet's colourful characters) is writing a book on HTML5.

Chapter 3 is a great read but at forty pages it's too long for a busy and important person like you to follow along. So I'm gonna summarise (brutally), for your benefit.

Mark shows us before and after version of a document: it starts off using pre-existing HTML features, and he carefully simplifies the document (and expands it) with all the goodness that HTML5 provides.

The two following images show the resulting 'diff', as seen by SourceGear's DiffMerge tool.

before and after, first half
before and after, second half

Here's my very poor and half-baked summary of the diff:

  1. You don't need quotes around attributes (unless there's spaces in the attribute, and then you do) *
  2. You don't need closing tags in redundant situations (e.g. 'tr','p') *
  3. Less "DIV"itis due to new and meaningful elements:
    <header>
    ...where you might've said <div id='header'> previously
    <hgroup>
    ...to tie a bunch of headings together, where they don't create subsections
    <nav>
    ...where you might've said <div id='navigation'> previously
    <article>
    ...to denote standalone pieces that can be extracted and read on their own (perhaps the <div id='content'> of your document)
    <aside>
    ...to denote diversions from your text that aren't part of an article itself (for example, pull quotes)
    <time>
    ...for text that indicates a time, this has a machine readable attribute, e.g. "datetime='2009-10-29'"
    <footer>
    ...where you might've said <div id='footer'> previously

* So this is not XHTML, it's not even XML. You can write it as valid XML if you're that way inclined -- but you don't have to. It's HTML. It doesn't have to pretend to be something it's not. That's cool. That's the bit I like best.


Some other Mark Pilgrim links, in case you don't know of him:

Read On...


Wed, 28 Oct 2009 08:50:20 GMT

Developer Codpieces

dev protector

Attention to all people on the project!

Some members of the software development team are currently working on high priority items which require their full attention.

For this reason, the project has purchased a number of iron codpieces, which will be worn by those developers who do not wish to be disturbed.

If, while kicking a developer in the balls, you discover the following:

  1. You are not eliciting the expected response, and
  2. You hear a 'chinking' sound

Then please:

Assume that the developer is in-fact busy.

If, after a moment's reflection you still feel, for whatever reason, that the matter is sufficiently important to warrant the developer’s immediate attention, please escalate the matter by head-butting the developer across the bridge of the nose in the usual fashion.

We thank you in advance for your patience.

And please note that passive-aggressive emails sent to the developer list will continue to be given the highest priority.

Read On...


Fri, 23 Oct 2009 11:23:23 GMT

Agile for one: The Personal Story 'Wall' In Action

The miniature story wall on my desk (that little cartoon is a picture of my iteration manager reminding me to update the main story wall whenever a completed task relates to one of the customer stories)
Personal A3 story 'wall' on my desk...
To-Do | In-Progress | Done

In the article ‘No Surprises' Rands has a great throw-away line. He says:

"My move is to keep a yearlong log of significant work as a task in whatever task tracking system I'm currently ignoring."
[emphasis added]

I've got a 'wall' on my desk.

I've got an agile-style 'story wall' sitting on my desk at work: this is my latest task tracking system to ignore -- but so far, over three or so weeks, it's working out swimmingly. The most productive and least ignorable system I've ever used. (and, like most people, i've used a few)

Ingredients

  • An A3 sheet of paper.
  • A deck of extra-small post-it notes.
  • A pen.

Instructions

  • Divide the A3 paper into three columns. "To-Do", "In-Progress", "Done" (or synonyms there-of).

  • Leave this thing on your desk, beside whichever hand you write with.

  • Be quick to add post-it notes.

  • One word is enough for many post-it notes. (I'm the only one who has to understand them)

Pro-tips

Post-it notes have a tendency to curl up slightly at the bottom. This makes them hard to read when they're stuck to paper sitting on your desk. So rotate them around and write on them upside down.

If there's a 'real' task system that you're s'posed to be updating, then make sure you write the task number (or bug number, or work item number, or whatever it's called) onto the corner of the post-it note. Write it in a consistent place and you'll be more likely to do this when required.

Reserve one corner of the A3 sheet, and give it a heading "Waiting for...". Park any post-its here where you're waiting for someone to get back to you.

The A3 sheet also acts as a good area for 'doodling' if you're a doodler. (I'm a seasoned doodler). When the sheet gets full-up, you can transfer over to fresh one in a jiffy.

The latest trick, is that I limit the amount of 'in-progress' tasks to just 2. I use the kanban/lean trick of having only two 'slots' available in the 'In progress' section. So if there's already 2 items in progress, and I want to do a new item, I have to either complete one of the current items, or move it to the back log. This little trick is a brilliant addition (thanks to James Brett for the suggestion.)

Why does it work so well?

People are often tempted to create internet-based 'todo-tracking' systems. I've said it before:

"Placing an anti-procrastination tool on the internet is like hosting an alcoholics anonymous meeting inside a brewery."

By moving the todo-list completely outside the computer, it moves it away from so many of the distractions that destroy productivity.

And by using little post-it notes, we get the benefit of being able to manipulate the tasks, with no pressure to over-describe the task at hand.

Here's a schematic that shows the approximate shape of my more recent versions of this (the photo above is a week or two out of date now) It'll be different again in a few days, this is very much a work in progress:

template of my current miniature story wall

(Talk of 'systems to ignore' reminds me of an experimental WPF-app I built a few months ago, seemingly named 'OnTrack':

OnTrack, my first WPF app... i spent more time styling the stop button than i spent writing all of nextAction

It looks nice, promises much... but I spent more time styling the stop button than i spent writing all of NextAction, hence, one is shipping and works well, while the other is now just a screenshot of some lost code.

Read On...


Fri, 16 Oct 2009 10:01:17 GMT

Never work with thick people.

oh i get it, the road bends one way while the sign says go the other. Thanks to XKCD people actually stop to enjoy the alt text, so from here on i intend to go all out baby, oh yeah! Generally you can expect the alt text to be significantly longer than the article.

A beloved secretGeek reader sent me something, which I assume he wished to be published anonymously as part of my 'ghost blogging' series. Okay Kaj, here goes ;-).

Some people are thick.

And it's not just that they're thick. The thickies have thick problems. And, all too often, the thickies come from thick families. And the thickies choose thick boyfriends, or thick girlfriends, and thick husbands and thick wives. And the thickies' thick families and thick boyfriends and thick husbands and thick wives have thick problems of their own. And they ring up their thickie partners on the telephone to have big thick conversations about the big thick problems in their big thick lives.

Thick people are thick magnets. Thick people solve their thick problems in thick ways that create even thicker thick problems.

Never work with thick people.

Edited for spelling, grammar, brevity and meaning.

In fact the only original word that remains is 'telephone'. It initially covered some kind of convoluted story about how our anonymous contributer failed to fix a printer for his ex-wife, but he went about it in a thick way and I lost interest part way in. Dear Kaj: in response to the extended section (from your original email) where you describe the way democrats, java programmers, and (eventually) even 'lesbias' are (as you assured me) 'rapping' the planet (like eminem, hmmm?) and so on Kaj, I strongly feel the need to tell you: lay off the weed, man. Step away from the internets.

If you too have a story to share anonymously: you know what to do1.


1. Send it to the daily wtf. What do i look like? Alex Papadimoulis?

Image credit

Read On...


Wed, 14 Oct 2009 23:50:14 GMT

Cosmo: project status panel

cosmo, build chicken and build killer

At work we've now got a dedicated machine for displaying the project status at a glance.

Someone suggested we use Leapstream's ScoreBoard to monitor Hudson (the CI system we use), but we found there were more things we wanted to show than just the build status.

So we built an Asp.net MVC application called 'Cosmo' that combines build status, number of bugs/stories remaining in the iteration, and a count down to the next release.

This thing is visible from the whole length of the floor. Ah the hilarity that ensues.

It's not exactly production-ready code but it does the job.

We've also got gource (and code_swarm) visualizations of our source repository (thanks to the guy ducking out of the way in the photo above) and, soon we should have a build lamp hooked up via X10.

These are the things that matter.

Read On...


Fri, 09 Oct 2009 10:27:06 GMT

Windows Search in Japan

Many years ago, when the internet was young, when blogging was fashionable, and when Joel Spolsky was still cool, I had one of my blog articles published in a book, "The Best of Software Writing Volume I"

'Volume I' was an optimistic title -- there never was a Volume II. Software writing in general was already headed downhill rapidly -- and clearly that volume represented the zenith of the artform.

A strange myth arose. Apparently, Japan as always, was ahead of the game and put out a translated edition of the work, 3 years before the English edition reached the market.

Recently, I sent a member of secretGeek's research team on a field trip to Japan, in order to capture photographic evidence of the rumoured Japanese translation. It's a little blurry, but it gives the idea.

So here it is, 'Award for the Silliest User Interface: Windows XP Search', in the original Japanese:

Read On...


Fri, 02 Oct 2009 11:55:12 GMT

Project Management Zen

Before satori:
herding cats through moving goal posts.

After satori?
herding cats through moving goal posts.


Definition

"Satori" --> "(Zen Buddhism) a state of sudden spiritual enlightenment."

Allegory

A Zen Buddhist, was allegedly asked to describe his life upon reaching enlightenmnet, and gave it thus:

"Before Satori, chop wood carry water; after Satori, chop wood carry water."


Thank you. Now, please go back and carefully read my post, pretending that you got the back-story ;-)

Acknowledgment:

cat herding quote, pure Joe Cooney

Read On...


Mon, 21 Sep 2009 11:00:08 GMT

Continuous Integration, Plugins and Going Too Far

I quite like the Continuous Integration software 'Hudson'.

While it is from the java world, it has some useful .net plugins, and it is so easy to extend that .net programmers can get a lot out of it. This blog post is a good guide for .net developers wanting to get started with it.

One oddity about Hudson is that it uses Blue to indicate success, rather than the more traditional Green.

hudson with blue success marker ball

Perhaps this is done to help people with red-green colour blindness.

Either way, I was happy to see there's a plugin called "Green Balls" which changes the success images to green, rather than blue.

hudson with green balls

I thought this worked fine, and I was quite happy with the newly installed Green Balls, until we'd been running for a few days.

There was a loud crashing sound, I turned around to the build monitor and noticed something unexpected:

hudson with green balls and incredible hulk smashing the place up

Yes, yes. I am groaning too. It is bad. Yes.

Read On...


Sun, 30 Aug 2009 19:10:08 GMT

The Rules of Stand Up

If this is your first day at stand-up YOU HAVE TO TALK.

Jesus almigthy! Employers are crying out for employees who "hit the ground running" and let me tell you, IT'S NOT THAT HARD.

And yet, I see people fail. Many, many people -- intelligent people -- they hit that first tiny hurdle, they bellyflop into it and collapse on the floor in a ball. Why people why!?

I guess I have to start by quoting the rules of 'fight club' since i'm clearly referencing them, and then I need to define what I mean by 'stand-up' since that is the matter at hand.

The rules of 'fight club'

  1. The first rule of Fight Club is, you do not talk about Fight Club.
  2. The second rule of Fight Club is, you DO NOT talk about Fight Club.
  3. If someone says stop, goes limp, taps out, the fight is over.
  4. Two guys to a fight.
  5. One fight at a time.
  6. No shirts, no shoes.
  7. Fights will go on as long as they have to.
  8. If this is your first night at Fight Club, you have to fight.

About 'stand up'

By 'Stand up' I mean "the Daily Stand Up Meeting" as introduced by the scrum software methodology and (pretty much?) adopted by all software teams everywhere.

At stand up, you stand in a circle and each speak in turn. We stand up because time is precious. Each person says... well, let me just explain 'the rules of stand up' in the style of 'fight club'. Let's see:


if this is your first day at Stand Up, you have to talk.
If this is your first day at Stand Up,
you have to talk.

The Rules of Stand Up

  1. The first rule of Stand Up is, you do not talk while someone else is talking.
     
  2. The second rule of Stand Up is, you DO NOT talk while someone else is talking.
     
  3. You talk fast and you keep it moving fast.
     
  4. Tell us what you did yesterday.
     
  5. Tell us what you FAILED to do yesterday.
     
  6. Tell us what you will do today.
     
  7. Tell us who is BLOCKING you today.
     
  8. If this is your first day at Stand Up, you have to talk.
     

I could go on, but I already have. ;-)

Read On...


Thu, 13 Aug 2009 20:06:06 GMT

Sydney International Airport: Stupid, Criminal, or Criminally Stupid?

Hanlon's razor tells us:

"Never attribute to malice that which can be adequately explained by stupidity"

and this maxim has been my good friend for a long time.

But sometimes the stupidity is too acute to be plausible. Surely stupidity has limits?

Here's a case that left me gobsmacked.

For the last few years, airport security checks have been confiscating any liquid that is over 150ml or is not in a clear container. This is due to a security scare at some time. Fair enough, I accept that.

It turns out that they are also confiscating items purchased in-transit -- perfumes and duty free liquor, for example. I accept this too: I mean it's stupid, but it's within the usual bounds of plausible stupidity that we encounter every day. It's been going on for a few years now.

But here's the case of implausible stupidity I encountered last week at Syndey airport.

There's a duty free store encountered in-transit, just before a blind corner, at which there is an unexpected security check point.

So a store is selling items to people who will be forced, just 10 metres down the road, to relinquish their purchases.

Here's my mud map of the situation:

store with check point around the corner.

(Note that I didn't suffer this fate myself, I witnessed it happen to about 10 percent of the people from my plane.)

A duty free store sells goods just before a blind corner.

You walk around the blind corner and you enter a small, fast moving security check point.

Once your liquid goods have passed through the x-ray machine, they are confiscated. Everyone looks surprised. Even the security guards act like this has never happened before.

For many of the victims of this situations, this is their very first experience of Australia. Some kind of a crazy country where everyone is out to trick you.

(My wife and I were so impressed by this, that we found a quiet spot to observe the security checkpoint from above. It definitely wasn't an isolated case, it was very common. And the security guards looked amazed every time.)

I am pretty sure there's some organised crime occuring here, because the alternative explanation, stupidity, is just too impossible to be believed.

In the absence of a criminal conspiracy, here's 6 solutions that would've been better than confiscating the liquor:

  1. The shop should inform the in-transit passengers that their liquor will be confiscated, before making the purchase.
  2. The checkpoint could allow the passengers to return to the shop and demand a refund on the sale of the liquor.
  3. The airline could warn the in-transit passengers (before they leave the plane) that any liquor they purchase in transit will be confiscated.
  4. Instead of issuing the actual liquor, issue some kind of voucher which the person can use to collect the liquor at a final destination.
  5. Respect the shop's tamper-proof packaging, as this ought to indicate that the goods are safe for travel. (If need be, an upgraded form of tamper proofing would be sufficient).
  6. The security checkpoint could confiscate the goods, put them into tamper proof bags of their own, and deliver them to the cargo hold of the plane. (This is how 'dangerous items' like fruit knives used to be transported)(If this costs too much it could be reimbured by fining the shop who sold the goods)

But what's really going on here? What do you think happens to all that liquor?

I sincerely hope that there's a racket of some sort. Maybe it gets sold back to the shop. Maybe the security guards hang onto it.

I'm not sure, but I just hope there's a profitable crime going on, because in such a blatant case, malice is far more understandable than stupidity.


Sorry for the hiatus. Have been on holiday.

Read On...


Mon, 20 Jul 2009 13:04:33 GMT

God No! ...The ReBuilder

Do you ever have a software idea so horrible that you feel physically sick?

At times like that, you can block out the idea immediately, but I find it's best to follow the idea through to it's logical conclusion.

So here's a repulsive idea I had, which I've since discussed with a bunch of people who helped flesh it out a little more, making it extra terrible.

var person = new Person();

Introducing 'The ReBuilder'

Ah, yes. It's called 'The ReBuilder'

Here's an example of what happens when you're foolish enough to use it.

So, you open up Visual Studio and choose to create a new console application.

You type the line:

var person = new Person();

Try to compile and see an error, essentially 'Person? No such type!'

"Error 1 The type or namespace name 'Person' could not be found (are you missing a using directive or an assembly reference?)"

Rather than have the programmer waste his or her precious time creating this new class, the Rebuilder does it for you. It goes right ahead and creates a class with the name 'Person'. It doesn't ask you to confirm the action, it just goes ahead and does it. No ifs or buts. Where does it put this new class? Wherever is the most conventional place. It builds the application again, right away. There's no new compilation errors, so it rests.

person.FirstName = "Jim";

You type another line of code... you now add:

person.FirstName = "Jim";

The rebuilder picks up on this straight away. (Actually, screw it, you don't need to specifically try and build... this is a background compilation. It's always present.)

Rebuilder notices the resulting error...

"Error 1 'Person' does not contain a definition for 'FirstName' and no extension method 'FirstName' accepting a first argument of type 'Person' could be found (are you missing a using directive or an assembly reference?)"

Clearly you're not after a method called FirstName, you're after a property. So rebuilder adds a property named FirstName of type string. No magic.

Next you try to save your object...

person.FirstName = "Jim";

person.Save();

This yields a fresh error:

"Error 1 'Person' does not contain a definition for 'Save' and no extension method 'Save' accepting a first argument of type 'Person' could be found (are you missing a using directive or an assembly reference?)"

This time the missing method is, indeed, a missing method. So ReBuilder gets in builds a method with the appropriate signature.

And it doesn't flesh out the body of the method with some dodgy 'Throw New NotImplementedException()' bullshit like the 'Generate Method Stub' feature in Visual Studio. It analyzes the name of the method, and implements it on your behalf.

"Hmmm, 'Save'," thinks the ReBuilder. "I guess you want to 'save' a person." So rebuilder writes a save method, saving to the most conventional place it knows: the database.

If there's a useful database connection in the application, then it uses that. If not, it creates one.

If the database contains a table named 'person', it will save to there. If not, it will build a table.

If there's no database to begin with -- well the ReBuilder goes ahead and builds it.

Obviously, you wouldn't do all this without any code coverage, so hell, RB churns out a sweet suite of tests to cover all the branches of the save routine.

(If the database, and the person table already exist, then we make sure all the relevant properties exist. This might include creating a migration script for updating any other environments with previous versions of our database)

Next you type:

person.GetByFirstName("Jim");

"Hmmm. Judging by the name GetBy<PropertyName>(<string>)..."

It looks like you expect a well understood pattern to be implemented.

(Yes, this bit is blatantly inspired by Ruby on Rails use of method_missing...

"def method_missing(method_id, *arguments)
   if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)")

And rebuilder will add an index to the Person table, on the column indicated by the property name, plus create the relevant goo for performing the expected retrieval. (And again, whatever tests are needed to cover all paths.)

Finally, you branch out a little and type:

Satellite.ReCalibrateAfterSolarFlare(magnitude:=237);

ReBuilder, naturally, doesn't have a freakin clue what that means. It doesn't fit any known convention -- so it falls back on its "Convention_Missing" convention.

Convention_Missing

First, ReBuilder looks on Koders, Krugle, codase, google codesearch... every last place it can to see if any indexed open source code contains a method like the one we're after.

Failing that, RB opens your email account and writes to a few of your coder buddies (on your behalf) to see if any of them have experience with a similar problem.

Failing that, it sends a polite (though assertive) email to Scott Hanselman, asking him if he can (a)help out, or (b)point you in the direction of someone who can.

When a suitable method is located as a starting point for 'ReCalibrateAfterSolarFlare' -- it is pasted into the code, and a new compilation is attempted.

Rebuilder attempts to complete any compiler errors at this point through simple deducation, through the use of markov chains, through Any compiler errors at this point are submitted as polite (though assertive) questions at StackOverflow, in the persona of a very awkward but honest noob, struggling to solve this one temporary and specific problem.

While waiting for the responses there, ReBuilder runs a logo competition online at 99designs or crowdSpring, then holds back, letting the community provide the content as well as picking the winner.

Once the responses from StackOverflow are sufficient to get the code compiling, ReBuilder checks that all the unit tests (written by the lowest bidder at www.RentABusinessAnalyst.com ) are beginning to pass.

Once all code compiles and all tests pass, the logo is in place and the typical page layout and css are fully baked (munged together from every cool site mentioned on every cool design blog) the app is shunted onto the first available cloud computing platform, cross promoted at your facebook and twitter profiles, cross posted to reddit, hacker news and digg, where it's upvoted and astroturfed by a distributed swarm of sockpuppets launched by every other PC on the planet running a copy of Rebuilder Zombie daemon, promoted with whatever relevant google adwords are cheap enough to suit your budget, and plastered with enough punch the monkey ads to bring in a steady trickly of cold cash.

You, meanwhile, sipping cocktails on the beaches of Tahiti, receive an SMS telling you the app is done, and your resume is automatically updated with glowing details of the amazing "ReCalibrate After Solar Flare" 2.0 app.

No magic. None.

Read On...


Thu, 16 Jul 2009 09:21:30 GMT

Matt, The Office Mortar

Ah-ha! I have another ghost-blog entry, sent in by a tortured enterprise-peon who wishes to remain anonymous. (Personally, I like to imagine the voice of David Attenborough when reading this one.)

A mortar outside of its Office Habitat

Matt, The Office Mortar

Like its military namesake, the mortar found in offices has one primary purpose - the lobbing of grenades.

The Office Mortar often uses domain or technical knowledge, anecdotes or rule-lawyering to inflict heavy casualties. In an open, pluralist office where everyone is encouraged to speak up about problems it is difficult to deal with a mortar directly, but many people see them for what they are, constantly throwing out problematic issues that either need to be defused or blow up in somebody's face.

Often used by insurgents keen to derail a project, a mortar placed in a strategic position such as testing, architecture or business analysis, can keep a team pinned down for weeks or months, and cause horrific loss of morale and productivity.

Although the mortar likes to deliver its lethal payload by lobbing grenades indiscriminately into groups (in office parlance this is called a "meeting") mortars in the 21st century have devised a new means of spreading fear and error - grenades delivered by email!

Now, Let's watch as this mortar unleashes a deadly barrage of nebulous issues, process meta-questions and second guessing.

Organizer: We're here to finalize any remaining details of the user stories in the development cycle that's now underway...

Matt the Mortar: Half these need to go. X isn't fully specified, and there's no point doing Y without it. And why isn't Z in scope?

Organizer: Sorry Matt, we agreed on the list of stories last week. You were in that meeting, and as a group we all agreed on this list.

Matt the Mortar: The whole process is broken! What's the point of saying we're agile if we're unwilling to change.

Organizer: We value your opinions Matt, but perhaps this meeting isn't the best forum to...

Matt the Mortar: There should be a full review of the process by which the list of stories is defined for the cycle, and I'd like the outcomes of any meetings where scope is discussed to be mailed to the whole team.

Organizer: Now Matt, we held a retrospective meeting just last Thursday, and all of these points would've been excellent things to raise on that occasion...

Matt the Mortar: Furthermore, let me say that I for one don't have any faith in these so called 'business reps' and whether or not they actually represent the business itself. You need to raise that back to the project sponsors.

Organizer: The what? Look, getting back on track, we need to ensure the first user story is...

Matt the Mortar: That story is completely broken -- it will never work with the FizzBuzz system they have in production.

Organizer: Hold on, integration with the FizzBuzz system is strictly out of scope for this project.

Matt the Mortar: No, I've been talking to other business reps and they're very keen to see a lot of improvements to FizzBuzz as soon possible including cloud based...

And we leave our meeting there, irretrievably drowning in a deep vat of confusion. Matt will of-course have forgotten all of these bomb shells when the next retrospective is held. He will instead insist that the retrospective is a waste of time that stops them from implementing many important features that he alone understands.

It is at moments such at this that managers around the world choose to bring in a highly successful counter measure: The Office Sharp-Shooter. But more on that topic next week.

;-)

Read On...


Fri, 10 Jul 2009 09:56:05 GMT

'Outlook style' rules for Subversion

At work, when I get an email from an idiot, I set a rule.

Example

I start work at a new company.

I notice they use Microsoft Outlook.

Within minutes I get an email:

From: Jenny@work
To: Everyone@work
This message was sent with High Importance!
Subject: "URGENT!!!! Get your footing tipping entries in by Tuesday week!"

Hmmm. It's "URGENT!!!!" so I spring into action:

Add new rule -> Messages from: 'Jenny@work' -> Delete.

Done.

But now look at all this crappy code the other devs keep commiting to the repository.

Every time I perform an "SVN update" it's like I've just invited a carnival of freaks to crap all over my hard drive.

A nice feature would be if we could get the same utility from subversion as I get from outlook.

"Do not accept any code changes from Trevor, if they relate to internationalization."

Trevor, you see, doesn't have a freakin' clue about internationalization. But he thinks he's God's gift to the unicodes.

And Joella, who thinks every programming nail is another excuse to wield the hammer of reflection.

"If you see code submitted by Joella, containing 'System.Reflection' replace with '//TODO: write actual code here, rather than namby-pamby show off serialization code.'

It's just a humble dream I have. The best approach to implementing it, that I've come up with so far, is to build a custom version of Tortoise SVN (it's open source right? I can fork it a little if I want to ) and then dump this custom version of tortoise on Trevor and Joella's machines.

From Trevor's point of view, it will look like he's committing his changes to the repository. But tortoise will in fact be just quietly twiddling its thumbs and doing nothing. If you count 'logging keystroke and scraping bank account details' as 'doing nothing', that is.

Trevor may realise sooner or later that he's never getting anyone else's changes. That no matter how often he updates, he never gets any new code. He may even begin to suspect something is up and he may bring it to our attention. At that stage it's time to enact the "remote 'overwrite every byte on the hard drive, and perform thorough boot sector corruption' " feature of his custom tortoise build.

With a little creativity, a little software, and a little patience, we truly can make the world a better place.

p.s. the solution is: DVCS. Please discuss.

Read On...


Wed, 08 Jul 2009 08:19:35 GMT

Really deep linking: Url + regex

Here's today's boil the ocean scheme idea — and it's not a new idea by any means. I'm sure it has occurred to many people at many times, I've just never seen it written down. (links to further reading welcome)

Just say you want to bookmark a particular paragraph on a particular web document.

Perhaps you want to perform the electronic equivalent of using a highlighter pen to point out a particular fragment of a document in its original context.

You can give the uri of the page, but you can't give a specific link to the actual paragraph you are interested in.

(Sure, if the author of the document provided a named anchor tag for the paragraph then you are in luck. But only semantic web fanboys and egomaniacs go to this kind of extreme)

What I'm thinking is that, instead, you could provide a little extra bit of regex-goodness in the url. Say for example you said:

href='http://secretGeek.net/regexUri.asp --highlight "Say for example you said:"'

...then this could act as a pair of instructions to the browser: the first one is "get from 'http://secretGeek.net/regexUri.asp' and the second instruction is "highlight the text that matches this regex: "Say for example you said:" (excluding the quotes). The instructions are separated by spaces, qualified by quotes and so on. Click on the link and the page is shown, with the relevant text highlighted.

Okay — i'm thinking four different things at once here:

  1. Why stop at highlight? what other commands could the new commandline accept?
  2. "Major security flaws waiting to happen"
  3. Some people, when confronted with a problem, think "I know, I'll use regular expressions." (etc...)
  4. Subtle differences in implementations between browsers.... NO!!!1!

And of course, as always, I'm hearing the voice of some strange ever-present character in my head (who sounds a lot like comic-book-store-guy from the simpsons) and he alternates between:

  • You can already do that in firefox with addins/greasemonkey, idiot. And
  • 'course, there'a an emacs command to do that

Thoughts? Additions? Subtractions? Jakob?

Read On...


Mon, 06 Jul 2009 10:15:24 GMT

hExcel -- A Hexagonal Spreadsheet

Here's a wacky idea, I've got no use for.

hexcel, the hexagonal spreadsheet

'Hexcel' is a spreadsheet with hexagonal cells.

How does it work? What is the advantage? I have no idea. But there could conceivably be some advantage to it.

Bees for example, planning their hive. Settlers of Catan fans, developing game optimization macros. Or experimental musicians, planning new forms of musical notation to accompany their Jankó keyboards.

hexcel

Read On...


Fri, 03 Jul 2009 11:30:18 GMT

Is the remote control a thing of the past?

We humans used to be almighty atheletes, then the TV was invented.

For a time, the only exercise we found was in hopping up to change the channel (this was usually relegated to the youngest member of a family unit)

Time went on and we got lazier still.

The remote control became a must-have for every lounge room.

The next step is to become so lazy that we can no longer reach for a remote control.

We'll use mind-power to control the volume.

Pretty soon, thinking will be too much trouble.

The TV will need to do the thinking. You watch TV -- and TV watches you.

"He's looking bored? Better switch channel."

Automatic volume control will be easy. TV pays attention to the ambient noise level in the room, looks where the audience are seated, and listens to the shows its broadcasting, adjusting to keep everyone comfortable.

Maybe we end up putting ourselves into the matrix, one little feat of laziness at a time.

Read On...


Thu, 02 Jul 2009 11:39:44 GMT

The Utterly Thorough Guide To Awesome Application Compatibility on Windows 7.

How does backward compatibility work in windows 7?

I'm glad you asked.

You don't got to be a Hanselman to know all this.

Here's a pictographicatorial guide to compatibility checking in the windows 7.

XXX

* In point of fact, it's a virtual Raymond Chen (a VRC), but the MS guys are so freakin good at virtualization now that You Will Never Ever Ever EVER Be Able To Detect The Difference. Even Mrs Chen is rarely sure. And only when that fails do they invoke the real Ray Chen.

So take it from me, a world expert on the computing technologies, that this new version of windows will be just about the best thing since Vista.

Read On...


Sat, 13 Jun 2009 12:17:23 GMT

Astounding Hyperlinked Noticeboard

I see this sign on the noticeboard in the staff kitchen every day, and thought I ought to share the wry little WTF it invokes, every last time.

sorry i redacted it slightly; i think the guilty deserve some protection too; they're just hard working kids in the end)

Read On...


Fri, 12 Jun 2009 13:06:58 GMT

Three Questions About Each Bug You Find

1. Is this mistake somewhere else also?
2. What next bug is hidden behind this one?
3. What should I do to prevent bugs like this?
3 Questions...
in cartoon form too!

I really love this timeless Tom Van Vleck article from 1989.

It teaches us to ask ourselves:

Three Questions About Each Bug You Find

Those questions being:

  1. Is this mistake somewhere else also?
  2. What next bug is hidden behind this one?
  3. What should I do to prevent bugs like this?

When I first read these rules, I was foolish enough to think:

'Cute, But Too Obvious! i do this intuitively all the time.'

But watch yourself closely! I've caught myself out on occasion, and maybe you will too.

I'm making an effort to be more explicit about the three questions. Maybe i'll end up fixing related problems at first hint more often than i do now.

Read On...


Sun, 07 Jun 2009 08:26:42 GMT

Recursing over the Pareto Principle...

Villy Pareto
Vilfredo Pareto:
don't got time to shave.

I keep hearing rather a bit too much about this Pareto Principle.

Apparently, with just 20% effort, correctly applied, I can achieve 80% of the desired effect. Marvellous stuff!

I was about to go ahead and do this when it occurred to me:

"Why waste all that time, doing a whole 20%?

"If I only did 20% of that 20%, then surely I could achieve 80% of the 80%?"

Then with a little more head scratching, and the help of an excel spreadsheet, I determined that with just 0.8% of the effort I could achieve 51.2% of the result -- which is a PASS in anyone's books.

So from now on, you will excuse me while I spend 99.2% of my time:

  1. Lounging around, drunk, in a pool bar and

  2. Determining exactly which 0.8% of the effort to apply myself to.

Unless, of course, it takes 80% of the effort to work out exactly which 20% will achieve the desired effect. And it takes...

Read On...


Fri, 05 Jun 2009 10:24:14 GMT

Sometimes, The Better You Program, The Worse You Communicate.

A couple of weeks ago I put out a twitter post I've been meaning to come back and explain:

"the habits of a good programmer are not simply orthogonal to good communication -- frequently they're in direct opposition."

http://twitter.com/secretGeek/status/1870937085

This is a pretty startling and upsetting result: I'd like to think that the heart of good programming is crisp and direct communication. That all of my efforts to be better at programming will, somehow, make me a better all-round person. If only it were true.

Here's a bunch of ways that good programming practices are directly opposed to good communication practices.

In bullet form:

  1. D.R.Y. Does Not Apply.
  2. Humans don't mean what they say.
  3. Compilers don't need to see an example.
  4. Programs love definitions; Humans get flummoxed.

And in detail:

1. D.R.Y. Does Not Apply

The golden rule of programming is D.R.Y. -- don't repeat yourself. This is the heart of effective programming. But this is the opposite of effective communication.

Let me say that again:

The golden rule of programming, DRY, is the opposite of effective communication. ;-)

Say everything once and only once -- go ahead -- then be amazed as everyone misses your point!

Humans are not machines. Memories made of this gooey, spongy stuff called a brain are nothing like memories made of silicon.

With Humans, nothing sinks in the first time. And furthermore, you may be surprised to hear that NOTHING sinks in the first time.

Human, All Too Human
"Human, All Too Human"

Nietzsche preferred the
company of a good compiler
over that of a human.

"Compilers never make fun
of one's moustache,"
--Ibid., pg 293.

2. Humans don't mean what they say.

Compilers are of course perfectly literal. They don't care at all what you mean, they are always hung up on precisely what you say.

Even if you didn't start off life as an anal-retentive git, you'll slowly gain the requisite faculties over years of trying to please a compiler.

The art of trying to please a compiler consists of the ability to logically, dispassionately, analyse what you've said, to discover and remove any mistake or ambiguity -- to always produce an output that is perfectly comprehensible to the strictest of master.

Try being like that around real people. Just try it.

People are barely literal at all. If you take them literally when their meaning differs from their words -- they will get quite irate with you. They won't see that the mistake is theirs.

When the words they use differ from their intent, you may feel an overwhelming desire to 'correct' their mistake. You may even think you are doing them a favour.

This is a natural feeling, amongst programmers, who would be happily spared the torture of spending time trying to remove all ambiguity from the words they provide to a parser.

But please (please) hold back. You might score a small point in the 'intelligence' column for pointing out their 'mistake'. But you'll also score about a bajillion points in the 'what a freaking dork' column.

3. Programs don't need to see an example.

Explain a function to a compiler, and it will be able to calculate the answer.

Explain a function to a human... and then give them an example, and draw them a picture, and give two counter examples, and draw another picture, plus provide an interpretive dance on the topic of functions -- and maybe, just maybe, if you've danced very nicely, they will begin to see "what you're trying to say."

"What I'm trying to say?" I'm saying it damn clear! I'm saying it directly, concisely and with perfectly constructed phrases! I'm not trying to say anything! I'm succeeding, you're just not listening, you freaking imbecile!

And don't take that tone with me. With humans I mean. There's no point yelling. Their rational mind shuts down, their sympathetic nervous system takes over. They get ready to fight or flee. Your point is lost when you get them angry.

Computers don't mind if you type angry. Humans think the anger is more important than the words themselves.

When you have the customer in a headlock, knocking their face against the ground with every syllable: the syllables themselves are no longer of tremendous consequence.

True: that bit about beating up the customer may not be a typical trait amongst great programmers. Perhaps I included it just for entertainment purposes. Continuing...

4. Programs love definitions; Humans get flummoxed.

In programming we define new terms all day long. We define class names or function names or variable names.

We immediately attach a specific definition to them -- and then we use that definition throughout our code.

I imagine that some part of the brain is associated with the ability to define a new term and then hold onto its definition. That part of the brain would be monstrous in programmers. Very over-developed. Gigantic -- a tiger amongst kittens.

But define a new term in front of an audience of non-programmers: watch as the eyes glaze over. Heads slump forward. They start planning their weekend.

Let's call this our Neologismic Synaptic Aptitude, or NSA. Actually: let's not call it our NSA, because if we do, then programmers will start bandying the terminology around like it's something we've known about all their life. And the normal people will just look at us with that 'freak' expression, and we'll be even further from ever making it into the boardroom.

I think this aptitude for new terms is what makes TLA's so abundant in the IT world. I do hope you realise it scares everyone else.

So please, I implore you...

Stop defining new terms. Stop expecting non-programmers to understand the specific and concrete definitions you attach to funny little abbreviations.

Stop striving for brevity and conciseness.

Stop correcting other people.

Stop expecting people to understand you first time around.

Start giving examples -- real examples, earthy examples.

Let people be people -- let them be vague and a little incorrect -- listen more for the gist of what they're saying than the exact terminology.

Be a compassionate speaker, a compassionate listener. Embrace the 'all too human' aspects of the strange bipeds you interact with.

Then drop me an email and please, for the love of god, tell me how you managed it.

Read On...


Fri, 05 Jun 2009 08:11:53 GMT

A Non Warning, from Windows XP

I feel sorry for the programmer who was forced, no doubt after endless emails, meetings, focus-groups and think-tanks to check this obscure non-warning warning message into the Windows source tree...

Warning message after adding more RAM, at last

"The amount of physical memory in your system has increased. This typically does NOT indicate a hardware failure. Contact your Help Desk if you did not personally change your system's physical memory configuration."

Why didn't they say "Congratulations!" or "Good news" or "Ahhhh! thanks for feeding me those yummy ram chips!" or best of all:

"Well, how about that! The tight bastards in IT must've approved that RAM upgrade request we noticed you writing in MS-Word, all those months ago.

"Now let's see if we can get the cowards to consider upgrading the browser to IE 7."

Read On...


Fri, 22 May 2009 12:29:33 GMT

In the enterprise, nothing is what it seems

There is a hidden network of bloggers (all around you), a kind of secret brotherhood...

These are the 'ghost bloggers'.

'Ghost-blogging' is the practice of sharing true stories about your own working life, true stories too cutting, too poignant and too true to share on your own blog.

The following is an example of a ghost blog entry, sent to me by someone I know, appalled at some of the Kafkaesque behaviour they've been subjected to inside the kind of enterprise everyone should find familiar.

(I've ghost-blogged my own personal stories on other blogs, at times...)

Here goes...

Version Control, Requirements Tracking, Deployments
Version Control,
Requirements Tracking
and Deployments

In the enterprise, nothing is what it seems

In the enterprise when they say: "don't worry about that, another team will do that for us" what they mean is: "you just took on a dependency that you have no control over".

In the enterprise when they say "we want you to re-use this standard asset" what they mean is "we want you to hold on to this gold-plated, diamond encrusted anchor while we throw you over the side".

In the enterprise, the group allegedly responsible for 'provisioning developer desktops' will, in actual fact, be the group who expends every effort imaginable to stop developers from being able to actually install developer tools onto their desktops.

In the enterprise when there are three separate groups, allegedly responsible for version control, requirements tracking and deployments, you'll find in practice the requirements are documented through excel spreadsheets over email, the source code won't build, and the deployments take everyone by surprise, including the deployment team.

In the enterprise when they talk about 'strategic direction', they mean 'strategy tax'.

In the enterprise when they ask you to "simply call a web service", what they mean is, "use ftp to push a fixed-width file onto a queue that feeds the mainframe which routes another file to a web service that calls you back on a random port". With a completely straight face.

 

Read On...


Wed, 13 May 2009 11:23:25 GMT

How to get a Free iPhone

Follow this simple three step guide to become a proud member of the awesome club of people who loudly proclaim:

"I too am cool! I too have an iphone!"

Go to the settings area of your mail client
  1. Go to the settings area of the mail client you use on your regular PC

  2. Sent from my iPhone
  3. Change your email signature to read 'Sent from my iPhone'

  4. Sent from my iPhone
  5. Send short, pointless emails to everyone you know

Okay, you won't technically have an iPhone. But for the most part, other iPhone users will *want* to believe that you have joined their "team" -- hence, they will be convinced.

And -- as a final twist -- once you're thought to be a member of their team, you'll find that acquiring an actual free iPhone will be easy. Other iPhone owners will be more than happy to let you borrow one of their iPhones next time you see them, if you claim to have momentarily misplaced yours, for example in the pocket of "your other white leather trousers".

--lb
Sent from my iPhone



Read On...


Fri, 08 May 2009 08:44:49 GMT

10 Simple Rules To Follow In Case Your Software Becomes Self-Aware

happy face

Well, It turns out that the 80's geek classic, 'War Games' has inspired a sequel, the film

'War Games: the dead code' was released in 2008. Though, perhaps the correct term is 'foisted.'

WG: TDC is such a deliberately bad film that you can only begin to enjoy it once you grok that it's a comedic satire.

For the first hour and a half I assumed it was trying to be a cool, teenage-targetted tech-savvy thriller, like the original. This had me wincing in agony at every bad line and predictable twist. Only then did I realize it was all a joke: a parody of the teenage-targetted tech-savvy thriller. A kind of 'scary-movie' style satire of the entire genre. Hopefully?

Well, I've just finished watching it and it's inspired me to share a few helpful tips for up and coming programmers.

As one of today's young parents, I can tell you what concerns us. Not swine flu, or global economic disasters and so forth. What really keeps us terrified at night is a desperate hope that we, as parents, take all of the right steps to ensure that our sons and daughters grow up to be thoughtful, well-meaning, much loved people. In short: How Can We Be Certain Our Children Will Become Programmers.

And a lot of hard work (err, blog posts) have gone into that endeavour, but as usual I like to look beyond the obvious problem, and into the deeper realms or possibility:

If you're child does (thank god!) grow up to be a Programmer -- what simple lessons can you provide to ensure they don't inadvertently destroy the planet?

Programming is a powerful profession, and as you well know, global apocalypse is but a keystroke away. We want to give our kids the right tips to ward off such misadventures -- to learn from our wisdom, as it were.

Fortunately, like all global catastrophes, this one can be averted with another 3 minute guide from secretGeek.

Please, sit back, breath a deep sigh of relief for the salvation of your measly planet, and drink deep of this crucial lesson to imprint upon your younglings:

10 Simple Rules To Follow Incase Your Software Becomes Self-Aware

(I have included links to information about Government-Approved documentary films on each of these points. I only pray you heed my warnings and enforce these lessons before we are all routinely destroyed.)

    war games
  1. Teach your software that war is futile.

    If, after pre-supposing a minimal competency level in your opponent, a game's inevitable state upon termination is mutually-assured destruction, then the only winning move is not to play.

    [reference]

  2. Prepare a virus that can be used to remotely shut down the program from any terminal in the world.

    My personal contiuous integration suite won't let me commit any code until I can demonstrate 100% code-coverage with remote-shutdown killer viruses.

    [reference]

  3. hal readin some lips
  4. Don't discuss switching off the computer if you are, in fact, being observed by the computer.

    This is s.o.p. (...that's standard operating practice, if you're not a super-spy type like me, who knows all the jargon). Never discuss shutting down your software until you have found a locked, sound-proof chamber, where the computer system cannot hear your discussion. Also, in case there is a remote possibility that your software has learnt to read lips, let me suggest you cover your mouth.

    Simple, every day precautions.

    [side note: a parody of this famous Kubrick scene was included in 'the dead code'. nice.]

    [reference]

  5. deep thought deep in, well, thought
  6. Ensure that when faced with a tricky question, your software will either breakdown completely, or devote all of its resources for a long time.
  7. Grandiose, open-ended philosophical questions tend to have a compute time in the order of millions of years.

    Similarly, when given a dilemma (e.g. "This sentence contains a lie") a self-aware program will tend to explode spectacularly. A competent programmer will keep a few of these handy.

    [reference 1]

    [reference 2]

    angry bots
  8. In case of emergency, have time machine handy.

    You may need to send someone back in time to protect the mother of the person who leads the rebellion against the self-aware software in the future.

  9. [reference]

    blade runner (do robots dream of electric sheep) -- pris
  10. Don't make your self-aware machine indistinguishable from a human.

    Maybe you're not very creative, and don't have the time to give your machine a stunningly inventive new exterior. So you fall into the tired old pattern of mimicking the human body.

    That way, badness lies.

    [reference]

  11. demon seed freaked me out when i saw it as a child
  12. Should your software become self-aware, don't let it near your girl.

    Fairly self-evident that one.

    [reference 1]

    [reference 2]

  13. scissor hands
  14. If applying temporary appendages to a self-aware robot, be considerate of your legislation governing public safety.

    Scissors for example, are not recommended, even if they are 'just for now'.

    [reference]

  15. badly chosen picture best i could find
  16. Be safety conscious.

    Switch off all electrical equipment during thunder storms.

    [reference]

  17. 3 clear rules
  18. Use a rules engine.

    Hardwire 3 clear and unambiguous rules into the program's positronic brain that will ensure all humans are safe from harm.

    [reference]

Hopefully, if you follow my advice, we can avoid any more major disasters. But please: always be nice to your inventions. Hopefully then, should the unthinkable happen, your self-aware creations will take pity on us and keep us barely alive in liquid chambers so they can gorge on our brains.[reference]

Oh, and if you don't believe in self-aware robots... (cough cough) here's some i prepared earlier.

See also (important information in similar vein)

Read On...


Sun, 19 Apr 2009 11:21:32 GMT

Your next text editor is... MetaNote!

two toolbar buttons titled Lower and Upper.
Example: two toolbar buttons
titled 'Lower' and 'Upper'.

two toolbar buttons titled Lower and Upper.
Right click the toolbar to edit a button
(or add a new one)

two toolbar buttons titled Lower and Upper.
The button hosts a python macro that does whatever you want. (The current
document's main textbox is exposed as txt.)

two toolbar buttons titled Lower and Upper.
Add more buttons, edit the menus...
everything's extenisble... everything.

I've open-sourced a side project of mine, MetaNote.

Here's the gist of it...

MetaNote is a text editor. Ultimately, MetaNote intends to be the most versatile editor imaginable.

See that button in the toolbar? Right click on it, and edit the code behind it.

Don't like the way 'Find' works? -- right click on it, and edit the code.

Need a new button in the toolbar? So add it already, with a single click.

Share packs of extensions and macros with other users.

Everything in MetaNote is under your control, effortlessly, at runtime.

It's easier to show than to describe -- maybe the pictures on the right give you the idea.

The source code is available to browse or download. This is very much pre-alpha. It is explorative and non-commercial.

binaries are also available to download.

The project is written in C#, and I need your help getting it done.

I've got many of the basics done, but I'm only at the tip of what's needed.

I'm looking for clever kids like you, willing to help out.

What do you think? Can you take a look at the code, and lend your fellow programmer a few minutes of your time?

this feature needs you!

I'm not doing it for any commercial gain, i just want a text editor that I can bend to the whims of whatever writing task I come across.

There's a great many features still in need of implementing, and already there are wrong turns to be corrected.

Down the track I really want to find some way to embed the WPF-based Text Editor Control from VS2010. It's the same one used in intellipad (part of Oslo) and in Powershell 2.0's (awesome) Integrated Scripting Environment -- I didn't have any success bringing it to life just yet. So, for now the text is plain text, and features like syntax highlighting and intellisense will have to wait.

One of my mentors tells me the smart approach would be to bring in MEF for giving a really powerful plugin model, where plugins can have plugins and so on.

The intermediate goal though, is just to make the tool sweet enough that I'd use it for my own day to day text editing needs.

And one day, hopefully one day soon, this thing won't suck at all.

Read On...


Sat, 18 Apr 2009 10:21:54 GMT

Further proof that testing is for wimps and bad programmers

Escape Csv

Couple of days ago I wrote a C# function for a colleague and emailed it to him.

This is the function:

private static string EscapeCsv(string value)
{
  //Double all quote characters
  value = value.Replace("\"", "\"\"");

  //If it contains a comma or a quote char -- qualify it with quotes.
  if (value.IndexOf('"') > -1 || value.IndexOf(',') > -1)
  {
    value = "\"" + value + "\"";
  }

  return value;
}



The syntax highlighting looks very strange, because I wrote it in sql server management studio. It just happened that the only text editor i had open at the time was SQL server, so that's what i used.

(Real developers don't use any particular editor – they just use whatever's open at the time. Even the act of opening notepad is too cumbersome for the ubergeek.)

After I emailed it to my colleague I had a moment of weakness, when I suffered the tiniest smidgen of self doubt.

"Perhaps I should’ve tested the code in some way. Or -- at least -- compiled it?"

Scott Bellware and the cool alt.net kids are always banging on about this sort of stuff, so I wrote an awesome console app to test it.

namespace tests_are_for_wusses
{
  class Program
  {
    static void Main(string[] args)
    {
      System.Console.WriteLine(EscapeCsv("fred") == "fred");
      System.Console.WriteLine(EscapeCsv("fre,d") == "\"fre,d\"");
      System.Console.WriteLine(EscapeCsv("fre\"d") == "\"fre\"\"d\"");
      System.Console.ReadLine();
    }

    private static string EscapeCsv(string value)
    {
      //Double all quote characters
      value = value.Replace("\"", "\"\"");

      //If it contains a comma or a quote char -- qualify it with quotes.
      if (value.IndexOf('"') > -1 || value.IndexOf(',') > -1)
      {
        value = "\"" + value + "\"";
      }
      return value;
    }
  }
}

Naturally, the awesome code passed my awesome tests first go.

Thus I have once again shown that testing is a waste of time if you are awesome like me.

And the so-called cool kids from alt.net are just bad programmers.

Thank you.

Wait a second... I still feel I'm missing the point. Care to enlighten me?

(By the way -- pretty much every sentence in this post was sarcastic... while the story is true, my real interpretation is that i just got lucky this time. There's definitely some bugs still hidden even in a simple function like this)

Read On...


Sat, 18 Apr 2009 09:07:26 GMT

Drowning in things to do

The heart of a good 'Getting Things Done' process is to have a Single trusted system where you capture your tasks.

I guess I'm Doing It Wrong :-(. Here's all the places where I distribute my todo list...

  • In my current moleskine (pronounce it with me -- Moh-leh-skeen-ah) on pages 9, 12, 31, 57 etc.
  • in my phone
  • in outlook (at work)
  • in my code using //TODO: tags (scattered over numerous projects)
  • in my code using NotImplementedExceptions.
  • in timesnapper's hosted fogbugz account
  • in 'nextaction' on my work pc
  • in 'nextaction' on my home pc
  • in 'nextaction' on my laptop
  • in my gmail account (emails labelled 'todo')
  • in my gmail account (emails marked with a star)
  • in my gmail account (any emails from me)
  • in my other moleskine, beside the bed

Still, I think i'm pretty good because I do actually tend to 'get things done'. But also because i resist keeping lists in all these other places:

  • in iGoogle
  • in sharepoint (at work)
  • in my gmail account (using the Gmail Tasks plugin)
  • on pieces of paper on my cubicle wall
  • in my other notebooks
  • in timesnapper using flags/tasks/notes
  • in yet another todo.txt file
  • on sticky notes randomly decorating places I inhabit
  • in twitter
  • in tada list
  • in that surprisingly popular codeproject todo list
  • in remember the milk
  • in a tiddly wiki
  • in the iphone i don't have
  • in the PDA i don't have
  • in chandler
  • at trimpath 'next action' web site
  • on my blog
  • using tattoos (memento style)
  • in google calendar

There's no shortage of places to keep your things to do.

I don't worry about having too many systems. A bigger fear is failing to capture a problem as it arises.

You frequently get just one chance to capture an idea, so I capture it anywhere I can.

Read On...


Wed, 08 Apr 2009 09:47:36 GMT

Small Moments in Software Philosophy

I've been using my tiny slice of computer time to write software lately, and haven't spared any cycles for writing articles. In lieu of that, here's a series of lost notes to accompany some of my recent twitter outburts.

Abstractions should be as high-level as possible, and no higher. #

Einstein of course said,

"Make everything as simple as possible, but no simpler."

... and that's a kind of programming mantra, as so often in our race to simplify we end up over-simplifying. (The famous 'Worse Is Better' philosophy could be phrased as an argument that sometimes you should actually sacrifice correctness for the sake of the simplicity -- i.e. 'Einstein was wrong.')

In a similar vein, I think there there is such a thing as 'too abstract'. And it is a terrible thing.

Pre-emptive Abstraction is at least as bad as Premature Optimization #

  • If your class name contains the word "Abstract" -- you're doing it wrong.
  • If ClassName.("FactoryFactory") -- you're doing it wrong.
  • If ClassName.Contains("FactoryFactory") -- you're doing it wrong.
  • If Your ClassName Ends With "BaseBase" -- you're doing it wrong.
  • If ClassName.Contains("Factory") && ClassName.Contains("Provider") -- you're doing it wrong.

Economists re-evaluate bird in hand as 1.9 times bird in bush. #

A more appropriate tweet might've been:

'Economists write down bird in bush to 0.45 times bird in hand.'

Or:

'Government provides 8 trillion birds-in-hand to replace 16 trillion birds lost in bush.'

Someone (I think that cockroach poet Archy) once called humanity something like "a strange species of bipeds who cannot run fast enough to collect the money which they owe themselves."

i am *not* homophobic. Infact, some of my best friends have iPhones. #

And I'm still waiting to see them make the millions of dollars from iPhone apps that they promised themselves last year.

If a job's not worth doing, it's not worth doing properly #

The original statement: "If a job's worth doing, it's worth doing properly" has the corollary that any job that is not worth doing properly is therefore not worth doing at all.

This is patently absurb and a kind of shining example of why perfectionism doesn't pay.

The slightly twisted variation:

If a job's not worth doing, it's not worth doing properly

...may seem defeatist and sloppy -- but i think it's the very soul of true productivity.

That's what no one seems to appreciate about being rich: the first 100 bazillion is the hardest. #

After that, you can just sit back and live off the interest of the interest.

And your next code editor is... a browser. #

I still think it's true -- and once i get a bunch of other things out of my todo pile -- i'm going to make it happen. Maybe.

Meanwhile I'm working on TimeSnapper v.Next, and tinkering on something tentatively called MetaNote -- about which you'll be hearing more.

Read On...


Mon, 23 Mar 2009 07:28:26 GMT

Differentiating between environments within SQL Server Management Studio

you are about to execute a DROP statement in production, OK or Cancel?

When you're looking at a query window that's connected to Production, it would be nice if it was visually distinct from a non-production environment.

For example, there could be a red theme applied to the window.

Furthermore, there could be a warning before a potentially destructive query is executed. (Essentially, any query that isn't just a select - for example, a drop, delete, update, insert, create or alter)

This would be an effective way to lower the chance of something being done to production that was intended for another environment (pre-prod say, or development)

I can imagine a straw-man counter-argument to this concept that says:

"The only people who should have access to production are people who know what they're doing"

Or alternatively,

"Developers shouldn't have access to production"

And that's fine by me.

We can limit who accesses production, and we can give minimum privileges to those that do have access.

But even then:

*Someone* will have destructive privileges in production.

And that person will definitely have access to more than one system.

And that person, no matter how smart or conscientious they are, will be fallible.

Hence, it's helpful for that person to be able to differentiate (visually) between the different environments.

Why am I writing this blog entry right now?

Don't worry. I stopped myself in time ;-)

(And like all blog posts everywhere, there is already a stackoverflow question that says the same thing and a whole lot more)

Read On...


Thu, 19 Mar 2009 10:30:32 GMT

My code would suck less if...

My code would suck less if the C# compiler raised an error anytime it detected the following:

  • A button with no click handler.
  • A click handler with no code.
  • A parameter that is not used.
  • Code that throws A 'NotImplementedException'
  • A //TODO: token.
  • An #if DEBUG
  • A phrase that contains more than one dot, e.g. Control.Parent.Parent.Parent.Controls[3].Controls["Accept"]

Q: Why do I want the compiler to be so mean?

A: It takes a tough man to make a tender chicken.

(attributed to Purdue, quoted in 'Worse Is Better')

No, the common thread here is these are pitfalls common to a top-down, (or an outside-in) design approach.

As you move top-down, (or from front to back), you throw off "branches" -- kind of last strands -- that you need to back-track to complete later. I want the compiler to help me find those branches. (Tests are a poor substitute)

In his 2005 classic 'Does Visual Studio Rot the Mind?' Charles Petzold showed how intellisense-and-friends encourage bottom-up programming.

These are some little features that could help out the die hard top-down coders.

Details...

The Really Big Button That Doesn't Do Anything (Don't let this happen to you!)

"A button with no click handler"

Why does a button exist? Is it just to look good?

No! Buttons are for clicking!

A button with no click handler is a fail.

And a click handler with no code is a fail as well.

What does the user expect when you click a button?

Unless this is that Early Internet Phenomenom known as The Really Big Button That Doesn't Do Anything, a user expects *something* from a button.

Why would you check that in? What good can possible come from letting do-nothing buttons end up in the hands of unsuspecting users?

The world of static code analysis has gone very far – but does it stop and help us avoid this sort of psychological torture?

(This same concept may be true for many other objects that raise events. The object's author might be able to indicate "There's really no point using this thing unless you handle the following event(s).")

A parameter that is not used.

Unused variables raise a warning, but unused parameters don't.

This is a little bit good, but it's a little bit bad as well.

Here's an example where the unused parameter is clearly a bug:

    private void CopyFile(string sourcefileName,
                        string targetFileName,
                        bool overwrite)
    {
        System.IO.File.Copy(sourcefileName, targetFileName);
    }

Oops!

The programmer forgot all about the 'overwrite' parameter!

I consider that a pretty clear error.

But consider our click handler for a moment:

    private void Button1_Click(object sender, EventArgs e)
    {
        MessageBox.Show("Hello");
    }

Neither parameter is used. But if we were to call this an error, a hell of a lot of code that's shipping today would fail.

Some design changes could alleviate the dilemma – I'll leave the consideration of possible solutions as an exercise for the interested reader. The goal is to avoid busy work, not create it.

Code that throws A 'NotImplementedException', and //TODO: token, #if DEBUG conditions and everyone from System.Diagnostics.Debug

Not Implemented Exceptions are excellent stuff.

But your goal is always to eradicate them, right? They're a kind of hardcoded place holder. A warning ought to suffice. (You treat warnings as errors, most of the time, right?)

I put //TODO: tokens and #if DEBUG conditions in the same category. They're very handy scaffolding or place holders as you crank out your code -- but they're not supposed to remain indefinitely. A warning would be nice. Maybe Debug.WriteLine and its friends should fall into the same category.

A phrase that contains more than one dot, e.g. Control.Parent.Parent.Parent.Controls[3].Controls["Accept"]

Why would a compiler let you get away with this kind of monstrosity?

It would be quicker to just replace that whole line with "throw new NullReferenceException()". The effect would be the same.

My point here is that this kind of implementation of the house of cards anti-pattern is easy for static analysis tools to pick up.


I know that there are existing static analysis and code grepping tools that can be used for some of these cases, but they tend to run 'after the fact', outside the tight code-compile loop. Worse: they tend to produce a lot of noise and take a lot of care and feeding.

StyleCop is the worst 'busy work' generator I've seen. (If only they'd finished the job and had it auto-correct many of the problems it finds... instead, like '100% code coverage' it's a kind of training tool for Coder's OCD.)

Alrighty -- that's all I've got for now, though if I keep my eyes open, I bet I'll spot some more.

Read On...


Wed, 18 Mar 2009 19:16:13 GMT

"Architect" is a swear word.

Ah! that's it!

I've often wondered what people really mean when they said 'Architect' while talking about software.

None of the literal meanings seem to capture the way the word itself is applied in this context. But I think I've hit the thing on the noggin at last.

A 'swear word' is a word whose literal meaning differs wildly from its contextual intent -- and whose intent can be bent to suit a great many contexts.

Take 'F---', for example. The word has a literal meaning, something like 'To copulate vigorously' -- but in actual use, the intent is generally bent to suit the context.

For example, when I hit my thumb with a hammer I say "F---!" and in that context the meaning is: "It hurts a lot when I hit my thumb with a hammer."

Or, when I get a flat tyre I say "F---!" and it means, "This flat tyre is an unexpected interruption to my day that will cause undue expense and wasteful exertion." The quickest way to say all that is simply "F---!".

Now imagine there is a guy in your organisation whose coding skills are terribly out of date, but who is not capable of performing any managerial duties.

If someone asks you, "Who is that guy?" then you probably won't waste your breath by saying, "Him? A guy whose coding skills are terribly out of date, but who is not capable of performing any managerial duties." Instead you'll permit yourself to emit a nasty little swear word and simply say, "Him? Architect." Ouch!

Now, just say you work with an impractical fool with an over-inflated sense of self-importance who destroys whatever thing he touches, never ceasing to bring layers of accidental complexity to even the simplest of contrivances, but who is, thankfully, kept out of harm's way by being assigned the task of writing grandiose-titled corporate documents that no one is ever expected to read. When someone asks you who that guy is, you draw your breath in deep, and prepare to say:

"Him? An impractical fool with an over-inflated sense of self-importance who destroys whatever thing he touches, never ceasing to bring layers of accidental complexity to even the simplest of contrivances, but who is, thankfully, kept out of harm's way by being assigned the task of writing grandiose-titled corporate documents that no one is ever expected to read." So, again, you'd just curse and say "Him? Architect?"

Read On...


Sun, 15 Mar 2009 02:25:12 GMT

Plugins! Plugins! Plugins! It must be TimeSnapper 3.4

TimeSnapper version 3.4 went live a few days ago!

It can now run from a USB key, and is prettier in a few ways.

But the main feature is the new plugin model which lets you extend TimeSnapper with your own features.

The plugin model has been there for quite some time, but we've never publicised it before, or released any plugins that use it.

We've now released our first official plugin. A simple plugin that lets you create animated gifs from your snapshots. I've written a guide to help anyone who is interested in writing plugins of their own and provided a sample in VB, and a sample in C#. I can provide lots more examples, and information for anyone who is interested.

The animated gif plugin owes a debt of gratitude to Jon Galloway -- we reuse the Gif.Components.dll that he put together for his cropper plugin.

We're hoping to host plugins from other people -- we'll provide a nice page where people can download them. We'll help out with development, debugging and so on, wherever needed. If there's sufficient interest we'll spawn a separate forum for plugin development. (For now, the regular forum is the best place to ask questions).

Creation of an animated gif is in progress...

APIs are funny things -- and I received a hell of a lot of criticism while writing this API. The criticism came from a particular nasty and vocal user who never seems to be happy with any of the work I provide. That user is (of course) (in case you haven't yet guessed it) -- me.

So, if you're looking at the plugin model and you see something you don't like about it. Well, I understand. Constructive critcism and suggestions on how to improve the API are very welcome.

As always there are full details in the release notes, and there are lots more goodies on the way.

Read On...



Fri, 13 Mar 2009 09:06:25 GMT

Test First Development and Making a Cake

One of the mixed curses of being obsessed with software is that you see reminders of it everywhere, even in things that predate the existence of software.

For example, Cake Making.

When you're making a cake, you need to add eggs to your cake mixture.

My wife told me that you don't break the eggs directly into the mixture. Instead, you break them into a separate bowl, and then add them to the mixture.

"Why not break them directly into the mixture?" I asked.

She picked up her cookbook and turned to Appendix A -- The SOLID Cooking Principles, by Robert C. Martin.

No she didn't.

She explained that if an egg is bad you don't want to ruin the entire bowl of cake mix. And it's easier to spot little bits of egg shell in a bowl of yolks than in a bowl of cake mix.

"Ah, the virtues of independent deployment," I said.

And she looked at me askance. (Askance is not the best way to be looked at, btw).

While we're discussing eggs, I have to repeat my favourite saw:

"You don't have to eat a whole egg to know it's bad."

 

(Side point: this topic fits with the stack overflow question "What real life bad habits has programming given you?" wherein you will find over 425 similar experiences. What a sad lot we is.)

Read On...


Thu, 05 Mar 2009 17:57:47 GMT

A 3 minute guide to embedding IronPython in a C# application

A C# app that hosts iron python to perform calculations

Despite knowing absolutely nothing about Python, I've had a lot of fun and a few lttle victories with it tonight. I've built two small apps that I'll include the code for below.

I've avoided IronPython up until now, but a terrible problem has arisen lately.

I've decided to write my own text editor.

This is a bad thing. Only fools write their own text editor. Soon, hair will start growing on the palms of my hands.

But, since I'm looking for some extensibility in this editor idea (of which I'll show more in a subsequent post) I realised that hosting IronPython is the best way to get the sort of scripting I'm after.

Hosting IronPython in C# is well-trodden turf. Many other have been there and blogged it before. But the fun was really in the doing.

Here's two very short demo apps I wrote tonight, literally in under an hour.

First, by following the example Bernie Almosni provides in Extending your c# application with IronPython I built a little interactive calculator, with a history.

The code is trivial and can be downloaded below.

A C# app that hosts iron python to allow a textbox to be modified programmatically

The next example is also trivial, but I'll step through the code just quickly, since it's a superset of the previous example.

I wrote a little application that lets you write python code to alter the contents of a textbox. This is the heart of the editor I have in mind -- and it's barely 10 lines!

So, in a fresh C# winforms app, I added references to all the dll's in C:\Program Files\IronPython 2.0.1 (I didn't know which dlls i needed exactly -- so i referenced them all ;-) )

I created a new form and dropped two text boxes and a button on it, as you'll see in the screenshot.

I added these using statements:

using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;

I created two module levels variables, one to hold the IronPython engine, and one to tell it the 'scope' of the variables I want to share with it.

private ScriptEngine m_engine = Python.CreateEngine();
private ScriptScope m_scope = null;

Upon form_load, I construct the scope, and add the target text box to it. (This is the text box our Python code will be able to act upon.)

m_scope = m_engine.CreateScope();
m_scope.SetVariable("txt", TargetTextBox);

When the user clicks the button, I compile the code in the first box, and execute it as a statement.

Dead simple. Ridiculously simple.

string code = CommandTextBox.Text.Trim();
ScriptSource source = m_engine.CreateScriptSourceFromString(code, SourceCodeKind.SingleStatement);
source.Execute(m_scope);

With that in place, the python code entered at runtime, such as:

txt.SelectedText = txt.SelectedText.upper()

...has the desired effect of making the selected text uppercase.

I got the same effect in C# once, but it took five assemblies, hundreds of lines of code... it was terribly fragile and I broke it beyond repair before I got it to a source repository. A tragic episode, i still feel like stabbing someone every time I think about it. (LFT much?)/p>

So -- here's the source code:

download dodgy sample integrated C#/python code!  Sample Python Calculator and Programmable Text Box.

And here's a couple of other articles on the same topic:

Read On...


Fri, 27 Feb 2009 09:54:30 GMT

Low Frustration Tolerance: Curse and Blessing

There's a psychicologicalous condition known as 'Low Frustration Tolerance', (LFT for short... abbreviations, btw, are helpful for those with LFT ;-))

Low. Frustration. Tolerance. I am writing slowly. Just to frustrate the Living Hell out of those who have LFT.

Every day you will see examples of people with Low Frustration Tolerance. You know these people.

You're in your car, stopped at the lights. Light turns green, and before you've put your foot on the accelerator, the guy behind you blares on his horn. Hard. He's got LFT. Bet on it.

To be a programmer REQUIRES a ^^high^^ level of frustration tolerance. Most people with LFT, on the other hand (OTOH ;->) end up as drunks, hobos, drop outs, early-deaths, burn-outs.

(But stick around -- there is a twist.)

So, the only way to be a decent programmer, able to produce good output every single day is to have a high-frustration-tolerance.

The amount of frustration we encounter in the computing world, every single day, is just astounding. Many days our job consists of leaping one hurdle after another.

Sometimes, just for fun, I keep a little log of the hurdles I encounter in a day. They are numerous.

I want to get from A to B. Step A: Something goes wrong. I investigate. Dead end. I google it. Dead end. I check logs. Dead end. I increase logging. More evidence. I google that. Dead end. I download a tool that will get more info. Tool fails to install. I google the installation failure. Dead end. I look for another tool, install that, run it: crashes. I investigate the crash. Dead end. I find a different tool, install that. Get more info. Investigate that. Dead end. Google it. Dead end. Stack overflow it: dead end. Drink coffee, consider taking up smoking. Dead end. Wait two weeks, increase bounty at stack overflow. Dead end. Reboot, check patch level, look for random hints from astrological tables, listen to reggae... dread end. Sometime later, randomly: breakthrough. And on step B.

Annnyway, I've established the first point: a good career in programming requires High Frustration Tolerance.

And yet... I am utterly convinced, that the only way to succeed as a programmer is to have really LOW frustration tolerance.

You have to get fired up by tiny little things. You have to care, dammit, and care deeply, about tiny little points.

You have to pour your heart and your soul into accepting nothing but perfection from that damn regular expression, that damn CSS selector, that damn SQL case statement, that bloody mother f***ing a*****e of a *** **** son of a ******* ugly ***** ***** **** of a **** installation package, so the lucky ******* **** of an end user gets all the joy of a working system.

It's a catch 22.

And sometimes we forget that *both* skills are needed. We fall into the trap of being one or the other.

So here's my latest plea:

Stopping being so easily frustrated. And please, stop settling for second best.

And then: tell me how it's done.

Read On...


Fri, 27 Feb 2009 07:42:34 GMT

Handy cheat sheet for Visual Source Safe

After seeing this handy cheat sheet for the git version control system, I had to stop and reflect for a moment.

Despite all the attention that distributed version control systems get, I suspect that Visual Source Safe is still the most used source control system in the world.

And is anyone stopping to help the 'silent majority' learn to use their tool of choice, i.e. VSS, just a little better?

With this thought in mind, I've developed

'a handy cheat sheet for Visual Source Safe'

In all seriousness, your code is immensely valuable, and you need to respect that fact. Please use a reliable system.

If you're having trouble moving a sluggish team away from VSS, them move them onto Sourcegear vault. It re-uses the concepts and the look of VSS, but adds in reliability and a lot more.

If you're new to version control, or have projects that don't use *any* version control, get subversion up and running. It's easy to use on every system and it's free.

Git, etc: If you're a candidate for using a DVCS, then you already know all about it and don't need to take advice from an idiot like me.

One other plea: if you have 'little' projects that are 'too small to bother with source control' -- just re-think it.

Hooking up to a free subversion repository is easy, and beneficial. Hard-drives do crash, you know. And sometimes, you do need to roll back, you know.

Cheers and best of luck.

Read On...


Fri, 13 Feb 2009 11:27:42 GMT

Found Time!

There's a malady experienced by some folk, known as 'lost time'.

The condition arises when a chap looks around, stunned, suddenly finding themselves far from home, dressed in someone else's clothes, driving someone else's car, with no memory of how they got there, or what happened in the last 3 months. Time was lost.

Through the law of equilibrium I deduce there must be an equally common condition whereby time is found. Some harried, stressed-out individual is bemoaning the fact that they've got so many tasks and so little time, when suddenly they realise oops! today isn't Thursday -- it's only Monday -- and there's an extra 72 hours of bonus time, delivered from nowhere!

Project managers, of course, live in the optimistic belief that this syndrome will suddenly attack their whole team in spadefulls.

I've even known project manager's to try and slip a whole extra month into their nasty tricksy Gantt charts. ("Umtember" falls between November and December.)

If you happen to be infected with a wicked dose of Found Time, please take careful notes regarding cause and contagion, so your time-poor brethren can benefit.

Thank you.

Read On...


Sun, 08 Feb 2009 09:33:42 GMT

8 ways to be a better programmer in 6 minutes.

Remember how Justice Gray started that little fad about becoming a better developer in 6 months?

Well, that was a while ago and most of you failed. Badly.

So here's a simpler challenge, some ways to be a better programmer in 6 minutes.

You've got 6 minutes, right?

Go for it!

  1. Use a bigger font size.

    This is ridiculously easy -- but it works.

    Go to your favourite IDE, and crank the font-size up. I switched from 10pt to 14 pt. The difference is that a lot less code fits on the screen at once.

    The effect is: you're forced to write shorter methods. And that's a Good Thing.

    (Scott Hanselman recommends that one)

  2. string highlighting
  3. Make hard-coded strings look ugly.

    I learnt this from Joe Cooney.

    Go to your favourite IDE, and set it so that literal strings stand right out -- for example a yellow background with a red font. Make 'em ugly. Damn ugly. This will encourage you to perform less hard coding, and to notice when you are embedding strings in your text.

  4. Pick an 'obscure' keyword and master it

    Do you fail to yield?. Is there a keyword you never use?

    Every keyword has a purpose. Learn to master those mystery keywords and your powers will become extraordinary.

    Here are lists for a few .net languages: C#, VB.net, F#.

  5. Increase code-coverage by 1%

    Don't kill yourself striving for 100% coverage of code with automated unit tests. But take a few minutes to increase your coverage by 1%.

    Most likely, that means going from 0% to 1%. And that's the biggest improvement of all.

    Find a particularly ghoulish regular expression. Or a critical piece of business logic. These things can't be trusted without tests.

  6. Read the code from an open source project

    Sometimes, when I'm looking at the code of a complete stranger, I get that same, weird feeling I get when I'm creeping through my neighbour's house. Picking up their stuff, looking through their fridge.

    Learn to overcome the creepy sensation, and bring on the learn.

    Maybe start with Hanselman's Weekly Source Code series.

  7. Run a static analysis tool against your code

    Use fxcop, or StyleCop, clone detective, ndepend, the code metrics feature of VS 2008, or any other static analysis tool of your choice.

    Uncover your greatest weakness. Even a cursory glance at the output will leave you distraught at just how much room you've got for improvement.

  8. Pick an ugly method to refactor

    You know the method. That method you're particularly ashamed of. That one that's long and ugly and horrible. And it's crucial to the whole application.

    You don't have to polish it from a turd to a diamond, but just neaten it up a little. Rename a variable. Hoist part of it out into a separate method. Start simple. The momentum will increase. Watch out.

  9. Stop reading, start writing.

    And don't just write. Write a compiler!

    This ol' msdn article is a good place to start. Joel Pobar will get you writing your own language compiler in but a handful of minutes.

That's all I've come up with for now. But what've you got?

What are some 6 minute activities that helped you be a better programmer?

Read On...


Fri, 30 Jan 2009 11:25:03 GMT

The Deadly Cycle of Meetingitis.

Consider this little step-sheet.

  1. Q:What do managers do when they're stressed?
    • A:They call a meeting.
  2. Q:What gets managers stressed out?
    • A:When projects are not making progress.
  3. Q:When do projects fail to make progress?
    • A:When people spend too much time in meetings.

Thus we have the rise of meetingitis -- a deadly malady that has struck down many otherwise healthy projects.

Once the disease has set in, the prognosis is grim.

The only aproach is to prevent the syndrome before it develops.

How do you prevent meetingitis?

Many people foolishly think that meetingitis is caused by 'too many meetings.'

But look closely at the steps above and you'll recognise the root cause is stressed out managers

Picture this futile attempt at preventing the syndrome:

Jack is a busy coder trying to implement his code.

He says to the manager: "I don't want to go to the next meeting. I'm not making enough progress, so I'm not gonna attend your stupid meeting."

What happens next?

Jack may get out of that particular meeting. But what is the larger effect? will the manager become more or less stressed? More stressed of course (rhetorical question) and what happens then? The manager, now in a state of complete freakout, calls extra meetings: status meetings, emergency meetings, all-hands-meetings, crisis talks, war-rooms, action-squad meetings and before you know it the meetingitis has reached its final stages: the manager decides to form a committee.

The only approach that can possibly work: deal with the stress itself. Put the manager at ease.

Communicate more, in order to meet less. Be proactive in your communication. Don't wait for them to call a meeting. Tell them what's going on. Produce regular reports. Don't "promise" to produce regular reports -- just produce them. Let them listen in on some of your day to day chatter. If you have daily standups, bring the manager in. Stop baffling them with technical mumbo jumbo. Feed them edible slices of information. Walk them through it in bite-sized chunks. Give them documentation tasks to keep them feeling important. Give them communication tasks. Draw pictures for them to stick on the wall of their office. Give them some kind of flashy management information portal that has interactive charts (you don't need to hook them up to any real data -- a random number generator ought to do it). Or maybe there's a better way?

What do you do?

How do you prevent meetingitis?

Read On...


Sat, 24 Jan 2009 09:41:58 GMT

Can You Cure the Copy/Paste Disease?

The other day, someone on stack overflow said they wished copy and paste were not permitted within an IDE.

It's a wacky idea - but sometimes I'm inclined to agree.

Maybe it shouldn't be completely illegal - but it could be harder to do (in specific circumstances), or tracked more closely.

At one point (perhaps long ago, perhaps today...) I stumbled onto this chunk of code [at right], and I thought "Hmm, interesting lack of reuse..."

Why use a data structure when you can copy and paste your code?

It's only a little code smell, right?

Not really, because you know that where people have the 'copy/paste' bug... it's only going to get worse.

Let's zoom out and see what we find...

The code sits inside this method... -->

(There's other issues there too, but let's leave them aside today, please.)

And the very next method down is almost identical -->

Then - I look at the next class - it's an almost identical class, and it has two methods of its own with identical names to the ones above and only very slightly different code...

So we're talking about a serious case of "Achieves reuse through the cunning application of copy and paste"

And you know it doesn't stop there.

It just keeps going - thousands of lines of copy/pasted code. File after file. Bugs here and there (notice the 'harmless' bug in the first snippet?) quirks abound.

It's a fractal! The more you zoom out, the more you see the same pattern copied, pasted, modified, and reapplied over and over at greater and greater levels of scale. The author's entire career could be composed of the same programs, copied, pasted, and modified, retrofitted to slightly different problems.

Copy/Pasting is like the weather. Everyone complains about it, but nobody does anything about it.

If copying and pasting were illegal (or more difficult) - would the implementer have thought about achieving reuse through other methods?

Illegal is taking it a bit far. So: how could the copy/paste virus be reduced?

Maybe clippy could pop up and say: "It looks like you're copying and pasting code. Do you know that you can achieve re-use in other ways?" (Maybe we could use Scott Bellware's face on clippy? eh?)

How about this... every time you use the "paste" function inside your IDE, a little counter is incremented. And that counter is displayed on a gigantic, glowing LED panel suspended from the ceiling above your desk.

Or: Every time you use the "paste" function inside your IDE, a loud buzzer sounds for ten minutes, and a flashing red siren pops up over your desk.

Or: Every time you use the "paste" function inside your IDE, your screen is locked out for ten seconds.

I think you'd only need to apply a technique like that for a few minutes a week and you'd soon be permanently cured of copy/pastitis.

My friend OJ suggests...

"an enterprise Copy and Paste server, which acts like a petrol tank. Hence you only get to use your copy and pastes wisely before you run out."

Perhaps a plugin would need to detect when code is copied and pasted from within the ide. It would only punish you when the copied code (and subsequently pasted code) contains some degree of logic.

And before you say it -- I know there's a tool called Simian that you can plug in to your continuous integration server, to detect this sort of nonsense. I haven't tried it, but I'd like to know more. (They're Australian by the way)

Also -- an apology

Let me be crystal clear about one thing... writing this kind of code doesn't make you a bad programmer.

This particular code was written by a very successful programmer, who does an excellent job of delivering value to the business.

It is definitely a better example of programming than a hell of a lot of code I've seen in the business world.

I'm just decrying the fact that sometimes we work harder not smarter, and if we trained ourselves into the right coding habits, we could achieve both: work hard and smart.

Read On...


Thu, 22 Jan 2009 10:13:09 GMT

Don't make 'readonly' fields less readable

Help me, Obama. You're my only hope.

There's a common UI anti-pattern of making "readonly" fields harder to read than editable fields.

I think this is a poor technique. I blame it on Windows Forms -- but I've seen it out there on the wild web as well.

If a control is readonly, then you should cater for the user actually wanting to read it. Shouldn't you?

Newspapers, for example are readonly. And they are commonly in black and white. Fine, crisp, perfectly legible black text. Not dull gray.

Rather than making the readonly fields dull gray, use some other form of visual hinting to differentiate between what can be edited and what can't.

For example – here's some readonly checkboxes.

They are shown as dull gray with gray border.

Instead, the check marks could be black, while only the control border is gray.

Or, perhaps the control border could disappear.

What about this drop down list – its 'readonly' status is indicated by gray text and gray border.

It gives the impression that it has no meaning and no influence. In fact, it's message is fairly important - perhaps extra important since the user has no control over it.

It could instead have black text and gray border.

How about black text with NO border. It's easy to read, and it's clearly not editable.

I think that both of these are preferable to the 'make it gray' approach. Don't you?

Read On...


Tue, 20 Jan 2009 10:18:26 GMT

It's 2009 already -- where's my damn internet-based IDE??

It's not a tuna!It's not a tuna!

Somewhere in my hard-drives I've got a very length and never quite finished article on this topic.

The Online-IDE. What a thing of beauty. What a must-have. What a killer app.

And of course: What a horrible idea! What a monstrosity!

I think I started trying to write about the topic in about 2003. And I was pretty serious about it then. I started building one. Twice!

It seemed like it was only just beyond the state of the art. Sure there were challenges. But there was this thing i'd discovered called httpWebRequest... and with it's power, the Online IDE seemed inevitable.

Well, it's 2009 now and we're still stuck with these crazy desktop IDE's. But how long now, until the IDE goes online?

"Maybe not tomorrow, and maybe not the day after that. But soon, and for the rest of your life, you'll be programming online."

What do you think? Inevitable?

Here's dodgy pictures of some of those I found.

It's not a tuna!It's not a tuna!

'The web 2.0 database' lists a lot of Online Development tools and there's a Big List at itredux.com

The main one I'd heard of is heroku garden (formerly heroku), which combines Ruby with Amazon's cloud compute offerings.

Plenty of people mention CodeIde and Coghead. Yahoo Pipes and Microsoft Popfly are not qute the target topic, but they get an honorable mention.

Assume that your children's generation are using online programming environments for all of their programming needs. How do you see it working? What innovations are required to make it feasible?

 

Read On...


Sat, 10 Jan 2009 02:42:38 GMT

Give and Take in the Software Industry

(It's long and it's preachy -- but I hope you enjoy it)

John F# Kennedy speaks his mind about programming techniques
JFK speaks his mind about programming techniques


That great software programmer John F. Kennedy once famously said:

"Ask not what your software project can do for you - ask what you can do for your software project."

(Few people realise the 'F' in 'JFK' stood for 'Fortran'.)

I'd like to go one step further than JFK, and look at both sides of the deal: What you can do for your project as well as what the project can do for you.

In putting this list together, I'm going to steal liberally from two classic articles "The Joel Test" and "The programmer's bill of rights"

Here's the quick overview...

What can the project do for you?

First up we have a bunch of items along the lines of "I expect -- maybe demand -- that management will provide me with..."

  1. Two monitors
  2. A fast PC with a crapload of RAM
  3. Choice of mouse and keyboard
  4. A comfortable chair
  5. Quiet working conditions
  6. Internet unlimited
  7. Freedom to install software
  8. The best software
  9. Good coffee
  10. Sensible working hours
  11. Separate Environments for dev, qa and production

What can you do for the project?

But it's not all "take take take".

The other side of the equation are items along the lines of "I am committed to ensuring that these practices are performed..."

  1. Source Control
  2. Continuous integration
  3. Track bugs
  4. Unit testing
  5. Code analysis
  6. Continual peer review
  7. Peer training
  8. Keep yourself up to date
  9. Learn to Communicate with non-technical people
  10. Refactor!
  11. Passion
John F# Kennedy asks management for a second monitor
JFK asks management for a second monitor


Part 1: What can the project do for you?

Two monitors

The research is in. It's worth ten times its price. Give your dev two monitors.

A fast PC with a crapload of RAM

There's a messed up philosophy-- a kind of offshoot of the 'eat your own dogfood' school of thought -- that insists developers should have the same desktop rig as end users. This is nonsense.

End users aren't running three virtual machines, a local database server, three instances of visual studio, and two instances of blend. Devs need a hot rig with massive RAM. Anything less is ridiculous.

Choice of mouse and keyboard

Want to see a perfectly sane developer go nuts? Give them a bad keyboard. I have anecdotes around this topic... terrifying anecdotes that would turn your hair white... but the people involved are all still alive and i can't spill the beans. Trust me. Don't f*** with a developer's keyboard. Bad things happen.

A comfortable chair

This isn't just a programming thing of course, it's crucial for all office workers. The productivity loss from one screwed-up back could buy Herman Miller chairs for the whole company.

Quiet working conditions

Four-walls and a door might be too much to ask, but at least organise the open spaces in ways such that the shouty/squealy-teams are separated from the thinky-teams.

Don't put marketing next to the devs. Don't put the help desk next to the devs. Don't put the angry shouting Glengarry Glen Ross-style sales team next to the devs. In an open space, use baffles and greenery to isolate the noisy teams. Consider the different Yerkes-Dodson requirements for optimum performance from each team.

John F# Kennedy's workstation includes a state of the art console and a swivelling chair
JFK's workstation includes a state of the art console
and a swivelling chair. Uniform: relaxed


Internet unlimited

Consulting has shown me some pretty weird scenarios. I've worked at places where they insisted that 'contractors don't get internet access' and i've seen plenty of places where there are heavy handed website filters in place. 'This site is banned because it looks like a blog' -- for example, WTF? Even worse: "sorry, you can't use google, our company policy is that we use yahoo." WTF? If you choose to work with people, put some trust in them. Monitor them if you must (and tell them if you do) but don't put roadblocks between them and the obscure information they're trying to get their hard-working hands on.

Freedom to install software

Group policies, S.O.E.'s, limited user privileges -- these are all good and helpful things that IT departments need to keep their own sanity. I get it. I know. But let the devs break out of the box, please. Tell the dev's that they're on their own if the stuff they install causes problems. They have to fix their own messes -- but give them the freedom to install whatever dinky little weird utility they need from one minute to the next.

There's plenty of specific tools I've installed to use just once in my career, and then never needed again.

Having to fill out a series of forms on such occasions is a waste of everybody's time.

The best software

Why for the love of god is .net 1.0 still in use? Why are you advertising for a VB6 developer? Why do you make developers manually track the differences between two databases? Why do you let developers roll their own code generator? Because you're a stingy short-sighted fool I guess.

This is seriously black coffee

Good coffee

What is this crap we're drinking? Nes-frickin-cafe granulated food service blend? You had better be kidding me. Get me a goddamn macchiato. Now. Then back the hell away and let me write my goddamn code.

(Image courtesy of Rands in Repose)

Separate Environments for dev, qa and production

You can't afford testers and you just want me to fix it in production, eh? That's awesome. That's great. Next time the dentist is drilling out a cavity in your mouth, I'm going to tell him "This is an urgent operation. Let's not waste time on X-rays. Just start drilling, you're bound to hit something that's rotten. And let's save a few dollars and cut out the anaesthetic altogether."

Part 2: What can you do for the project?

Source Control

If they don't have source control -- you create a subversion repository. If they do have source control, but they're using VSS, you can move them onto Sourcegear vault. (It's an easy transition and it overcomes most of VSS problems.) If they're using vault you can move them onto subversion. If they're using subversion you can bump them up to mercurial. If they're using mercurial you can push them into git.

Okay -- don't change things just for the sake of changing them, but make sure you're using the best source control solution available to you, you're using it well, and everyone's using it.

Continuous integration

If there's no daily build, then put a daily build in place. If there's a daily build, them make sure it starts with a clean environment (no cheating) and make sure it builds everything, not just a couple of things. If the build is good, then make it continuous -- make it happen on every check in. If the build is good and continuous, make sure the communication lines are clear -- everyone can tell the status of the build at any moment. If all that's in place... well move onto another point.

Track bugs

Email is not a bug tracking system. You can't run queries over email. Email slips through the cracks.

If there's no bug tracking system, set up a shared spreadsheet. If the only bug tracking is some crappy shared spreadsheet then use sharepoint, or install Jira. If the only bug tracking system is sharepoint or jira, then install lighthouse. If the team are stuck on lighthouse then purchase Fogbugz. If TFS is available, make sure the workitem tracking is well configured and well used. If checkins aren't associated with bug numbers, make it so.

Build whatever tooling you need, above what the products you use offer, to ensure that the bug tracking works for you.

John F# Kennedy asks the users for their opinion on his ERD
JFK asks the users for feedback on
the proposed entity-relationship diagram


Learn to Communicate with non-technical people

Stop baffling them with bullshit. You don't do it on purpose (well, not usually) but you still do it way too often. Stop using technical terms with non technical people. Find the simplest way to state your ideas. Leave implementation details aside. Dummy it down. The end user has a full life of stressful issues all their own, without having to translate into your crazy mumbo jumbo.

Unit testing

If there's no unit tests, identify hotspots, start slow.

Start with regular expressions. Never trust a human's ability to write regex. Every regular expression needs solid unit testing. Focus on critical business logic. Focus on stuff that matters. One by one, knock them down. Every gain you make is a victory. Feel free to celebrate.

If unit tests are already included, but they're not part of the build, put them in the build. If there's a good amount of unit tests, then get code coverage metrics into the build. Set interim goals -- increase coverage by two percent within a week. And then increase it some more.

Code analysis

The build is running -- but how bad is your code? Run FX-Cop on every build. You're running FX-Cop? Then fix your problems. Identify common problems and fix them in batches. Update the list of exceptional terms (this is like adding new words to a spell check dictionary). You've done all that? Run further automated analysis. Fold n-depend into the build. Oh and before I go on... please, for the love of god, treat warnings as errors. Clean up that dirty code you're shovellin'.

John F# Kennedy dressed as a US president
JFK dressed as a US president


Continual peer review

You want to create a workplace where you understand and learn from each other's code, constantly. The trick is to make it non-confrontational. If it happens rarely, it's going to seem confrontational -- but once it happens routinely it will be an understood part of the workplace. Some places use code reviews prior to every checkin, some places use continual pair programming. Use what works best for you, but make sure code ends up being owned by the whole organisation not just the individuals.

Peer training

Teach each other. Discuss code, discuss business. Talk to each other. Say hello to each other in the mornings. Train each other. Organise lunch time brown bag sessions. Attend user groups. Talk at user groups. Be active in your community.

Keep yourself up to date

Don't let your skills stagnate. Don't stick to what you know -- put yourself outside your comfort zone as often as possible.

I'm not saying you should learn every shiny new technology you see -- but I am saying that you should take responsibility for your own continuous education. Moaning that your employer doesn't send you on courses is ridiculous.

Refactor!

Fix the little things. Fix them often. Improve method names. Improve variable names. Be consistent, be clear. Extract methods. Focus on those terrible long methods. Reduce cyclomatic complexity. Get a second opinion. Talk about your code. Little fixes add up.

Passion

Passion? Passion? What the hell does he mean 'Passion'?

It's not enough to do all this other stuff as well? I've got to give my heart and soul to the project too?

No -- you don't have to go too far with it. You don't have to take everything personally. But you've got to care. You've got to give a shit about the code you write and the people who use it. If you don't care about it, you're never going to enjoy it properly.

Yes, it's a frustrating job, where little details threaten to derail the entire project at every moment. Yes, you are surrounded by silly ass-hat clowns who don't understand a thing about what you are trying to achieve. Yes, it's tedious and gruelling and it makes your brain hurt. But you've got to care dammit. There's no shortcut on that one.

Read On...


Sat, 03 Jan 2009 08:46:10 GMT

4 Types of Person (a guide to stupidity)

Summary.

You're an idiot. Deal with it.

The longer version.

I've been pondering the chronic over-supply of stupidity, and I've come to a new conclusion.

Stupidity itself is not the problem. Abundant stupidity is inevitable. The problem is the people (like you, for instance) who don't even begin to suspect that they are stupid. People who insist they're God's gift to intellectual discourse. But in reality: as thick as whale blubber.

So here's a matrix to show four different types of people... the cross product of those who think they are smart (or dumb) and those who are actually smart (or dumb).

4 types of person


thinks he is...

 
dumbsmart
is actually
dumb
 
forest
gump
homer
simpson

smart
 
detective
columbo
mr
spock

This matrix has four types of people. Stealing an idea from my usability-buddies i've assigned a 'persona' to each quadrant:

  1. Forest Gump: stupid, but he knows it.
  2. Homer Simpson: is actually dumb, but seems to think he's the cleverest guy alive.
  3. Columbo: is actually smart, but comes across as quite a dope.
  4. Mr Spock: smart, and knows exactly how smart he is.

Here's a pictorial version.

4 types of person


thinks he is...

 
dumbsmart
is actually
dumb
 
forest gumphomer simpson

smart
 
detective columbospock

And here's my guess at how common (or rare) each of the four categories are.

(I started with the rule that only 20% of people could be called smart, and then assigned a breakdown after that.)

4 types of person


thinks he is...

 
dumbsmart
is actually
dumb
 
2%78%

smart
 
5%15%

The chief lesson: lots of Homers, very little of everything else. The stupidity vortex is spreading. More on that later.

The goal, interestingly enough, is not to end up in the lower right (Spock) but in the lower left (Columbo).

Why would a smart person (a Spock) decide to put themselves in the third quadrant and become a Columbo? Because they're smart enough to realise that they're really stupid. Stupid for two reasons.

Two things make you stupid

idiocy versus genius

There's two reasons that a smart person should realise they are still, essentially, stupid.

The obvious thing is that no matter how much you know, your knowledge is an insignificant dot compared with the sum total of what can be known. (It's even very small compared with the sum total that other humans currently know.)

But here's the real kicker: every idiot in the world knows at least one or two things you don't know.

I've gone all out and used Powerpoint to create a venn diagram (at right) to help illustrates this point.

Here we're comparing a genius with an idiot -- and the size of the circles indicates the relative size of their 'knowledge' or wisdom or intellect or some other hard to measure, but easy-to-chat-about concept.

Clearly the genius has greater brain points -- and indeed knows almost everything the idiot knows. But look out genius, because there's still a little slither of things the idiot knows that you don't know. And this is a humbling thought.

The idiot won't hesitate to grab onto those one or two tiny points and rub your nose in them mercilessly. Trust me on this: I've done it to smart people many times over.

So don't get too cocky there Spock. Chill out, Yoda. Pull your head in, Gandalf.

Stopped Clocks

To remain humble even in the face of blatant stupidity, never forget:

"Even a stopped clock is right twice a day."

Tattoo that on the back of your eyelids.

The real lesson

But the real lesson is this: if you think you're Spock, you're much more likely to actually be Homer Simpson.

Please, dear idiot reader, err on the side of safety and assume that, like me, you are a mental ass hat with much to learn. We'll all be better off.

Final word: How To Get Smart

One final word though, on a more positive note... it might be possible to actually become smart. Imagine that?

I haven't tried this personally, but according to 'Wetware refactorings' which quotes 'Pragmatic Thinking and Learning: Refactor Your Wetware' by Andy Hunt:

...in a rich environment with things to learn, observe, and interact with, you will grow plenty of new neurons and new connections between them...

Your working environment needs to be rich in sensory opportunities, or else it will literally cause brain damage.

Read On...


Fri, 02 Jan 2009 11:46:14 GMT

baby steps in microsoft robotics studio...

i've always been itching to tinker with microsoft robotics studio -- but i put it on my list of "things NOT to do" a long time ago. There's not enough time to play with every good thing in life.

But last Christmas i spent a bit of time on making fractals in logo, and learning F#, and drawing awesome robot pictures... so it's only fair that this christmas i'd crack out microsoft robotics studio and give it a tinker.

As a bonus, my nephews are around and I was hoping to help get them hooked on a life of computer programming.

first impression:

stupid roadblocks. I know this is an awesome base operating system to unify and enable all the robotics systems of the world... but my god, nothing is obvious. The "pit of success" idea seems to have overlooked these guys.

I like to jump in anywhere and hope that it makes sense. That didn't seem to be appropriate here. Jumping in anywhere lead to confusion.

So I swallowed my pride and headed to the first tutorial. That was utterly lame. So I moved to tutorial 2. Lame. There is no tutorial 3... no sure why, but the next in line is tutorial 4. I loaded that in visual studio, compiled and ran... okay... some potential here... something to sink my teeth into... but oh god, how about that confusing user interface from the team that UX forgot.

Quick reminder about User-Interfaces By Developers

Dear developers (and this includes me) -- please don't open up the windows forms designer, blow chunks wildly, and then publish it to the world.

Either get a usability expert to provide some nice feedback or, at the very least, see if your little sister can understand how to use it. Pure developer UI can be a terrible thing.

Now back to the task at hand.

the order in which things are pressed in the dashboardthe dashboard, common to microsoft robotics tutorials

Explain this to me... someone... please...

Variations on this 'dashboard' form are common in the tutorials. And it's very 'developer UI'. This form is fail.

Generally if you click anywhere on this form you get two responses: nothing, or an exception.

After a lot of experimentation I worked out that you have to click in the boxes in a particular order (that the UI doesn't give any clues about).

Your average programmer would be able to work this out quite easily if they were motivated. Fine. But don't even think about handing this to your little nephews.

After working out the right order, we went in to the code (we being me plus my brother in law Rick) and re-ordered the controls to make it more appropriate, and gave better feedback on errors. A two minute refactoring, seriously.

yay! arm defeats blocks.

Now we found that, with meticulous clicking and typing, we could convince the articulated robot arm to move in whatever way we wanted. (Yay! We knocked the dominoes over!)

It was cool in a way that only your most-geeky segment of the audience could begin to comprehend. For example, I loved it. But the nephews: not so much.

I'm pretty sure it gave little more than a whiff of the real power of this platform. I've listened to podcasts where people rave about the concurrency and coordination runtime, and the way real industrial houses use this software to simulate, build and control their real-world robots. From where I am right now, it takes quite a bit of imagination to see those distant capabilities.

Some things I'd love to be able to do:

  • click on an object in the simulation environment and thus have it 'selected' in the remote control. (or even less -- float over an object in the simulation and have its name as a tooltip)
  • record a series of movements and replay them.
  • use a logo-like language for talking to these little robots. The powershell team could give great guidance on this.
  • move the cameras around. (I know I can work this out programmatically -- but it's a pretty basic thing I shouldn't need to be a programmer to achieve)
  • Hit reset -- to get the scene back to how it was at the start.

Computer games are full of lessons. They give you clear goals that get progressively harder. What each 'simulation' needs is an obvious goal. The final goal for tutorial 50 might be: write an autonomous robot that can drive 100 kilometres through rough terrain, unassisted. Some goals from intermediate levels: tell a robot to move; teach a robot-mouse to solve a puzzle; use a vision sensor to shoot down a robot duck.

In the meantime, anyone know what would be a good robot to purchase? I'd like to get a real world robot, provided I can also tinker with it in robotics studio. Some of the things i'd like it to be able to do for me:

  • Mowing the lawn, including trimming the edges.
  • The shopping (everything from keeping track of supplies, to collecting the goods)
  • Organising breakfast (and cleaning up afterward.)
  • Noticing when the batteries are low on my phone (or ipod, or camera, etc.) and re-charging the items as needed.
  • Hunting down and killing anyone who has ever annoyed me.
  • Giving gifts to children once per year.

I imagine he'll look something like this -->

Read On...


Hey good looking!

I see you've scrolled all the way to the foot of the page. Check out the secretGeek archives!

Articles

NimbleText 2.0: More Than Twice The Price! NimbleText 2.0: More Than Twice The Price!
A Computer Simulation of Creative Work, or 'How To Get Nothing Done' A Computer Simulation of Creative Work, or 'How To Get Nothing Done'
NimbleText 1.9 -- BoomTown! NimbleText 1.9 -- BoomTown!
Line Endings. Line Endings.
**This** is how you pivot **This** is how you pivot
Art of the command-line helper Art of the command-line helper
Go and read a book. Go and read a book.
Slurp up mega-traffic by writing scalable, timeless search-bait Slurp up mega-traffic by writing scalable, timeless search-bait
Do *NOT* try this Hacking Script at home Do *NOT* try this Hacking Script at home
The 'Should I automate it?' Calculator The 'Should I automate it?' Calculator
aaron swartz: the early works aaron swartz: the early works
Finding (and removing) duplicate files on your hard drive Finding (and removing) duplicate files on your hard drive
Harvey, a .net chat server built with RabbitMQ Harvey, a .net chat server built with RabbitMQ
LeonBambrick.com LeonBambrick.com
So your domain has been stolen. What now? So your domain has been stolen. What now?
kv can remember it for you, wholesale kv can remember it for you, wholesale
Hello IT Department Hello IT Department
Dialog Between a Man and His Vista Laptop Dialog Between a Man and His Vista Laptop
NimbleText 1.6, Codename Jetboat NimbleText 1.6, Codename Jetboat
On Task Hoarding and Todo Bankruptcy On Task Hoarding and Todo Bankruptcy
Developer UI Done Right: Mercurial Commandline! Developer UI Done Right: Mercurial Commandline!
Rediscovering the Amstrad CPC 6128 Rediscovering the Amstrad CPC 6128
Just Wally Just Wally
The Correct Order for a First Time Viewing of The Lord Of The Rings The Correct Order for a First Time Viewing of The Lord Of The Rings
A new era for Android. A new era for Android.
Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes. Got CSV in your javascript? Use agnes.

Archives Complete secretGeek Archives

TimeSnapper -- Automated Screenshot Journal TimeSnapper: automatic screenshot journal

25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Universal Troubleshooting checklist Universal Troubleshooting Checklist
Top 10 SecretGeek articles Top 10 SecretGeek articles
ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Realtime CSS Editor, in a browser RealTime Online CSS Editor
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker


[powered by Google] 


How to be depressed How to be depressed
You are not inadequate.



Recommended Reading


the little schemer


The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
OJ Reeves
Eric Sink

Aggregated Links

proggit
dzone
hacker news
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
weekly link post

LinkedIn profile
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
Aussie Bushwalking
BrisParks :: best parks for kids in brisbane
PhysioTec, Brisbane Specialist Physiotherapy & Pilates
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2003 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2003 .: privacy