So last weekend Bren & I drove to Hayward to visit with her family. The drive up along the 1/101 was treacherous, breathtaking, and ~100 miles longer than just going up the 5. However the trip back had it's own unique qualities...
1) I had to drive back Monday instead of Sunday as I had planned, due to unforeseen events*
2) Bren *had* to be back Monday - so I put her on a 8pm flight from SJC to SNA.
3) A solitary drive down the 5 is a bleak & boring place
4) When I started out, I queued on my iPod up the second hitchhiker's guide book "The Restaurant at the end of the Universe". I arrived home 5 minutes before the book ended. No, I was not geeky enough to figure out if it was a multiple of 42.
* The unforeseen events: While going out to brunch with the in-laws, their car got a flat & it took forever to get it fixed. It was a comedy of tragic, time consuming, errors. When we finally got back to my car, it was already 6pm. Remember kids, cut with the vein, *cough* I mean "grain" - not against it.
Personal gripe: asserts are NOT a complete solution for error checking.
Sometimes I have to fight the urge to fix code like this.
void SomeFunction(int * pnReturnValue)
{
//Check Param
assert(pnReturnValue);
//Set the return value
*pnReturnValue = 5;
}
See the multiple problems?
1. assert only works in debug builds (obvious)
2. It is delusional to believe that you will cover all code paths in your debugger so that you can "fix all calling functions to call your function correctly". Here's some news for you buddy - 6months from now someone will call your function incorrectly. And that someone may or may not be you.
3. end users may get a dereferenced null pointer exception (0x00000005) and give your CS team hell.
4. Fellow programmers working on the same project will taunt you in a public forum! But that's OK - I used to make the same mistake early in my programming carrer, that is until someone pointed out this mistake.
Here's how I would rewrite it.....
void SomeFunction(int * pnReturnValue)
{
//Check Param
if( ! pnReturnValue )
{
assert(!"ERROR: SomeFunction - bad param - null pointer");
return;
}
//Set the return value
*pnReturnValue = 5;
}
Notice how I changed around the assert & created code that would always be built? The assert isn't evil, I still included it - but I changed it to a custom error string that will appear in my debugger as a hint as to what went wrong.
Happy Coding!
Wow, tomorrow Bren and I will celebrate our ten year wedding anniversary. that's right TEN YEARS. Somehow it really doesn't seam that long at all.
We actually met some time in November/December 1990 via mutual friends at the Rocky Horror Picture Show when it was playing at Balboa Peninsula. It was sort of a "Hello this is my friend X" meeting & we didn't talk much. But by January 1991 we were seeing each other - much to the shock of our friends. I still remember the TexAvery-esq jaw drop & eye popping our friend Bequi made when she saw us together & alone at Denny's. Yes, my friends and myself were part of the Denny's post midnight crowd.
Fast forward a few years of dating & we got Married on August 13, 1994 at Saint Simon & Jude in Huntington Beach. Bren was & still is my lovely bride. :-)
There are a few lessons that I would like to share that I learned on that day:
1) August can be known for it's heat waves.
2) During a heat wave, if you are riding in the back of an open horse drawn buggy to the reception. Wear a hat, sunblock, light weight clothing, and a 10lb bag of ice. Our faces were burned.
3) Don't let your sister in law video tape the wedding. She put the camera on a broken tripod on one of the pews. A few minutes into the service the camera base got loose and tilted 45° to the side. And since the camera was not high enough & catholic weddings take not only time - but a lot of standing and sitting - well people would stand up & block it. So when you could see the service, it was like being in one of Batman's enemy lairs. But that's OK - somebody inadvertantly taped over it anyways.
4) Do NOT freeze the top layer of the cake & eat it on you first anniversary. No matter how well you wrap in in plastic wrap - it WILL get freezer burn (and taste horrible)
5) Dip. When it comes to the big kiss at the end of the service - Dip. You will not regret it.
Fast forward yet another 10 years & you'll be at tomorrow. Then on Saturday we're going on a helicopter flight to Catalina for the day. It's going to be great!
Who knows what the next 100 years will bring with Bren. But if they're half as good as the first 10 - I'll be estatic!
That's right Grimm Reaper, F-U. Mortatily is the chicken shit way out of life.
Wow - I just watched "Venture Bros." for the first time on Cartoon Network. It's like everything that Johnny Quest should have been - had it hung out with The Tick, Harvey Birdman: Attorney At Law, illicit drug paraphernalia & a wholly unhealthily view of reality. Pure Comedy Gold!
It remined me how once wanted to be "Q" from the James Bond movies when I grew up. Sure - that goal had gotten me far in life & I'm not complaining. I'm a successful computer programmer on the fast track to a world of evil geniusness. (The dark side does have a bitch'n dental plan afterall). But it would have been cool to be a "Brock Samson". Nothing can keep that that bad ass down. And some times it would have been great to be the bad ass when it came to those time consuming annoyances in life: car salesman, arguing a speeding ticket with a cop, and making the world safe for democracy.
My TiVo just got a new season pass to Venture Bros!