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 :-(.
Year: 2010
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:
- How should objects of your new type be created & destroyed?
- How should initialization differ from assignment?
- How should passing-by-value work with your type?
- What restrictions are their on legal values for your new type?
- How does inheritance effect your new type?
- What kind of type conversions should be allowed?
- What operators and functions make sense on it?
- What standard functions should be disallowed?
- Who should have access to its members?
- What kind of guarantees does it make?
- How general is it?
- 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?
Buttons smashed
Her Royal Pain is good at smashing buttons. It is always assumed, irregardless of time of ay, that I am I awake, and doing sufficiently nothing, and usually that I can never have something to be doing, other than what she wants. She can move her fat arse across the hallway, walk into my room, and demand something. She can’t make a left instead of a right, and carry back from the kitchen whatever she wanted. She is someone who finds sitting to exhausting to even be helpful.
If I don’t agree with being used, I either get pushed or I get guilted and pushed or I get threatened and pushed. She doesn’t really give a shit, as long as she gets what she wants. No amount of manipulation or coercion is generally beyond application, if she wants it enough.
I do not think that way: I refuse to.
and I am stubborn enough to refuse to cooperate, based on principal.
So for my trouble, I get made miserable with stress levels going past the point of a cartoon vein buldging out ones forehead. Is it any wonder that I hate my life?.
A humourous 100th
After throwing the covers off my head and looking over my laptops LCD, I noticed the sun was finally up. So i moved my laptop over to the table I’ve put up next to my desk… thinking I’ll just put my bottle of water on the desk next to me.
Then I had to stop and think for a moment, seeing my Raven Shield disk sitting in that spot: do I really want to use this CD-ROM as a coaster?
Everythng short of beating my head into a wall…. and I’m still awake, and I was dreamng about code again :'(.
One of the best programming quotes EVER
“If the data structure can’t be explained on a beer coaster, it’s too complex.” — Felix von Leitner, Code Blau GmbH, in a paper on Source Code Optimization.
I knew there was a reason I liked algorithms and data structures that can be explained, in screen space, roughly the size of a beer coaster lol.
Managed to get out for a bit, on ‘errands’, but also visit the library. After helping ma find what she wanted to look up, I got to sit down and read in peace for a couple hours.
I was reading Prioritizing Web Usability, and went through sth like 250-300 pages in one sitting. Very good book and well typeset. Of course the way my mind is, I was reading it like web pages, I read very quickly, usually. Web pages I can parse twice as fast if it’s not to dense (the book wasn’t). The huge difference? Sitting in the library, at peace without being driven nuts, and having my mind sufficiently occupied, I was able to focus in and relax. The other night while reading on the couch, I had to read sentences like three or for times, to compensate for the squawking at and throbbing head o/. Hey, I can multitask something fierce, I even can swim in regular development stress with a smile, but I’m at my best with peace and quite. The kind you can’t get at home…
Maybe it is a weird thing but sitting and reading at a library, is my idea of relaxation lol. The downside of course is coming home again, but I guess, nothing is perfect..