You heard it here first
If you are into programming you may have come across the acronym YAGNI, which is used when you are doing stuff more out of geekiness than to provide a real added benefit. For instance your boss tells you to provide a driver to read data from .wav files and you set up a generic framework that allows you to hook-in all kinds of implementations : .mp3, .ogg, … . You think this is awesome, but after a couple of years the only driver the clients still really need is the .wav file driver, which you already have of course. So the framework turned out to be YAGNI.
However, there is an opposite of YAGNI, namely WANIFALT.
Suppose you would have written the .wav driver as a straightforward piece of code, not having the capability to easily integrate other formats. Then after a while, you’re told to provide support for .ogg files. And off you go, writing a completely separate non-orthogonal driver to support .ogg. And then you need to do the same for .mp3. As formats are added, the codebase’s complexity explodes. Finally, another developer, who can no longer bear to witness this, refactors the drivers into a generic framework, with different subclasses for different formats. Now that’s WANIFALT : We Already Needed It For A Long Time.
Of course, Murphy’s Law applied to these concepts makes sure that if you apply YAGNI, you will need to resort to WANIFALT eventually. And if you are thinking WANIFALT, it actually turns out to be YAGNI.
1 comment October 23, 2008
Daily DRY tip
Hello, back again with the daily, erm, monthly DRY tip.
Again, a short piece of C++ code.
if( bBool ) a = some_constant ; else b = some_constant ;
Auwch, such repeatingness is almost unbearable to even glance at.
To the rescue, our dear friend the ternary operator.
( bBool ? a : b ) = some_constant ;
The brackets are there so the ternary operator does not get confused and tries to evaluate b = some_constant as one of the parts of the ternary expression.
Add comment September 17, 2008
Why?
On my laptop – Vista Home Premium – the soft restart doesn’t work. Never has. Doing this always results in black screen. It gets stuck somewhere. Also doesn’t matter if it is triggered manually or from an installer.
So, that means I have to apply the five second rule : I press the power button for five seconds, then it shuts down. It’s not really a rule, but what the heck, it sounds cool to say : “OK, I guess I’ll have to apply the five second rule”.
Why does my laptop behave like this? Who knows? Who cares? Is there a fix? Who knows? Maybe there is, maybe there isn’t? Why is applying a restart so much harder than shutdown followed by a start? Who knows? Is there anybody out there who knows what Vista is up to? Has the complexity caught up to the developers? Is the complexity resulting in chaos? Is the chaos resulting in boundless indeterminism? Is indeterminism something like intelligence? Who knows? Anybody?
2 comments September 10, 2008
Chrome
What I like about Google Chrome :
- It’s very fast
- It has got a slick GUI
What I don’t like about Google Chrome :
- No fullscreen
- No smooth scrolling
- No mouse gestures
- No addons
So for me, I’m not ready to switch from Firefox, not by a long shot. And since Google Chrome is completely open source, I suspect Firefox’s Javascript performance will attain that of Chrome in a couple of releases.
Add comment September 5, 2008
New computer on the block
It happened in a shop near me. What I wanted to buy was an external USB disk, but while strolling through the electronics aisle, I picked up a box. In it was a thing of beauty, so beautiful in fact that I could not put the package down. It was 299 Euro. Only two-hundred and ninety-nine Euro for such an amazing piece of equipment. The thing I am talking about, of course, is the Acer Aspire One.
The box I held contained the Linux version of the Aspire. Which is just the one I wanted. There are enough websites where you can check the specs of this baby, so I won’t repeat them here.
I just wanted to share my impressions of this nifty little computer.And as far as impressions go, I must say that I am indeed quite impressed.
What I like about the Aspire One :
- It’s very small and light so it’s easy to carry in my backpack.
- It boots in about 14 secs. That’s fast.
- It has an Atom CPU, which is all the hype right now.
- The little mouse pad works very well.
- Same goes for the keyboard.
- The GUI works for 99% like Windows. Which is important since I’m used to that.
- It’s pretty fast for such a modest cpu.
- With some hacking you can install extra software, tweaking it to your heart’s desire.
- The screen is very good quality.
- The (W)LAN connectivity works without a hitch. ( note : WLAN did not work with my mom’s Dlink router. )
- You can write blog posts while watching tv, which is what I’m doing right now.
- You can impress other people by being the first to actually own one of these cool gizmos.
The moneymoon is still going on with this machine. I would recommend it to everyone. If you wonder what you are going to do with it, just buy one, and wonder no more.
Use it as :
- an extra surfing pc around the house
- a companion to a digital camera to unload pictures and do some basic processing.
- a computer for the kids
- a portable movie player
- a cool piece of kit to look at
It’s been a while since I have been so enthusiastic about a computer. These new netbooks are pretty revolutionary in that they use commodity hardware to provide a basic and low-cost computing experience. But at the same time, they are pretty powerful little computers. You can hook up an external mouse, keyboard and screen, so it can be used as a basic desktop pc as well.
I leave you with a picture ripped shamelessly off Flickr :

Add comment September 4, 2008
Random Web Rant
Website maker people, please don’t do the thing pictured below.
There’s two search fields. This completely defies the point of a search box. You type something in the search box because you don’t have any way to locate it. Why would you know how to locate it as a sub-search in either box? Just make one box, do both searches automatically and present the user with two categories of results, preferably in one scrollable list.
And upon further analysis, the search box to the left isn’t a search box at all, it’s a page chooser box. This is bad, very bad.
At least they had the decency to provide prototype text in the boxes.
Add comment August 19, 2008
It’s those little things
Bicycles are pretty important in my life. I ride one to work every day. Sometimes I ride my mountain-bike in the woods, or even in the mountains when money is less of an issue. And very occasionally, when I feel I have something unprovable to prove, and too much time to spare, I take out the BMX and try to hurt myself.
So, I know something about maintaining a bicycle – though mostly just enough to get myself into trouble – and while I don’t expect everyone else to know as much, there is one thing that absolutely everybody should know about bike maintenance and that is : you must lube your chain, preferable weekly, but at the utmost ultimate minimalistically very least, monthly.
There is lots of stuff you can use to lubricate your chain.
This :
Or this :

Or even this :

( But not this :

)
And you can do it in several ways.
Like this :
Or like this :

Or even like this, and you don’t have to use the extension thingy :

And don’t bother with complicated stuff like wiping off the excess lube, like this :

By lubing your chain you will :
- Be able to use your chain longer
- Ride more smoothly and efficiently
- Not annoy me with a squeaking chain
To show how your efficiency improves with increased lubrication look at this graph :
Yeah I know, you don’t have to tell me, this is indeed great stuff !
Add comment June 18, 2008
Watch Weeds Every Day
A couple of days ago, a friend lent us some DVD’s, among which the – to me at least – unknown tv show called Weeds.
I didn’t know what to expect from this, as the picture on the cover made it look like it was a show in the fashion of Grey’s Anatomy. Grey’s Anatomy has received rave reviews all over the place but it really wasn’t my cup of tea. So, not expecting too much I started watching DVD 1 of Season 1 of Weeds.
Man was I ever surprised. This show is really good. The characters, the dialogues, the plot, … everything first rate. And apparently, the show was shot using only one camera. Pretty amazing if you take the numerous angle switches into account.
It is marketed as a comedy and that’s basically what it is, but it’s also so much more.
Season One and Two are completely consumed, and it seems that there’s a season Three out on DVD, plus they’re already filming season Four.
So, next time you don’t know what to get your girlfriend for some present inducing occasion, get a couple of Weeds DVD boxes. Success guaranteed.
1 comment June 5, 2008
The market is flooded with mini laptops
Actually, the title should have been : The market is flooded with mini laptops, that you cannot buy.
There is no shortage of news entries about yet another manufacterer that has jumped on the mini laptop bandwagon. The bandwagon is so chock-full that the elderly and the children are falling off it, but still, none of those fancy new gizmo’s can be purchased here in Belgium. They haven’t shown up in any webshop I frequently check out, nor have I seen them offered by the large retailers in the city.
That’s too bad though. At their projected prices of about 300 to 400 euro, I would gladly pick one up. Especially because I don’t really need one.
Well, I bet if I finally see one, they will be larger or smaller than I would like, and they will cost about 600 euro. But that’s life I guess.



Add comment May 30, 2008
Daily DRY Tip
Today’s DRY tip gives up some to gain some.
Let’s look at the problem at hand :
class CArbitrary
{
public:
CArbitrary()
: mv_Value( 0. )
{}
private:
double mv_Value ;
};
Have you spotted the DRY-violation?
It’s in this line : mv_Value( 0. )
The literal 0. is a double, and the member variable mv_Value is also a double. So, you’re repeating yourself, definitely a DRY-violation.
A solution to this problem is calling the default ctor of your member variable explicitly.
Like so :
class CArbitrary
{
public:
CArbitrary()
: mv_Value()
{}
private:
double mv_Value ;
};
This does not feature a literal of type double, but does initialize the member to 0.
Now where did we give up DRY-ness?
Suppose our class was a template.
template
class CArbitrary
{
public:
CArbitrary()
: mv_Value()
{}
private:
at_ValType mv_Value ;
};
We are now forced to call the default ctor of our member variable explicitly although C++ would call it automatically…for non-built-in types. And that’s the dilemma we’re facing. Not writing the member default ctor would make this template behave differently for built-in vs. custom types. But writing it also makes us repeat the name of our member variable, and we don’t like to repeat ourselves. One reason for not wanting to do this is in case you would add other member variables. You’d have to remember to also change the ctor to include the extra member default ctors.
template
class CArbitrary
{
public:
CArbitrary()
: mv_Value()
{
// oops, mv_ExtraValue not initialized
// if at_ValType == built-in type
}
private:
at_ValType mv_Value ;
at_ValType mv_ExtraValue ;
};
Add comment May 17, 2008




