When I were a lad... Generics - are - good .... rant?

Still feeling old, but code wise now. I've just been accused of forming an opinion based on being set in my ways. For the first time I had to consider whether that was actually the case.

I'm not a generics fan, some people might already know this. I use them alot for work and today I spent some time refactoring some code to make use of them and saved alot of effort. Thats great! I still think using generics because "it makes the code look tidy" or "removes a lot of casting" is a pretty crappy reason to add their complexity to the code base. If you're using a collection thats supposed to have specific things in it, chances are that collection represents something significant. As such it should be part of your data/oo/design model - and hence probably should be represented as it's own class. It's really that simple. That way all the casting and/or generic handling is hidden away inside that class - way more flexible, analogous to why event objects make sense. As always, it's about playing to the crowd. If you're sure your code base maintainers and users will get everything you're doing with generics - and you're sure you're not shooting yourself in the foot, it can't be bad!

Today, I did learn to like generics when used for something interesting. The downside is that the syntax for that use became unwieldly and to most Java code formatting sycophants ugly.

So, Generics forever! etc.


But really, thats just a side issue, I had to consider whether my initial dislike for generics came from being stuck in my way. Hmm.. maybe a bit? How to test it? Let's look at technologies I've considered over the last few months:

JSF+EJB - Jury is still out for me, haven't used it enough. The technology is sound, the front end is a bit error prone for my tastes. It's way over weight for a simple web access to a underlying service but for something more enterprise in scale, i.e. where the logic is really in the EJBs I think it probably makes sense.

AOP - Definitely a winner for me this one. Aspects are interesting topic that I've only really just started to get used to. Every time I consider them as an approach (which isn't that often, they don't fit everywhere after all ;)) they solve so many problems. Though the downside for me at the moment is the frameworks for AOP seem complex and intricate to integrate into most of the stuff I do at home.

Java Annotations - Again, awesome cool. I'm constantly finding uses for them from conventional access and persistance meta data to intergrating scripting languages by generating proxy objects based on annotating the target java class. Nice.

IoC - Injection is cool, there is no doubt. It's a really useful tool in some cases. However, I do think the majority of developers have been using the concept of IoC a lot longer than the current crop of buzzy frameworks have been around. I'm also not a fan of sticking the configuration for injection out in compile time excluded files. However, that'll probably get better with more IDE support.

JBossMC - I hated this initially. A POJO Container! Whats the fricking point? Why would anyone do that? Actually, it's neat as a 5 year old on the first day of school. It's a great basis for any container based server, I'm actually wondering about starting a game server project based on it, kinda Project Dark Star lite. JBossMC + JBoss Cache make a powerful combination.

Right, they're the ones I can think of. Written stright out without thinking about it. I think I'm pretty open to new techs and approaches. I don't fear change (much).

I also don't think just because something is new it has to be jumped on and used ASAP - especially not in a commercial environment. Which brings me on to something else, projects that die.


A project that stops development doesn't become useless instantly. Infact, it never does. If Java was stopped tomorrow, we'd all still have the Java toolset and VM. We could continue to developer software just fine. If it was closed source, it's more of a problem because there arn't any bug fixes possible (see GTGE recently) - however, open source projects that stop development for a bit, or even forever, don't die unless the users flake out and don't pick up the slack.

If a project is useful, it's useful. Evident in FScript which is proving fantastic for my gaming needs and hasn't been touched since 2005!

'No Fun and No Code make Kev Something Something'

'Go Crazy?' - 'Don't mind if I do!!!'

Life is a bit on the lame side at the moment. At least 2 of the three members of my household have been ill for the past month an a half. Work wise I've been sat on the same low priority but critical work for the last 3 months - not really going anywhere fast. No code involved at work and no energy to code at home.

Haven't been out in a while, no pub, no trips, not much fun. Don't have time to play games even though I've had Wii Paper Mario sat on the shelf for the past month. Christmas is coming and I can't begin to get excited. This time last year we were preparing to come home which could have been the worst mistake we've made. Coming back was great from a family perspective but pretty much everything else has been a bit of a read through.

What's more the idiocy of the world at large is begining to annoy me again. Road users - why oh why - just because something is legal doesn't mean it's sensible. Just because something is temporary doesn't mean it's automatically ok. No, there arn't double yellow lines - but parking there will still block the road. Bike users - weaving in and out of traffic is legal, but if it's cold, wet and early it's still dangerous as hell. And as to the woman that parked on the roundabout so she could "just pop in" to McDonalds to get her breakfast - I mean seriously, what sort of brain dead moran are you?

Recieved a phone at work yesterday. This might not seem like a big deal worth blogging about but consider that I've been working for a telecommunications company for 3 years and this is the first time I've had a phone on my deak. It's pretty big news. Now, if it only actually worked it'd almost be a positive aspect of my day.

Meg is still coughing alot, she can't shake this bleady cold any more than anyone of us. However, she is still giggling and trying to walk and falling on her butt alot. Some how she's really into drawing now - she's just over 1, so it seems a bit bizarre - but she loves her crayons that she now takes everywhere with her in a little red handbag. There has to be a game concept in there somewhere.

Talking of which, I've decided to write 4 games in parrallel, the logic being that even if I give up one or two I should still get futher with some. So, the run down seems to be two that have been around for a while, Scorched Turf and Mootox and two new ones currently called Samson and Dumb Bots. Should I ever make it back to the computer at home I'll be pushing on with the golf game first since it's core engine is shared between all 4.

Finally, I've blogged again. Almost feels like normal if a bit random and tangenty. Anyone know of anything gamedev related in the Cardiff area let me know, I need to get motivated again!

10 Reasons why Virgin Media are absolute crap.

Now I don't actually have 10 reasons, but I know that blog entries that start 10 reasons ... tend to get picked up more by different search and registration engines. Don't let this stop you reading, because Virgin Media really do suck.

First they take over two reasonably crap companies (NTL and Telewest) to form one rather over trendy and under competent entity. That sucks a bit, but hey - cheaper is better right?

So, here in the UK we have several different ways of getting the same TV channels. There are a few channels that are especially good (since they play the popular shows first) - these are only available by paying. So, I sign up for V+ - an equivalent service Sky+ (the main vendor of the channels).

1) It's damn expensive for what you get. V+ is slow and clunky. The menu system feels like it was written by a first year student and responds like it's running on a ZX spectrum.

Next, a month into my contract, Virgin have some legal wrangle with Sky - essentially Virgin don't want to pay as much for the channels they're reselling. This means Virgin stop offering customers the channels they're paying for.

2) They don't have the right channels. Worse they don't have the channels they originally advertised.

Virgin also offer a phone service, it's a good deal if you're getting the other services like TV anyway. The quality of this phone service is terrible. Calls drop. Audio quality is crap, calls outside of the expected are really really expensive.

3) Their phone service is shockingly bad. Especially given that it's meant to be over cable.

4) They can't work out how caller-id works. I pay for caller ID each month. As yet it's hasn't actually worked. I've tried to cancel it several times but the people who work the call center don't seem to be able cope with the concept (more on them later). They have attempted to indicate that it must be the phone at fault, however the phone has supported caller ID on several other vendors system quite happily.

Virgin Media also offer an internet service. It's very good - it's cable. Thats great. However, it's no where near as fast as it's advertised to be. It's cable - it's meant to be what it says on the tin. It's not.

5) The internet service is slow. Not to mention they try to install a bunch of crap on your machine. Not to mention their technical support don't know anything. Not even their own names it seems. "NTL can I help you...".

Customer service is terrible. Virgin (as in all virgin services) appear to think that playing recorded messages by some faintly sexy sounding northern chick is good enough to solve all problems.

6) They use recorded messages for everything. Even when the message tells you you're about to be put "straight through" to an operator, don't expect to be.

7) When you finally do get through to an operator, most days they're in India. They have no idea what they're talking about and have no power to do anything.

Organization - they don't have any. I'm about to move house, which is what spawned this rant, so I've attempted to cancel my services. I've given them plenty of notice, 2 months. I've only been in my 12 months contract 6 months, so I'll have to pay the rest of the contract off - a whopping 180 quid. Even though Virgin have failed to deliver their contractual agreement, I'll honor mine.

8) Even given Virgin haven't given me the TV channels I'm paying for, or a reliable phone service they are still going to charge me for 6 months contract that I don't want. Can't complain too much about this one, it was part of the contract but I still think it's a bit off.

Anyway, so I eventually arrange for contract to be canceled at the end of this month (July). Surprising, they can calculate instantly how much I'll have to pay off my contract - 6 months - 180 quid!. Well, ok. Fair enough. Business is Business. So we're agreed, service ends at the end of July. You'll send me a bill.

I wake up this morning to find both my TV and Phone not working. I ring up to determine the fault, and after listening to the northern chick for a 15 minutes I get through the guy in India. He asks me some "security questions" - as always things that I could read off my bill and then tells me that all my services have been canceled and hence disconnected. Well, theres a surprise.

9) They're money grabbing bastards. Where the money is concerned they can get it right straight off, however where the practical side is concerned they can't organize shit. Even better *all* my services have been disconnected - yet I seem to be using the internet just fine.

So, he tells me I need to talk to the sales/customer department. I've been through this loop before so I preempt him "let me guess, the customer department isn't open on a Sunday - so there's absolutely nothing I can do". The reply "The customer department is open 9-4 Monday to Friday" - wanker.

10) Customer Focus - they have none. The goal seems to be to screw customers out of every penny, provide sub-standard or non-existent services, when questioned or held accountable send out the under trained under paid brain dead tossers to act dumb and misdirect.

So, I get my hair off, tell the guy he can stick his company, thank him very much and put the phone down.

Now I'm here, expecting my internet connection to drop any moment, trying to relax and vent my anger. It's not working. I want a physical form of virgin media I can take it out on. I might just destroy their set top box.

Heh! It turns out I do have 10 reasons, how convenient. I would strongly advise anyone to steer clear of Virgin-Media. Their service is poor, their customer care is useless and they're low quality for high cost.

The Legacy Mistake

Legacy made a follow up to the game Law and Order (based on the the popular US TV show) imaginately named Law and Order 2 - insert catch phrase here. While the game isn't my cup of TV I've been reasonably happy to claim the original used a bit of Java so it was a nice reference piece.

However, while the second version, released in 2003, might be a great game, Legacy have made a severe mistake. They've included CCTV footage of Jamie Bulger, a toddler who was murdered here in the UK in 1993. Frankly, I'm disgusted.

1) Why was that footage even available publically?
2) Who the hell thought it was a good tasteful idea to put it in a game?
3) How is it that it wasn't caught before the game went?
4) How come it's taken 4 years to find it?

I mean, seriously, how the hell did this happen?

Given how much I was arguing religiously (pardon the pun) over the outrage over a viloent game featuring a church just the other week, this doesn't help the case. These things are worlds apart - a church in Manchester is backdrop. The church are just being their normal selfs complaining about it. However, this new idiocy is revolting and despicable. How can we fight against the iditots trying to stop pefectly valid games - when Legacy come along and do something this stupid?

Style over Substance

I come from a pretty rigourous software background. I've been coding since I was little, but like most people I reaslise that the trade education doesn't really start until you get into a work environment. My first commercial software role was in the defense industry working on some safety critical systems - as you can imagine software architecture, design and process was extremely important to my employers. I then went on to spent nearly 5 years at a big telecoms company who had if anything a more stringent research and design process. Software design for maintainance and robustness was everything, often at the cost of adding new features or polish within the project time line.

Design, Design, Design,

Review, Review, Review,

Some 12 years later I'm still in the environment basically. It's not a bad thing, but even given my years of brainwashing into the software design is everything mentality, I find myself recently swaying way back. I'm not saying I don't throughly think out my code, or design for future extension and maintainance - but I do most of these tasks retrospectively through refactoring (arn't modern tools great?). While I still love clever and elegant software design, I've come to realise that by far the majority of customers and users don't care about it :)

"Functionaly Complete" is a term we use round here alot. That's mostly what users care about from a code perspective. Does the program you've written do what they want it to, or what they need achieve? As long as it does without falling over thats great. In most cases even if there are some odd cases that either don't work or need to be worked around most user will continue using it as long as it "feels right".

After functionality comes how it looks and feels. In games this is especially important but it's true with most all the software I've come across. The user doesn't care whether the code is extremely efficient if it doesn't impact their use. They don't care if you've spent an age getting that object hierachy just right, especially if you've not spent time making it look right :)

What they care about is how easy it is to get their objective complete or to configure whatever they need to for an active system. Without knowing it most users also care how software feels to use. Is it flashy? Does it make intelligent assumptions? Does it impress them? Does it change the way they work/play? Does it make them feel like your software is smart? Perception is everything - you're not going to get to explain to user most of the time what makes it so smart.

Usability, Usability, Usability,

Polish, Polish, Polish,

If the software design is a means to this end, i.e. you're spending your time making the software clever so you don't have to waste time later that you can spend on adding the nice touches - then great. If you're trying to make your software be percieved as smart, through making it smart, it *might* work. Most of the time it won't. If you're spending an age over software design that doesn't give anything other than acadmic beauty then you might want to stop and think who's going to care? If the answer is "I Will!" then you might seriously want to consider what you're trying to achieve - if it's anything but an academic goal and you're probably on the wrong path.

While most of the above should be obvious, it appears it isn't. Like most software engineers, I like software design, it's what I do. The temptation is to put it infront of everything else - even without need.

Extreme Programming, here I come.

Self-Fulfilling Game Development Doom

I had a thought today, yes, it does happen sometimes. I'm currently working on a big game project called Runes of Yore (ROY). It's huge and it's complicated. Yesterday I thought I could do with a motivation break so I thought it might be worth writing a little game in say 40 hours or less - probably a week and half or something.

However, as I was considering it, I realised something. If I mentioned this to anyone they'd start questioning whether I was still interested in writing ROY. They'd make the assumption that because I chose to write a different game for a bit then I must be giving up on the first. In the past this has in some cases made me starting wondering about the big game again, and starting to doubt whether it was worth it - normally ending in me giving up and fulfilling the observers expectation - reinforcing the concept and causing it to happen again.

So, in short, it's everyone else's fault that I've given up on a bunch of games :)

For reference, I'm not giving up on ROY - I am however going to try and write a new demo game for slick merging in some phys2d stuff.

Taking things too seriously

The Java 4K contest is fun. As some people know I try to enter every time, but this year it's all just got a bit silly. The point of 4K is thats it's a challenge to fit a game into 4K. No one is going to write a great game, no one is going to build a masterpiece, it's just a way to make things interesting and limit the scope to allow some of the people with less time to compete.

At the end of it all you get comments from your peers on the game, and if you're lucky a result that makes you feel like you have some ability at game writing. So how come suddenly it's all so serious:

http://www.javagaming.org/forums/index.php?topic=16357.0

Similar thing happened last year when judging was mentioned. Does it really matter? I mean really? Why do you want judging by a group of random community members:

1) To get you some feed back - you get this through your forum post

2) To make you feel special - get a life.

3) To show everyone else how great your game is in comparison to theirs. Seriously, get a life.

What a horrible way to taint such a fun activity - a shadow cast by a select few over what is otherwise one of the most interesting, fun and innovative contests around.

At least someone is being positive:

http://www.javagaming.org/forums/index.php?topic=16378.0

Scared by SCA - XML debauchery.

SCA (Service Component Architecture) is another in a long line of "open" standards that have been pushed out over my lifetime. This one is from the boys at IBM with some help from their friends. It's wrapping around another buzzy term at the moment in enterpise software, SOA (Service Oriented Architecture). Like many standards this one aims to bring componentisation of software and software development allowing the non-technical users to build wonderous applications. Unlike many standards, this one is quite good. You can grab version one of the specification over at http://www.osoa.org.

Why the hell would I be interested? I write games! Well, no, the day job is all about enterprise software and I've spent my last few weeks flipping open my head and stuff the SCA specification in. Like most standards of the moment there's an XML dialect - there's always room for more XML don't you think? Unfortunately this one commits one of my most hated software crimes, the topic that blog post was meant to be about.

Consider, you've gone to the trouble of using XML. It's not the simplest of things to use, it adds a bunch of dependencies you probably didn't want and at times can be a right over-flexible pain to support. However, you've made your decision. So, you've come to a bit of XML that lists (in SCAs case) the references that this reference is promoted from.. notice, it's a 1 to N relationship. So, what'd you do? Well here it is:

<reference name="MyReference" promote="CompA/Ref1 CompB/Ref2 CompB/Ref3"/>

Can you see the irritation? We're going to use XML, we've incurred the penalties - but hell, we need a list, let's just encode it as a space seperated list. Please don't do this, it's so pigging annoying. How about:

<reference name="MyReference">
    <promote reference="CompA/Ref1"/>
    <promote reference="CompB/Ref2"/>
    <promote reference="CompC/Ref3"/>
</reference>

Rant Rant Rant... time for a nicer post.

Words vs Terms

Words - are powerful. Clear communication when trying to design/implement a software system as part of a team is extremely important. Obvious? Well, yeah. However, what seems to confuse people is the use of the correct terminology for a subject. In all diciplines there are technical terms, there are three reasons I can think of for using these terms:

1) For expediency. It's quicker to use a single unusual term to explain something than using 10 common words assuming that you know the person you're talking to also understands the meaning of that term. (e.g. MVC pattern)

2) To be explicit. Sometimes a term has been invented or reused to describe exactly what is meant by a particular object or action in a specific domain. (e.g. transient value)

3) Sometimes, terms are used to try and sound like you know more than you do. Normally by managers of one level or other. The terms are, without fail, used incorrectly and it's obvious to anyone who does understand them.

The interesting thing is you'd expect my beef (there's always a beef here) to be with people who live in point 3. It's not, we all know that there are people in the tech industry who get along by spreading the poop of male cows. Frankly, the industry wouldn't exist without these shitesters.

My beef is with people who can't see that 1 and 2 exist. There are good reasons to use the exact terms. Using the right terms doesn't make you a big headed twat, only treating people who query the meaning of a term like morons does that.

As you can tell this one has been affecting me recently. I find it really hard to understand what someone is explaining if they use a large number of words - I guess I have a short attention span. Worse still is when a explanation relies of the use of an incorrect term. It's really annoying to get knowing smiles and disapproving looks when you simply check that the term being used is actually the meaning intended.

Yes, building glossaries and terminology dictionaries is boring but without a common dialect we might as be talking english at a martian. And yes, we could use two tonnes of simple English in all cases but we do need to finish within our lifetimes. More than that, who determines what's "simple enough".

What's Javadoc for?

Javadoc - the wonderous addition to Java that made everything make sense or the thing that misleads and causes confusion?

Like most tools, Javadoc itself isn't inherently good or bad. It's existence as a tool is pretty brilliant but how useful vs confusing it is comes down to the developer using the tool.

So, what is Javadoc for? Well, the output is sometimes referred to as API doc and this gives us a clue. Javadoc is for documenting how to use the API. In many it comes down to providing some way of documenting the bits and pieces of OOP that the java language constructs left out. The most obvious one being pre/post conditions. Java doesn't provide any language constructs to handle these cases (unless you count assert, which really isn't the same thing as being able to compile time check preconditions and reflect postconditions). So what you get is documentation, in your API doc you say "This value must be non-null" or "This object must have been initialised by calling it's init()". This tells an API user what the preconditions are - albeit (see there's that word again) manually. Javadoc is a way of letting your API user know how to use the API.

What isn't Javadoc? Well, it's not where you should detail how the internals of your method works - thats for inline comments. Class level documentation is for explaining how to use the class as a whole and hopefully showing some examples. It's not to describe your understanding of the algorithm from xyz.com and how clever it is (and of course you are for being able to implement it) - just point at the site and explain how to use the class. For once, theres a reason. You don't document how the class/method works internally in the API documentation because:

1) It makes decomposition/abstraction less useful. If I have to grok how your class works internally while trying to work out how to use it's simple interface, then I haven't saved any space in my (tiny) mind to grok how my higher level complexity works.

2) Describing the internal logic gives the API user a chance to make assumptions about that implementation - which of course might change later without the API changing (no compile time warning that anything has changed). Yes the developer shouldn't make these assumptions, but why give them the chance?

3) You lose the message. Having a whole bunch of technical internal details described dilutes the information the developer actually needs - i.e. how to use the API. Harder to understand, more time wasted.

Javadoc is your friend, treat it right.

XML feed