Feeds:
Posts
Comments

Archive for December, 2007

Does this sound familiar?

programmer:
“We need to refactor this code…”
manager:
“Why?”
programmer:
“It’s horrible unmaintainable code!”
manager:
“But it works!”

From the outside, the idea of “clean” code or “dirty” code doesn’t make much sense. Code seems to be an entity with a binary quality: works/doesn’t work. Bugs might appear more similar to dust needing to be wiped from a surface rather than loosening duct tape that is barely holding everything together.

I’d like to propose a new way to communicate the multiple whys of refactoring to non-technical people.

Wikipedia describes a Rube Goldberg machine as:

… an exceedingly complex apparatus that performs a very simple task in a very indirect and convoluted way.

Something like that:

When requirements change and programmers start cringing it might be because they know that something simple like “make the light turn on faster” might require adjusting the size of the marble rolling down a slide or changing the color of the cat that gets scared in the process of a balloon popping.

John Panzer said:

Software Development is a knowledge acquisition activity, not a manufacturing activity.

Developing software involves some level of experimentation. During the course of development, programmers understand more and more about the problem they are trying to solve. Unfortunately, the first working solution they might put together will very rarely be the most straightforward or the most elegant.

Alan Perlis said:

Simplicity does not precede complexity but follows it.

The Rube Goldberg machines of software exists because the scaffolding of an application might work very similarly to the finished application.

There is a difference between “is it working?” and “is it done?”. That difference might well in the “how”.

Caveat: There are plenty of reasons not to refactor whether economical or otherwise. However, changes to an existing code base usually takes much longer than expected because of its not uncommon Goldbergish qualities.

Read Full Post »

$50

Last night, I stopped by the ATM and withdrew a large amount of money (I don’t especially like to visit the ATM, I usually “batch” my withdrawal needs). I cringed when the ATM’s slot opened and $50 bills appeared. $50 bills are weird beasts … they are technically legal currency, however, they are always treated like fake money.

This, of course, wasn’t the first time it happened to me. I tried to figure out what large dollar amount would not trigger the lets_dump_fifties(…) function, but, as far as I can understand the ATM software, it will dispense according to something like:

(desired_amount is divisible by 20, it goes without saying)


bills[50] = (desired_amount / 100) * 2
bills[20] = (desired_amount - bills[50] * 50) / 20

The problem, once you have the undesired bills, is how to get rid of them.I tried to share my amusement-pain with a clerk at Indigo:

me: (takes out and hands over a $50 bill)
clerk: (cringing face, goes through the step of verifying it)
me: "you know ... a real $50 really feels like a fake $50 ..."
clerk: (uncomfortable/nervous) "what do you mean?"
me: "well … they are treated the SAME"

And that is just with places that even bother taking $50 bills. Try to purchase something that’s $2 with one and you’ll see how well it gets received.

At the other end of the spectrum there are coins. And the same problem exists. Here’s an interesting section from Wikipedia:

Legal tender of Canadian coinage is governed by the Currency Act which sets out limits of:
40 dollars if the denomination is 2 dollars or greater but does not exceed 10 dollars;
25 dollars if the denomination is 1 dollar;
10 dollars if the denomination is 10 cents or greater but less than 1 dollar;
5 dollars if the denomination is 5 cents;
25 cents if the denomination is 1 cent.
Retailers in Canada may refuse bank notes without breaking the law. According to legal guidelines, the method of payment has to be mutually agreed upon by the parties involved with the transactions. For example, convenience stores may refuse $100 bank notes if they feel that would put them at risk of being counterfeit victims; however, official policy suggests that the retailers should evaluate the impact of that approach. In the case that no mutually acceptable form of payment can be found for the tender, the parties involved should seek legal advice.

Time to start making repeated $80 withdrawals.

Read Full Post »

Follow

Get every new post delivered to your Inbox.