Archive for December, 2005

Unit tests plus Code Coverage, that is the kicker

Wednesday, December 14th, 2005

I just had a bit of a tada moment with test driven development. Unit tests are nice to have but lose a lot of value without code coverage results. The idea is that you want to be confident your code can handle what it is supposed to handle. You need to be confident and so you write unit tests to bang it about and make sure bits don’t fall off.

If you don’t do code coverage reports against your unit tests though you can’t be confident that all of your code is being tested. And believe me you will come across routes through your code that you never thought possible. So don’t fool yourself into thinking you don’t need code coverage because your master genius brain is all knowing. It isn’t, take a hit of humble juice man.

All of that I was told and understood and thankfully I am a humble programmer who is happy to have anything that can sort out his mess of wires.

The tada moment though came today while doing some unit tests for validation code I had yet to write (test driven development, remember.)

A class was meant to have a Validate method in which a series of checks ensured the values in the properties were all above board. I started out with some length checks on string data, did some numeric tests and then started on making sure that the string properties were not null and not empty. The Validate method would throw exceptions if it came across invalid data. These were ArgumentOutOfRangeException exceptions and almost all of the checks threw the same exception. The unit tests in turn ensured that as the bad data was passed-in the code threw the exception.

So all hunky-dory (that is a programming term for “I haven’t got a flying clue what is going on but it hasn’t fallen over yet so all’s good.”) and code coverage was at 100%.

I then did the null test on the Title string property and implemented the null check in the Validate method. That, and all the other tests, passed but suddenly my code coverage was way down to 34% or something awful. I nearly cried, our test manager was sure to beat me for having just 34% code coverage. What the hell was going on.

It turns out that because the null check threw an ArgumentOutOfRangeException and because the null check was at the top of the Valdiate method it was throwing for the other tests which were testing for other things but expecting that very same exception. So to the other tests it passed. But to code coverage there was a big chunk of code below the null check that was never run.

So the unit tests all passed but code coverage didn’t and that is what alerted me to a problem in the validation code. I was then able to fix that and have passing unit tests and 100% code coverage again.

My test manager will be so pleased.

Sleeping kills

Wednesday, December 14th, 2005

a six-year study of more than one million adults ages 30 to 102 has shown that people who get only 6 to 7 hours a night have a lower death rate.

from Sleep study.

Maybe there is some wisdom in the saying; Sleep when you are dead.

Joke aside, what an hilarious sentence. Read it a few times and think about it. Everyone dies folks, no matter how much or how little they sleep.

My nick is not my username

Tuesday, December 13th, 2005

I have noticed this in a few websites of late. They replace “Username” with “Nickname” on registration and login forms. Frankly I think it is a poor choice of labelling. Firstly my nickname is not my username. Secondly the details I log in with should never be displayed to the outside world. Not because I am paranoid but because my username is ugly and rather long. It is ugly and rather long because that guarantees that I can consistently use it when registering with new sites. I don’t want that long and ugly username to be how other users of social websites see me.

In Plazes case (the screenshot is from them) I was a bit confused by the registration form too. I wasn’t sure if the Nickname field would be my login ID or whether it would use my email address. To be safe I put in my long, ugly username and thankfully so as it turns out the Nickname field is the login ID. If I wasn’t playing it safe I might have ended up with a login ID of CrazyMonkey which I’d be regretting by 8 tomorrow morning.

Nicknames change. They are display names. They go in and out of fashion, some days you want to be fun and vibrant with it, other days you want to tell the world to back off with it. Over the years we all get nicknames, some stick and others fade.

To have that as the basis for your login is a bad idea.

Flickr has it right in my opinion. Your login ID is your email address and you can change your display name whenever you want while your Flickr URL is a once off, unchanging URL (to avoid link breakage down the line.)

Sensational

Tuesday, December 13th, 2005

Huge. Terrible. Crushed. Ravenous. Deadly. Awesome. Power. Massive. Deafening. Blinding. Titanic. Disastrous. Death defying. Razor sharp. Massively powerful. Shockingly big.

And those are just from a show on termites. You should have heard the words used in the show before it where natural disasters where sensationalised. The worst part is when a scene is shown that does not need any dramatising. Three guys are being washed off a boat and into icy seas. Instead of giving a well weighted report of what is happening the narrator has kittens and talks about “deadly, savage, back crushing rocks that will tear you limb from limb” which are about three boat lengths and a pomegranate away from the swimmers calmly waiting to be picked up (because the coast guard is there and are trying to avoid the stupid news chopper about to fly right down the mouth of one of the swimmers.)

Americans, the main target audience, are not stupid. They, and we, don’t need to be lied to to make it more exciting. Good god man, it’s a 50 foot wave, do you really need to tell us “the oblivious onlookers” are all in mortal danger? The British have their faults but I love their understated ways. Let us reach the death defyinly dizzy peak of stunning realisation over the scene we see unfolding before us. If you talk us through it as if we are 5 years old we switch off and wonder what all the fuss is about.

Resolve resolved

Tuesday, December 13th, 2005

So I asked her, or would have had she not dropped the fact that she was already seeing someone. I assume she figured out what I was on about. My resolve was there though.

Fear and Loathing in Las Vegas

Tuesday, December 13th, 2005

Fear and Loathing in Las Vegas by Paul Watson

Sweet Jesus, I knew by reputation that Hunter S. Thompson was a righteous son of a bitch, and dead now, but you don’t have a clue until you read something he has written and even then I suspect you are as far from the reality as you were before reading what you just read.

I bought Fear and Loathing in Las Vegas yesterday afternoon and with a few put-downs to have a steadying breather I finished the last sentence at 3am. They recommend you get twisted and polluted when reading this book but hell no, I’m a bleeding innocent virgin in comparison and reading this on some trip would be a one way ticket to the looney bin. I’d be sucking the ink from the pages like blotter.

The illustration above is by Ralph Stead and his work is dotted throughout the book. Awesome but scary stuff.

Now I am going to take a few days off To Kill a Mocking Bird before trying out Fear and Loathing: On the Campaign Trail.

Some screwy people in this world. Harsh they can be so brilliant.

The great cull

Monday, December 12th, 2005

I have spent over an hour going through my feed subscriptions and that was only to mark the interesting ones for reading later. Barking mad I tell you. Time I became a producer rather than a consumer in this webbed world.

So, my subscription list. Here is what I am keeping and why and then afterwards what I am removing and why (numbers are just for easy reference, links are to the feeds, not the sites):

  1. Ask Yahoo!

    It is daily, quick to read and surprisingly interesting.

  2. Blog of a Bookslut

    It’s literary, interesting and Jess Crispin is a fox, a fox of the mind. Rowr.

  3. Dictionary.com Word of the Day

    So words rock my world, bite me.

  4. Dilbert

    It’s like getting a daily prediction of what is about to happen in your office.

  5. The Dilbert Blog

    It’s the comic expanded into lovely words.

  6. the Past Tense

    Making history sexier than Lara Croft ever did. And more accesible.

  7. Sexerati

    It’s new but lets see if it is better than Fleshbot. For a world of consensual, fun, caring, understanding, intelligent porn.

  8. design in-flight

    Helping code jocks like me get a clue.

  9. Devil’s Details

    Sporadic but good focus on design elements.

  10. Stylegala

    Stylegala actually comments on the designs they post, thank god. Not just thumbnails.

  11. unmatched <style>

    Good designs, not too many, not too few. Like Goldilocks.

  12. I Like Cameras

    I write for them but it’s handy keeping track of what the other writers are… uh.. writing.

  13. ‘Change, Culture, Creativity, Communication’

    Close to being unsubscribed but when he does post it is usually good.

  14. kottke.org remaindered links

    Good mix of personal, creative, cultural and techy links.

  15. reditt

    Just good linkage porn all day (not actually porn folks, tech porn.)

  16. Slashdot

    I never read the comments, unless I am feeling suicidal, but the links and commentary is still grand.

  17. The Best of 2005

    Just good photos.

  18. PhotographyBLOG

    Some suckage but always up to speed.

  19. DPReview

    When they move, they rock.

  20. TechCrunch

    Stay on the web 2.0 ball folks.

  21. Signal vs. Noise

    Teetering a tad but still grand.

  22. plasticbag.org

    Excellence in general.

  23. eHub

    Web 2.0 linkage porn.

  24. Radrails

    Good way to stay up to date with this good Ruby on Rails IDE.

  25. PC Mag Reviews

    Oh no! MSM! But good MSM… that’s main stream media folks, not what you were thinking ok.

  26. Workhappy

    Good, sharp, quick reviews of interesting binary things.

  27. microformats

    I keep waiting for this to go big.

  28. A List Apart

    Decent, monthly.

And now the tossed aside present wrappings. Some are good, they just have a fatal flaw like too much or too little:

  1. Chef Vault

    I try to stick with food blogs but I never make anything they detail, so to hell with it. McDonalds it is.

  2. Louis Cars

    Why are all car blogs run by disprespectful mother fuckers?

  3. Successful Blog

    I am finished with blogging about blogging. Move on people.

  4. Digg

    !!!!!!!!!!!!!!!!!!!!!!!!!! Dear Digg users. Some great links but, please, learn English. No sentence needs more than one exclamation mark and even that is pushing it. You annoy the screaming loonies out of me with your juvenile commentary. Number of visitors is fine and all but you are nowhere near competing with Slashdot. They have dictionaries over there and most of the story posters have finished high-school. So, grow up Digg and then I’ll be back.

  5. Read/WriteWeb

    I can only fit one web 2.0 blog in and that has to be Techcrunch. Sorry mate.

  6. MSDN Just Published

    Was it ever good?

  7. Scobleizer

    See above about blogging about blogging about blogging about meta-blogging about blogging. Oh sweet jesus.

  8. Anil Dash

    Been grand you purple nut but you haven’t said much in the past year or so. I am sure you are working hard for SA rather than blogging, which is fine (except you make blogging software. Use it.)

  9. Writerly blog

    Eh. Word on the web. A blog about it. Eh. Shit, Word just crashed. Typical. Eh.

  10. Songbird blog

    I just realised blogs about a single product are normally a bit naff. Especially products not out yet. I’ll keep track of Songbird via other blogs rather.

  11. Jeffrey Zeldman

    All respect to the master but his blog is now more or less a “Hey look, new ALA articles” regurgablog.

  12. :: CSS-MANIA ::

    Too many guys. Do some editing.

  13. CSS Beauty

    Design gallery or CSS tips and tricks list? Focus boys, focus.

  14. CSS Vault Gallery

    1 post a month, outer space!

  15. css Zen Garden

    Great while it lasted.

  16. Webcreme

    Some great, pure design but an awful lot of fluff.

  17. WithStyle

    Used to be good.

Just in case I have done something awful like unsubscribe from my mom’s blog, I have archived my Bloglines OPML.

Like there is no tomorrow

Monday, December 12th, 2005

Like there is no tomorrow by Paul Watson

The TSSG Christmas party was a blast.

Resolve

Monday, December 12th, 2005

Why is resolve so much more real at 2am lying in bed than at 8am when sitting at your desk at work? At 2am there are no misgivings, no clauses or worries, just a pleasant feeling of resolve. The next morning though and the cold light of day pierces your logical, self-evident rationale. All resolve crumbles.

If I don’t ask her today I’ll never ask her. It was a lot clearer last night. Bugger.

Mighty C

Sunday, December 11th, 2005

On the south-western most tip of England lies an ancient land. Wild, special, rugged… Cornwal

from a show on BBC. It sounded quite exciting right up until the narrator said “Cornwal.” I am sure it is lovely but it just sounds totally… flat.