Sunday, September 30, 2007

Ruby: First hack

Thursday night, last week, I released some static web pages. That’s nothing special, but the code that built them is, for me.

It’s me first ruby hack. It’s a flikr like doodad.

What it do?

It takes a cd of images (mainly bodybuilding), straight from the developers (I still use an analogue camera, just, but that’s another story). It crops, brands them and then builds a cluster of static web pages around them.

Using Image Magick, via rmagick, I manipulate the images. The images get rotate (if needed), cropped and branded. The data to do this is stored in a mysql data base. Each derived image is also tagged with data, so they can be captioned and grouped later. It is stored in three tables.

Next there is web page formatting. I used staticmatic for this. It based on HAML and SASS.

The formatting data is laid out as a node/leaf arrangement, also in the mysql database. Currently there is only one type of node. That is the root node type of page. All the leaf nodes types currently sit directly connected to the page node. The valid leaf types are navigation, photo grid and album. Currently there is no recursion up a node structure. That’s a future possibility.

That’s two tables, one for node and its one type, page. Not YAGNI (Your Aren’t Going to Need It), but then there is Agile Modelling. There are for leaf tables, Leaf and its three types. Six tables all up.

I’m sure you can guess what navigation and photo grid do.

Album is the complex stuff and the reason I wasted an automated process.

The album is a page cluster. On the page that has the album leaf, you get the results of the specific sports event. The event has divisions. Divisions have competitors, who appear in placing order. If a division or competitor has any photos with their tag, then it becomes a link to a generated page that contains a photo grid with all their tagged photos. The four tables that contain this data are event, division, competitor and place.

Now there is currently only one type of album. If I want an additional album structure for a different event thingy, I’ll refactor. The cluster generating methods would be moved into a command pattern that could be changed by Dependence Injection (DI). But YAGNI says that’s in some tomorrow.

What would I do differently, use rspec from the start.

Well that my first use of ruby in anger.


Gnoll110

Technorati tags:

Thursday, September 06, 2007

Projects gone bad: guesses dressed as science

Been reading the current edition of E. F. Schumacher’s 1973 classic “Small Is Beautiful”.

In chapter 3, “Resources for Industry”, I’ve just found the provoking paragraph.
It is fashionable today to assume that any figures about the future are better than none. To produce figures about the unknown, the current method is to make a guess about something or other – called an “assumption” – and to derive an estimate from it by subtle calculation. The estimate is the presented as the result of scientific reasoning, something far superior to mere guesswork. This is a pernicious practice which can only lead to the most colossal planning errors, because it offers a bogus answer where, in fact, an entrepreneurial judgment is required.

This paragraph really hits the nail of the head, with regard to one reason why big IT projects fail. So much is unknown, then inferred and finally dressed up as the plan that can be done for a tight budget and time frame.

No one says the Emperor has no cloth. The plan says he is fully dressed.

This is an environmental book. A good book for a generalist read.

Well worth the read.


Gnoll110

Technorati tags:

Sunday, September 02, 2007

Agile Toolkit: Joshua Kerievsky Agile 2007 podcast

Bob Panye has posted the first of his Agile 2007 podcasts.

It's downloading as I type. Thanks for the effort, Bob.

Agile07 - Josh Kerievsky - Scaling training, e-Learning and certification

Josh presented a session, Introduction to Refactoring & Evolutionary Design. No note or overhead so far.


Gnoll110

Technorati tags: