Thursday, November 13, 2008

you're a backend service, forget about the user

The title is an excerpt from my conversation this morning with a class ... no, not any class, you'll find out in a sec.

Her name is LibraryService and has been around for quite some time, and I can tell you she's on no diet. It grew to the point that no sane developer wanted to get in trouble with her, so they just feed her and everybody seems to get along. Just leave her alone, otherwise she might get nasty and do exceptional things that you won't expect.

She sits between the friendly GUI fellows that talk nicely to the user, inform him of errors, handle his mouse clicks, in a word they behave nicely as any counter officer should (some call them handlers) and the backend. So she takes the user's messages from the front-end guys through to the remote backend.

But this morning I discovered a hidden facet of her, let's call it update that does not yell back if she could not deliver the message. And this is most unusual for her, she that is always loud and ... nasty. Instead she bypasses the nice guys in front, picks up the receiver and calls the user directly (pops up a dialog in case you did not get the metaphor). This is wrong because the nice guys in the front will never know what happened with the message, so they might want to retry sending it.

What I've discovered next might be the explanation of her behavior, a new life form called Actions that masqueraded both as a counter guy and as her, fooled both parts, and put himself in-between. This would be fine as long as he helped in translating the messages that go to and fro. But instead he maliciously started to ignore her answers, both the acknowledging and the exceptional ones. He doesn't even do the job by himself, he creates another anonymous life form that has a start facet and delegates all the work to it. So both malicious and lazy, what could be worse?!

I suspect this is the reason she got upset, and started talking directly to the user. Now I'll stop this detective role playing, cause the only thing I feel right now is refactor the hell out of these guys.

Tuesday, November 11, 2008

boring

Are you through one of those periods when only not-challenging-enough tasks are handed over to you and you're just not learning anything new? ... and the blogs are no good cause you are missing the touch of a printed material?

Here is a piece of advice: think about an advanced programming subject you always wanted to know about, find a good book and read 2-5 pages daily. Just make sure the subject you choose is either part of every good programmer's culture or is related to your current work - you don't want to study something you can't practice.

My current pick is Java Concurrency in Practice.

Friday, November 7, 2008

passion for TODOs

Have you ever left a sticky note on your fridge saying Please remove this note? Have you ever been thirsty and had 10 sips of water thinking that you will have 2 more later? Have you ever written a letter 90%, left it on your desk with the intention of writing See you soon later?

NO, NO, NO.

Then why am I seeing these completely useless, countless TODOs in the code
TODO Add a comment describing the purpose of this file?

Man, why did you even bother to write this down? It is just a 79 line source file, couldn't you figure out what it was about? If you could not, which says something about you, why did you write this line anyway, what's its value? ... Wait, I know, you are using Subversion, you didn't wanna be left behind in the statistics so you had to change some files, any files?!

More serious than all the above, are you aware that writing shitty TODO lines removes your right to whine about the code being dirty? Have you thought about what a programmer is without his/her daily whining? I'll tell you - you'll have to talk only about the arts, ... and literature, ... and history when you meet in the hallway with your team mates - no, not even one complaint from you, you TODO addicted!

Ok now, stop crying, be a good boy, fix that and you'll get your code whining permission back again. ... on 2nd thoughts, fix all the stupid TODOs in the code, you TODO freak!

Tuesday, November 4, 2008

how do you measure success?

If you google for "debugging swing", my recent blog post shows up on the first Results page. Both google and answers.com ... not yahoo though. Today this is my measure for success.

Allow me for a moment to ignore questions like why this happened for this particular post and how long it's gonna stay there, just let me enjoy it. It made my day, and it's not even noon yet! :)