Wednesday, March 31, 2010

C++ sucks part one

This is going to be too much to fit in one post. So lets start with the most provocative.

I'm over Constructors and Deconstructors

It's such a staple of OOP and yet I could seriously do without them now. If you're like me you learned these are great places to create/delete required objects, open/close files and all that stuff. But it just causes trouble.

Here's a typical example:

anotherObject = new AnotherObject();
fileHandle = open("configfile.xml");
delete anotherObject;

Great! What could be wrong with that? We'll there's two things.

1. You want to customise things in a child class
Ideally you shouldn't need to mess with the parent. Maybe due to some rules on shared code you can't change the parent (easily). But if you want anotherObject to be CustomObject and use a different filename you end up with this crap:

MyObjectChild() : MyObject()
delete anotherObject;
anotherObject = new CustomObject();
fileHandle = open("myfile.xml");

Ugh. It's terrible! You'd never do this on a normal 'virtual' function. You'd just not call the parent. But with a constructor and deconstructor you don't have a choice.

2. You're running unit tests
Don't tell me you're not writing tests! But you don't want the object opening a file. That means you have to mess with a file just to run a test case. And perhaps CustomObject does stuff you don't want too. But you can't change it to never construct. Both will happen no matter what you try and do with a child class. So you're in the shit now.

So what can you do?
I'm half tempted to replace my constructors with a macro (except they're evil) as they are all starting to look like this:

MyObject(AnotherObject * _anotherObject, int _fileHandle) :

There's times when the construction order wont let you do that. But then you have to pass in a factory object and that can open a whole new can of worms.

Most of these problems are common to OO languages. But it's just one reason why C++ sucks.

Saturday, March 27, 2010

I'm sick of ret-cons

Blah blah Han shot first blah blah.

This was brought to my attention yesterday!

Like WTF!? The ending was pretty vague anyway. You get to the surface with things blowing up. Cut to music. Why is there even a need to change to and re-capture?

Why is there this growing trend of writers going back and reworking their story? It's not like there's a Homer's Odyssey (revised edition). I'm sick of it. Let it sit. Write a NEW story.

Thursday, March 25, 2010

Embrace change or fail and wonder why you wasted your time

Ok so I mentioned how I've been getting my head around TDD and Agile recently. I'm kinda late to the game since I only discovered it 2 years ago with a presentation by Uncle Bob in Chicago. So it's taken a lot of reading and talking to get to the point where I am now. But I'm also carefully watching trials others are doing and making notes about those who succeed and those who fail.

So time to talk about the interesting one. The failures. Let's break them down to some common archetypes.

I'll keep coding the same way and make some token effort with planning cards.

Yeah you suck. You've got to change your ways! The order you do things isn't going to be the order you always did it. You've got to talk to the customer/designer/whatever and let them talk about what's most important. That's your new order! Don't spend for ever building some backend database bullshit. You may not even need it by the end. The whole design may change and become something unrecognisable. You're building yourself waste. Stop wasting time and money! That's the customer's job.

Waaah! TDD is hard! Why can't I just write my code. This is taking too long.

Yes it's hard. Especially if you've never done it before. So is programming. Just deal with it! You'll get better just like you've gotten better at every other programming thing you've had to learn. At least I hope you get better, otherwise is this the right job for you? And don't kind yourself you're writing some trivial bit that doesn't need tests. All big systems started as a small trivial system. You want to be able to change that big system with confidence right? Then write tests. Unless you're stuck for an hour trying to figure out how to test it then you've got no real excuse.

LOL. We're agile. Except for the TDD part.

No you're not! That's the most important part! Having to deal with changes all the time is not what makes you "agile".

Screw all this shit. I've been doing this for years! Don't tell me how to do my job.

Screw you! Everything can be done better. Everyone can learn. There is no such thing as perfection and you're just being an arrogant prick by even suggesting you are. I'm the only perfect one!

Wednesday, March 24, 2010

Should video games be addictive?

Now keep in mind I don't think games are addictive like drugs are. That's a rant for another time perhaps. But they are designed to keep you playing and playing and playing. Now for most people this is not a problem. You choose when to play and when not too. It's something you enjoy in moderation.

But some weak minded fools will ignore their significant other, stop showing up to work (or whatever) and allow personal hygiene to lapse.

Now you have never done that. I have never done that. But perhaps like me you've played a game just a little bit more. Just one more level. Just one more fight. Just let me hand in this gopher. Next thing you know the morning sun is streaming in the window. What happened?

You just had a damn good time! That's what happened. Stop freaking out. We've done it with that extended edition of Lord of the Rings. We've done it with a good novel and short chapters (just one more!) And we've done it drinking too much with friends. Get over it. Enjoy it. And wear sunglasses to work/school!

Will games get more additive? I sure hope so! I want games to get better. Games have been pretty good for a long time. If anything they're less addictive because it's easier to get a short burst of play out of them. People just don't have that much time to spend.

Tuesday, March 23, 2010

Stephen Conroy is not Satan

That statement is probably getting two types of reactions.

a) Who is Stephen Conroy? Well if you live in Australia then all your internets belong to him. But otherwise you may as well stop reading.

b) He is too! Okay you're the ones I want to talk to. You're wrong and you're wasting your time getting upset about Internet censorship.

Let me lay out the facts as I see them (read: opinion and opinion cannot be wrong no matter how much you disagree).

He's not evil he's just stupid
There's nothing really wrong with that. Lots of politicians are stupid. Some of the best have been morons! I'm very fond of the saying "Never assume malice that which can be adequately explained by stupidity" so I'm applying it here. He thinks he's doing a great service to Australia. Finally we'll be protected from all that nasty stuff that we were not supposed to be seeing anyway. Finally the internet has reached maturity where such things are possible. Or at least that's his thinking. But there's no point making personal attacks while the other side are no better.

The plan is doomed anyway
So you may as well let it play out. If it gets implemented several things will happen:
  1. Telstra will increase charges by $2 a month
  2. Important people will find their favourite porn site blocked
  3. Some insignificant but controversial (euthanasia? people smuggling?) site will be blocked and cause an uproar in the papers
  4. Polling will show great disapproval with the plan (now that the public knows what it really means to them)
All this may happen within days of the filter being put in place. And like other things the government of the day will pull out the system before the opposition can make it a policy and win some votes.

So don't worry about it. It'll all fall apart like every other attempt to "control" the internet. Australian governments don't have the conviction of China or Iran.

A brief introduction

And then I'll get into my first rant.

I'm some guy who thinks about stuff. Stuff you probably don't care about but I'm going to tell you anyway! Now I don't think I'm going to cure cancer or create world peace but it'd be nice if I could make the world a little better. Stuff I'd like to talk about will focus on:

I've always been a game player and am fascinated in how one designs a game. Yes it's mostly computer games these days and even then it's mostly consumed by World of Warcraft.
Shut-up you in the back! We all have our vices and I'll avoid sniggering at your hentai collection if you leave my level 80 mage alone.

Only 2 years ago I was introduced to this weird concept of Test Driven Development and the broader concept of Agile. Programming has been part of my life since I was eight. When I haven't been doing it professionally I've found myself doing it more in my free time. So it's nice that after 20+ years to suddenly learn something very new.

To me you are all young whipper-snappers that don't know a good thing when you've got it. Yes I've been lectured by people who used the internet back when you had to use computers with out screens (or whatever they called them back then). So I'm in turn going to lecture you about the time when the web was young. And why it's such a horrible mess now that fills your inbox with spam. And why I love it and would have it no other way.