Jokes sometimes place the yoke on you

In writing a small module, that in part of it looks like this:

    switch(function parameter of some enum type) {
      case SomeEnumValue:
        handle it
        break;
      // done for each enumerated value
      default:

        // crash program? *evil grin*
        2/0;
     }

    // use the function parameter

This was written as a joke to allow me to test the function by forcing the compiler to pass an invalid integral value, which would trip the default label. Obviously the final code needs to do something besides float around oft’ undefined behaviour, but one has to have a little fun in idiot proofing your code ;).

The funny thing was instead of crashing, it continued on and triggered the (testing) assert() checking the function parameter, which then caused the program to terminate. Even more enjoyable was changing it to `int x = 2/0;`, causes the program to halt due to a floating point exception. Someday I need to thumb through the C++ standard and take a look.

Oh well, I had planned to throw something from stdexcept anyway, or carry on with reduced functionality; so it’s no real loss lol.

Tried to get through work by focusing on code, because I know if I focused on anything else, I’d likely be nuts by the end of it. Main problem was my body screaming “Sit down and eat ferociously” the whole time :-/. I’ve been trying to adapt a friends advice about eating more regularly, but still the mornings leave a lot to be desired.

Most of the times I’m seriously hungry before mid afternoon, it’s so early out, I’ve basically have to weigh between making to much noise and roughing it. If I wake up her royal pain (or the dogs who then wake her up), I get cussed at for the rest of the day, and much more dentimental side effect of it: not being able to get stuff done, while she sleeps :-(. I need to think up something to eat early on in the day (eh, night, morning, whatever) without getting compromised. Gotta put those ninja skills to use…

Yesterday I tried playing a bit of Urt for a change, but soon took a break to sit down and read. Got  so fatigued that I ended up stretching out for a nap.  There’s an Italian word that comes to mind, the only translation to English I’ve ever been given, is generally like walking into walls / staggering like a zombie. That kind of tired :-/.

I tried going back to sleep, after waking solidly up around 0200. I keep dreaming of combat or coding. I rarely dream about code…. lol. My brain is rubber banding all over lately. It’s like take a bean, throw it in a can, and start shaking: that’s what my train of thought looks like.

Did manage to get something ‘somewhat’ productive done yesterday, and the Yorkshire brigade has finally returned home(!) so that’s two less to drive me batty. I made a list of potential driving destinations, there’s about 11 items on the list. Most are in the 30-50km range, but there’s actually nothing to do there except drive back lol. The only real entry on the list with a purpose for going, are the nearest (serious) computer shops: over 100km away. After a decade of living here, I can understand why there are so few geeks in this burg o/. Also on the list was one destination that ma has expressed interest in over the months: Savanna. That’s more than 360km away by a straight line… that would put an indent in the driving hours I need. Right now things are about 21.5 hours total, out of the 40 hours required. I got totally shafted for night driving over this now past weekends ‘extra’ work.

Spent some time trying to zoom in on HTML5, Ruby on Rails, and studying the Boost & POCO C++ libraries more closely, when I an keep my mind straight enough to deal with it. To all over the place to really do much coding lately, 🙁 🙁 :-(.  I find RoR intently interesting, even though I generally despise web development as an exercise in annoyance.

Only have two days work for the week, and today should be fairly short; tomorrow is most of the day gone. I’m hoping maybe Fri/Mon, maybe her royal pain might take a crack at the desintiation list I prepped. Within about an hours notice, I could do some bit of route planning. If nothing gets done, I’m not going to have any recourse left, except to start applying contingency plans from a few weeks ago, and live with being driving out of my fucking mind over it. If I can’t get help with the driving, there is only one way to go: by foot.

I really need a long vacation… something without stress jacking, something that can actually be peaceful. What was the last time, I actually could get more than a few weeks running at a normal persons stress margin? I wish to forget most of 2007..

Gah, how the flub early am I waking up, if it’s not even 1400 local yet :-S. It feels more like 1700-1800 than just moving itno the afternoon…

Til The Last Shots Fired

I was there in the winter of ’64
When we camped in the ice
at Nashville’s doors
Three hundred miles our trail had led
We barely had time to bury our dead
When the Yankees charged and the colors fell
Overton hill was a living hell
When we called retreat it was almost dark
I died with a grapeshot in my heart

Say a prayer for peace
For every fallen son
Set my spirit free
Let me lay down my gun
Sweet mother Mary I’m so tired
But I can’t come home ’til
the last shot’s fired

In June of 1944
I waited in the blood of Omaha’s shores
Twenty-one and scared to death
My heart poundin’ in my chest
I almost made the first seawall
When my friends turned and saw me fall
I still smell the smoke, I can taste the mud
As I lay there dying from a loss of blood

Say a prayer for peace
For every fallen son
Set my spirit free
Let me lay down my gun
Sweet mother Mary I’m so tired
But I can’t come home ’til
the last shot’s fired

I’m in the fields of Vietnam,
The mountains of Afghanistan
And I’m still hopin’, waitin’, prayin’
I did not die in vain

Say a prayer for peace
For every fallen son
Set our spirits free
Let us lay down our guns
Sweet mother Mary we’re so tired
But we can’t come home ’til
the last shot’s fired
‘Til the last shot’s fired

[Choir:]
Say a prayer for peace (for peace)
For our daughters and our sons
Set our spirits free (set us free)
Let us lay down our guns

[Trace:]
Sweet mother Mary, we’re so tired
But we can’t come home (No
we can’t come home)

[Choir:]
‘Til the last shot’s fired

—Trace Adkins

Gotta love getting out of bed after waking up for the second time, and feeling ready to slam your head into a wall because you’re ride awake; only to notice the clock across the room reads 0139 :-(.

Why C++ is a failure

In reading through Scott Meyers book,  Effective C++, his expression that it should actually be viewed as a federation of languages, is actually a great way to look at it. He describes it in terms of C++ the C, Object-Oriented, Template, and STL groups (I would’ve skipped the STL) is fairly accurate.

The true gem however, I think is Item 19: Treat class design as type design. This IMHO, is more true in languages like C++, Java, and C#, than what some folks are accustomed to. You’re playing with the type system, so act like it.

He points out 12 issues involved with developing a new type or ‘class’, I’ll summarize them briefly:

  1. How should objects of your new type be created & destroyed?
  2. How should initialization differ from assignment?
  3. How should passing-by-value work with your type?
  4. What restrictions are their on legal values for your new type?
  5. How does inheritance effect your new type?
  6. What kind of type conversions should be allowed?
  7. What operators and functions make sense on it?
  8. What standard functions should be disallowed?
  9. Who should have access to its members?
  10. What kind of guarantees does it make?
  11. How general is it?
  12. Is a new type really what you need?

If anything, I would say rip out those pages of the book, and make it a required `check list`  of ground new programmers must cover before they are allowed to add a new type to the code base. The book gives excellent explanation of each point, so I won’t offer much deep exposition here on them: I’ve just tried to condense them. (Buy or borrow the book lol.)

If you’re going to be creating a new type; which you are effectively doing when creating a new class in C++, then these issues all apply to you. I would argue, that most of this applies to any language with user defined types and operator overloading; which is also most main stream language supporting OOP.

Points 2, 3, 4, 6, 7, and to an extent 8, all make sense in the domain of creating a new ‘type’. Personally, I tend to skip much of it unless for example, overloading certain operators offers serious savings on expressiveness, or the default copy constructor / assignment operators are insufficient. These points that the book outlines, really are the source of most complexity in developing C++ classes, perhaps because like C-strings and good ol’ malloc(), it exposes a lower level picture of things to the programmer. Everyone can program in C, but not everyone should.

Points 1, 5, and 9, are more unique to designing a class than the others are, at first glance. Simply put you can’t create a class without taking 1 and 5 into consideration, it’s just required. Although admittedly you can skimp a little on 5 in some cases but probably shouldn’t. If you know jack about OOP, let along designing software, you know the answer to 9 is the minimalist level of access required. I actually enjoy that Scott Meyers work demonstrates, that OOP goes a lot further than the class keyword! Abstraction, encapsulation, and modularity are an integral part of doing quality work, and object oriented programming is but a useful paradigm for modeling that, especially when polymorphic inheritance is applicable. Point 5 becomes a bit easier to live with as time goes on, although I still suggest favouring object composition over inheritance when a class hierarchy isn’t the most appropriate thing for solving the problem at hand (and minimizing the ruddy singletons).

Points 10, 11, and 12 are true of most elements of composition within a program: from even for functions. Those kind issues get easier with experience, assuming you learned a slugs worth about software design in the first place. Some people never learn it, period.

Why based on those oh so true points, would I conclude that C++ is a failure? Because the “Average” slep is just not competent enough to deal with most of it as often as necessary. Heck, I still encounter code bases where the programmer can’t tell the fucking difference between signed and unsigned integers when designing their interface. There are some truly brilliant programmers out there, and many of them do use C++ quite heavily, but in the wider majority, as with most majorities: you’ll find more Homer J. Simpson’s than Sir Isaac Newtons in the crowd. This goes for just about every thing on earth :'(. We could use some more clones of Newton and a few less Apple and Fig Newtons walking around. So long as the average is sufficiently uneducated, and still allowed to (ab)use the language, I think it’s a failure; but hey, who ever said C++ was designed with the incompetent people in mind ;).

It is simply to much for the average Tom, Dick, and Harry to be able to consider it. Not that those proverbial average three bozos should be screwing with a complex system… half as often as they are found to be. Maybe I’m more inclined to make such statements, as I still know average adults who can’t understand a + b = b + a; yet, and I have met a whole lotta stupid people: without even counting programmers.

disclaimer: I drew this conclusion ages ago after reading EC++s item 19, that “C++ is a failure”, and was in a more stable state of mind at the time then the one used to finally type this out.

Fighting fur with furr

The Yorkshire Brigade is now officially barred from my room, and a large amount of cleaning almost completed—I may end up sleeping in my chair. I love all animals in general, and I get along very well with dogs, but do enough damage, and I’m erecting barricades >_>.

Willow and Coco at least, have the decency not to do tooo much damage. The worst they’ve ever done, has been destroying bed covers and ripping up carpets, that’s pretty mild lol. Hahah, just as I was typing nice of her, Willow had to go claim my uncased pillow as her own, and didn’t like having to yield it back 8=). Courtesy of the yorkies, everything is in the washing machine! I’ve set spare (crappy) monitor and a damaged one as an interim barricade. Willow can jump over, or babishly wait to be picked up, lol.

For some reason, my experiences with toys breeds tend to have been with dogs that are dumb as bricks. I actually proscribe Willows level of intellect, to whatever breed(s) she’s mixed with lol. If anything, the only small breeds that I’ve seen that are smart, have been types of Terrier, like the Rat :-/.

Two yorkies and one obsessive-annoyance of a mother, have mostly deverstated the place o/. I probably should’ve held off on cleaning for another month.. lol. Between the lot of them, it’s difficult to go more than 15-20min without interupts, that’s still life as usual; only double up on being cussed at. The only good thing is my driving hours are now in the 21.25-21.5 block, even if I’ve been totally shafted on getting any night driving. HRP can’t stand the dark, so much for growing up after passing sixty.

I hate days that are largely the passing of time…

Is it just these dogs blood line, or are Yorksire Terriers IQs south of a bedroom slipper?