I'm back.
Thursday, September 18, 2008
The Phoenix Rises
Remember this post? That was one crazy night. Perhaps some day I will explain it. For now, just know that the baboon in question is fine. Also know that some things, once seen, cannot be unseen.
Wednesday, June 4, 2008
On Being Out-Babooned
I'm being out-babooned. A few months ago I decided it might be a good idea to snag the codebaboon.com domain, only to realise that someone else (Mark Theunissen apparently) had registered it literally days earlier. A little frustrated by my lack of initiative, I figured it was no big deal, that this new baboon would probably just do nothing with it or put up some craptastic site that I could mock now and again.
Boy was I wrong. Not to pimp some stranger's site, but check it out. Pretty nice looking, eh? He's got a cool little baboon logo that kind of looks like him, and a very nice, clean style. He shows up first in the Google search for code baboon, and has far more comments on his posts (which means he has a few readers). And to top it all off the bastard even has a photo of himself and a baboon!
Looks like I need to step it up. My frequency of posts has been increasing lately, so that's a start. I'm not sure what more I can do to make Blogger look sexy, so maybe I need to look into registering www.therealcodebaboon.com or something. Most importantly, I'll be heading to the Zoo this weekend to steal a baboon for a night on the town. I'm going to get photos of us having a drink on a patio, playing flag football in a park, riding a tandem bike, and high-fiving after scoring the winning touchdown in a game of flag football. Eat that, Mark.
Boy was I wrong. Not to pimp some stranger's site, but check it out. Pretty nice looking, eh? He's got a cool little baboon logo that kind of looks like him, and a very nice, clean style. He shows up first in the Google search for code baboon, and has far more comments on his posts (which means he has a few readers). And to top it all off the bastard even has a photo of himself and a baboon!
Looks like I need to step it up. My frequency of posts has been increasing lately, so that's a start. I'm not sure what more I can do to make Blogger look sexy, so maybe I need to look into registering www.therealcodebaboon.com or something. Most importantly, I'll be heading to the Zoo this weekend to steal a baboon for a night on the town. I'm going to get photos of us having a drink on a patio, playing flag football in a park, riding a tandem bike, and high-fiving after scoring the winning touchdown in a game of flag football. Eat that, Mark.
Monday, June 2, 2008
Oops, I Did It Again...
By 'it', I mean Assert. But lets step back.
Following a dry run for Ryan Weppler's upcoming webcast Testing Out the MVC Routing, a few guys got into a discussion about multiple Assert statements in a unit test. Steve 'asserted' (oh yeah, I just went there) that you should only ever have 1 Assert per unit test (edit: from Steve per the comments: "the one Assert per test thing is just best practice, not a written-in-stone sort of thing. As long as you have a good reason for doing it, then fill your boots. Just ask yourself why you're doing it."). I was attending remotely and didn't have a mic, so I could not respond, which turned out to be a good thing. You see, I wanted to say something like "I have a bunch of tests from my demo code that used multiple Asserts, and they all were necessary/made sense". Because I couldn't speak, I decided to send an email to that effect.
But the good thing about email is that it generally encourages you to back up your random statements with crazy things like facts and examples, so I popped open the Dice Hockey code and looked at my tests. Sure enough a bunch have more than one Assert. Yet as I gazed upon those 'perfect' tests with the intent to throw them in Steve's metrosexually attractive visage, I realised that I couldn't do it. In each case, Steve was right. Damn him and the Mac he rode in on!
Anyways, et's take a look for ourselves at a function from one of my tests:
In this first example, the first Assert is meaningless. It only has value because I know that during my data initialization at the start of the test I put more players into the database than I did in my list of ID's to retrieve. But really, the second Assert is the one that makes sure everyone got retrieved that should have been. If I want to test that no other players were retrieved (which is basically what that first Assert is doing), I should have another test.
And hey, speaking of that, I do have another test for that! Well, sort of. I have another function, as seen here:
That looks nice, right? But check out where these functions get used:
That's a pretty clear-cut case of bad test writing; those should be two seperate tests, one for each function. Combine that with the clean-up of the two Asserts in that first function and we'd have a much nicer solution.
UPDATE: Code is all visable now, sorry for the formatting issues.
Following a dry run for Ryan Weppler's upcoming webcast Testing Out the MVC Routing, a few guys got into a discussion about multiple Assert statements in a unit test. Steve 'asserted' (oh yeah, I just went there) that you should only ever have 1 Assert per unit test (edit: from Steve per the comments: "the one Assert per test thing is just best practice, not a written-in-stone sort of thing. As long as you have a good reason for doing it, then fill your boots. Just ask yourself why you're doing it."). I was attending remotely and didn't have a mic, so I could not respond, which turned out to be a good thing. You see, I wanted to say something like "I have a bunch of tests from my demo code that used multiple Asserts, and they all were necessary/made sense". Because I couldn't speak, I decided to send an email to that effect.
But the good thing about email is that it generally encourages you to back up your random statements with crazy things like facts and examples, so I popped open the Dice Hockey code and looked at my tests. Sure enough a bunch have more than one Assert. Yet as I gazed upon those 'perfect' tests with the intent to throw them in Steve's metrosexually attractive visage, I realised that I couldn't do it. In each case, Steve was right. Damn him and the Mac he rode in on!
Anyways, et's take a look for ourselves at a function from one of my tests:
private void EnsureAllDesiredPlayersWereRetrieved(
IEnumerable<Guid> playerIds)
{
Assert.AreEqual(playerIdsToRetrieve.Length,
playerIds.Count(), "Not all players retrieved!");
IEnumerable<Guid> playersNotRetrieved =
(from ptr in playerIdsToRetrieve
select ptr).Except(playerIds);
Assert.IsTrue(playersNotRetrieved.Count() == 0,
"Not all players retrieved!");
}
And hey, speaking of that, I do have another test for that! Well, sort of. I have another function, as seen here:
private void EnsureNoPlayersWereRetrievedThatShouldNotHaveBeen(
IEnumerable<Guid> playerIds)
{
IEnumerable<Guid> playersThatShouldntHaveBeenRetrieved =
(from p in playerIds
join ptnr in playerIdsToNotRetrieve on p equals ptnr
select p);
Assert.IsTrue(
playersThatShouldntHaveBeenRetrieved.Count() == 0,
"Players were retrieved that should not have been!");
}
That looks nice, right? But check out where these functions get used:
[TestMethod]
public void Should_retrieve_only_specified_players_from_Players_table()
{
var retrievedPlayers =
testGateway.GetPlayers(playerIdsToRetrieve);
// Check that all desired players were retrieved
EnsureAllDesiredPlayersWereRetrieved(
(from rp in retrievedPlayers
select rp.PlayerId));
// Check that no players were retrieved that
// should not have been
EnsureNoPlayersWereRetrievedThatShouldNotHaveBeen(
(from rp in retrievedPlayers
select rp.PlayerId));
}
That's a pretty clear-cut case of bad test writing; those should be two seperate tests, one for each function. Combine that with the clean-up of the two Asserts in that first function and we'd have a much nicer solution.
UPDATE: Code is all visable now, sorry for the formatting issues.
Thursday, May 29, 2008
Time Machine's and White-Socked Ninja's
With 2 of my friends finally moving to Gmail accounts this week, I decided to click the "oldest" button in my "All Mail" section to see how long I'd been a member. Turns out my 4 year Gmail Anniversary will arrive on June 16th. In that time I've never deleted anything, leaving a little over 6000 e-mails essentially tracking the last 4 years of my life. Looking back at those early email threads is like having my own little time machine back into 2004, which feels like a lifetime ago now. A lot has changed for me since then. I've married, purchased a home, purchased a dog, changed jobs, and exited my 20's.
But my favorite part was seeing the first email I ever sent from the account. It is an email to my long-time friend Jeremy Maxom with an attachment describing the sacred teachings of the White-Socked Ninja Clan, a clan whose actions the two of us have been tracking since high school. This document was listed as highly-classified, but the time has come for the public to be aware. So, with little fanfare but much significance, I present...
Sacred Teachings of the White-Socked Ninja
Within this document are details of a clan, a clan which has existed, surprisingly, for ages, or at least 10 years. Few have knowledge of the White-Socked Ninja, but those who do are wise to respect and honor the fierce irony that members of the clan must face. For a White-Socked Ninja is as his name implies: a ninja, skillfully trained, deadly and swift, cunning and agile, heard of often, yet never seen… from the ankles up.
You see, a White-Socked Ninja, much like your run-of-the-mill, everyday ninja, is above all else a man of stealth. Clothed all in black, a ninja can stalk the night like no other. But a White-Socked Ninja must adhere to the number 1 rule of the clan: White tube-socks must be worn, and visible, at all times. Although quite comfortable and stylish, this requirement has been the undoing of more than 1 White-Socked Ninja. In fact, it has foiled 100% of all missions the clan has attempted.
The exact date of inception for the clan is unknown, and some members have been known to claim it has been around for centuries. However, historians and clan co-founders have narrowed the likely date to sometime in 1993. The clan was borne out of a growing distaste for the normal ninja clans of its time. Tired of the outrageousness of the Teenage Mutant Ninja Turtles, yet bored of the non-distinct look of most other ninja clans (often derided by WSN members as being “effective but boring”), clan founders decided that a subtle yet cool ninja clan was “where it’s at”.
A uniform was quickly decided upon. Not wanting to stray too far from tradition, black was chosen as the predominant color. It was also noted by one co-founder that “black is slimming”. To maximize effectiveness in the field, while maintaining cool-non-vanilla Flava, the trim color could not be above the waist. When one co-founder noted that white tube socks could be easily acquired for low prices at many convenient locations in the metro area, the decision was unanimous and the White-Socked Ninjas were born.
Mantra
“Stealth Is Important, But So Are Style And Affordability.”
Rules & Regulations
Methods of Sneakiness
The Mission That Almost Succeeded
The lights were low that fateful night,
When white-socked ninjas approached the site.
The clouds hung low and children shivered,
For soon the strike would be delivered.
The quarry lay so still and quiet,
This was the perfect night to try it!
So up the fence the members shimmied
And through the door that one guy jimmied.
The group that night it counted four:
The first guy stayed to guard the door.
The second one was stationed outside,
Because he’d borrowed his grannies’ ride.
If things went poorly, as they often did,
And if the members could not be hid,
Then slam the car into drive he would
And they’d peel out of this neighborhood.
The two that continued had their orders;
Divide the quarry into quarters.
So up the stairs they softly stepped
And down a corridor they quickly crept.
And through a door, and there they were:
Their target in sight, of that we’re sure.
But what came next is somewhat muddy,
Like a story from your drunk friend Buddy.
In most accounts, someone screamed,
The jig was up, or so it seemed.
“Honey, honey, there’s someone here!”
“Where?!? Oh where? Pray tell me dear!”
”I’m not quite certain, it’s oh so dark,
But I saw a flash, a white-ish spark.
It was low to the ground, say ankle high
Please dear believe me, I wouldn’t lie!”
Later that night in a secret place,
Where a secret leader secretly paced,
The group of four softly entered
And faced their leader front and center.
“We failed again sir” said one member
“Our fourth failure since December”
The leader shook his head and sighed
“What happened this time, that no one died?”
“Same as always, like hands on clocks,
Despite our skill they saw our socks”
But my favorite part was seeing the first email I ever sent from the account. It is an email to my long-time friend Jeremy Maxom with an attachment describing the sacred teachings of the White-Socked Ninja Clan, a clan whose actions the two of us have been tracking since high school. This document was listed as highly-classified, but the time has come for the public to be aware. So, with little fanfare but much significance, I present...
Sacred Teachings of the White-Socked Ninja
Within this document are details of a clan, a clan which has existed, surprisingly, for ages, or at least 10 years. Few have knowledge of the White-Socked Ninja, but those who do are wise to respect and honor the fierce irony that members of the clan must face. For a White-Socked Ninja is as his name implies: a ninja, skillfully trained, deadly and swift, cunning and agile, heard of often, yet never seen… from the ankles up.
You see, a White-Socked Ninja, much like your run-of-the-mill, everyday ninja, is above all else a man of stealth. Clothed all in black, a ninja can stalk the night like no other. But a White-Socked Ninja must adhere to the number 1 rule of the clan: White tube-socks must be worn, and visible, at all times. Although quite comfortable and stylish, this requirement has been the undoing of more than 1 White-Socked Ninja. In fact, it has foiled 100% of all missions the clan has attempted.
The exact date of inception for the clan is unknown, and some members have been known to claim it has been around for centuries. However, historians and clan co-founders have narrowed the likely date to sometime in 1993. The clan was borne out of a growing distaste for the normal ninja clans of its time. Tired of the outrageousness of the Teenage Mutant Ninja Turtles, yet bored of the non-distinct look of most other ninja clans (often derided by WSN members as being “effective but boring”), clan founders decided that a subtle yet cool ninja clan was “where it’s at”.
A uniform was quickly decided upon. Not wanting to stray too far from tradition, black was chosen as the predominant color. It was also noted by one co-founder that “black is slimming”. To maximize effectiveness in the field, while maintaining cool-non-vanilla Flava, the trim color could not be above the waist. When one co-founder noted that white tube socks could be easily acquired for low prices at many convenient locations in the metro area, the decision was unanimous and the White-Socked Ninjas were born.
Mantra
“Stealth Is Important, But So Are Style And Affordability.”
Rules & Regulations
- White Tube-socks must be worn, and visible, at all times. These replace the standard two-toed ninja booties most trainees are familiar with.
- All other Standard Ninja Rules, as dictated by the International Consortium of Ninjadom, apply unless in direct conflict with rule 1.
Methods of Sneakiness
- Missions should be attempted during night-time hours if at all possible.
- Approach targets from any angle that is not the front.
- No chewing gum.
- Know your surroundings. Grass and carpet are good. Hardwood floors and bubble-wrap are bad.
- When in doubt, do what a cat would do, unless the cat would purr.
The Mission That Almost Succeeded
The lights were low that fateful night,
When white-socked ninjas approached the site.
The clouds hung low and children shivered,
For soon the strike would be delivered.
The quarry lay so still and quiet,
This was the perfect night to try it!
So up the fence the members shimmied
And through the door that one guy jimmied.
The group that night it counted four:
The first guy stayed to guard the door.
The second one was stationed outside,
Because he’d borrowed his grannies’ ride.
If things went poorly, as they often did,
And if the members could not be hid,
Then slam the car into drive he would
And they’d peel out of this neighborhood.
The two that continued had their orders;
Divide the quarry into quarters.
So up the stairs they softly stepped
And down a corridor they quickly crept.
And through a door, and there they were:
Their target in sight, of that we’re sure.
But what came next is somewhat muddy,
Like a story from your drunk friend Buddy.
In most accounts, someone screamed,
The jig was up, or so it seemed.
“Honey, honey, there’s someone here!”
“Where?!? Oh where? Pray tell me dear!”
”I’m not quite certain, it’s oh so dark,
But I saw a flash, a white-ish spark.
It was low to the ground, say ankle high
Please dear believe me, I wouldn’t lie!”
Later that night in a secret place,
Where a secret leader secretly paced,
The group of four softly entered
And faced their leader front and center.
“We failed again sir” said one member
“Our fourth failure since December”
The leader shook his head and sighed
“What happened this time, that no one died?”
“Same as always, like hands on clocks,
Despite our skill they saw our socks”
Wednesday, May 28, 2008
Gateway Webcast: The Files
Things went ok on the webcast today, although I did forget a couple of things that I wanted to show in the demo. I will make a post later tonight highlighting the content that I missed in the webcast for anyone who is interested to read through.
During the webcast I mentioned that I would be putting up links to the various resources used in the webcast, so here they are:
Disclaimer: The code provided is not supported or guaranteed in any way: use at your own risk. In fact, it is not entirely complete (being that the intent is to build it out into a full project) and so you will see at least one failing test because the method it tests is not even implemented.
Related Posts: Oops, I did it again...
During the webcast I mentioned that I would be putting up links to the various resources used in the webcast, so here they are:
Disclaimer: The code provided is not supported or guaranteed in any way: use at your own risk. In fact, it is not entirely complete (being that the intent is to build it out into a full project) and so you will see at least one failing test because the method it tests is not even implemented.
Related Posts: Oops, I did it again...
Monday, May 26, 2008
Webcast Dry Run
Well today was the dry run for my upcoming webcast. As I've mentioned before, this is a first for me, so it was interesting. Things went ok, but we had some audio issues which I need to resolve by Wednesday. I suspect Vista is the problem, which is nice and ironic.
The other things I learned by way of feedback as well as just things I noticed myself while speaking or listening to the recording afterwards:
Listening to the recording was interesting. I have always hated listening to my own voice, but I didn't sound quite as stupid as I thought I had, so that was positive. Of course, with the audio cutting out constantly perhaps the dumb portions were mercifully absent.
Finally, the one thing I really noticed was how I sort of 'went blank' as I spoke. I was in some kind of zombie trance, and the couple times that I tripped up because I wasn't following my notes properly left me totally dumbfounded for a few seconds. I think the audio issues hid this pretty well actually, but there were a couple times when I stared at my notes for like 5-10 seconds thinking "What the heck? Where was I? What am I doing next? OH NOES!". Hopefully this does not happen on Wednesday!
The other things I learned by way of feedback as well as just things I noticed myself while speaking or listening to the recording afterwards:
- I should explain that we won't be deep-diving into any specific areas.
- I forgot to have SQL Server Management Studio open.
- I didn't have server explorer connection set up (not sure why, I set it up yesterday. Guess VS forgot it, so I'll need to set it up right before the presentation on wednesday).
- I skipped around and didn't follow my notes properly! I need to make my notes easier to follow (NOT handwritten!).
- I forgot to explain the Lambda expressions properly.
- I need to expand the references section a bit.
- I should use tinyurl for long URL's.
- I set up bookmarks in Visual Studio, and then proceeded to not use them at all.
- I intended to use Full Screen view in Visual Studio but forgot. This resulted in lots of sideways scrolling because I had the Solution Explorer pinned. I didn't clue in on this AT ALL during the entire presentation.
Listening to the recording was interesting. I have always hated listening to my own voice, but I didn't sound quite as stupid as I thought I had, so that was positive. Of course, with the audio cutting out constantly perhaps the dumb portions were mercifully absent.
Finally, the one thing I really noticed was how I sort of 'went blank' as I spoke. I was in some kind of zombie trance, and the couple times that I tripped up because I wasn't following my notes properly left me totally dumbfounded for a few seconds. I think the audio issues hid this pretty well actually, but there were a couple times when I stared at my notes for like 5-10 seconds thinking "What the heck? Where was I? What am I doing next? OH NOES!". Hopefully this does not happen on Wednesday!
Monday, May 19, 2008
Well That Ended Quickly
The great Linux experiment of '08 is officially over. I will really miss the virtual workspaces and other nice features, but until there is a reliable Exchange mail client it just won't do the trick for me. Evolution is beyond buggy, and I can't have my email and calendering crashing constantly. Thunderbird/Lightning didn't seem any better. I couldn't get Outlook to work under Wine.
So I'm back to Windows, and I'm giving Vista a third spin. I'm going to try my darndest to keep the OS 'clean' and hopefully have something that performs reasonably well. Of course, on a fresh install with just Firefox running I'm currently using 675MB of RAM... ugh.
I'm still glad I tried, and I think I might try installing Kubuntu under Wubi and seeing how Kontact works, but I don't hold out much hope. Maybe someday I'll be able to switch back, but for now I'm stuck.
Boo.
So I'm back to Windows, and I'm giving Vista a third spin. I'm going to try my darndest to keep the OS 'clean' and hopefully have something that performs reasonably well. Of course, on a fresh install with just Firefox running I'm currently using 675MB of RAM... ugh.
I'm still glad I tried, and I think I might try installing Kubuntu under Wubi and seeing how Kontact works, but I don't hold out much hope. Maybe someday I'll be able to switch back, but for now I'm stuck.
Boo.
Subscribe to:
Posts (Atom)