Tuesday, May 15, 2007

The Long Easy Way Versus the Short Hard Way

Today I had a small discussion with a good technical friend of mine ;) The discussion started with trying to handle an SQL Query with one shot.

The SQL Query got a bit too complicated to handle and needed some extra research, reading and thinking to figure out the correct way to do it. It took two technical brains, good MySQL experience, about forty minutes of work, and at the end some testing. It resulted with a long SQL statement.

Through our work we had another solution, its a very easy solution, get the data you need through multiple SQL statements. Thus, a long but easier way to do it.

We felt so proud that we were able to tackle the short difficult path, but at the end, considering the long easy path we missed, I felt a bit unrelaxed, but as soon as that happened, I was reminded with an important wisdom (by my amigo):

"If you keep choosing the easy and long path, you'll hardly learn anything. It's the difficult short path that provides you with extra skill and power."

Now imagine the amount of skill and power you can gain by choosing the long difficult path. Hmmmm, cool as long as no fatal mistakes takes place.

There's always alternate wisdom supplements when twisting different stories around.

5 comments:

Anonymous said...

ya im the good technical friend of his :)

well u know what? back in the days when we used to code for MS SQL, it was important to hit the database the least times possible, even for reading, so i remember innee galla3et writing long complicated SQL statemetns, and it used to make me feel good, now in MySQL its a bit different, and method we used last night was a hack, and I dont like hacks at all, thats why we felt awkward at the end! anyway, when I uploaded the files turned out mysql on the host was a previous version, so i had to rewrite using simple long way :s its now partially online, u can see what i was referring to... look for the reels (dub and time reel)

Basil 3ibs said...

Ok amal.

I believe there's a small problem with your terminology that needs cleaning up.

Its the word 'hack', you're misusing the word and treating it the same way as workaround.

A work around and a hack are different. I'll make sure to clarify this in my next post. "Hacks Versus Work Arounds".

Generally speaking, a Work Around is doing a temporary fix that will do the job for a while, although it is not guaranteed to keep working this way or with the required efficiency.

A hack is a bit different; a hack is using something in a way that has never been used before to fix the current problem. It does not indicate that its a dirty solution, and it doesn't indicate a weak solution.

No, a hack could exceed a typical solution in both efficiency, performance, design and everything else. The only reason its named a 'hack' is because its a non-conventional way of tackling this problem.

There's a grey area between hack and workaround in which the two terms can be used interchangeably and safely. However, you should not mix between their unique meanings elsewhere.

Shaneena said...

Cool :)

Anonymous said...

i dont know about u but hacks in css, are always dirty :)

Basil 3ibs said...

Yes. In CSS they call them hacks, they're using the grey area between hack and workaround.

Most CSS hacks take place due to browser incompatibilities or browser known bugs, therefore, they are better called workarounds, but since browsers hardly fix their bugs fast enough, the word hack can be used safely.

Enough over analyzing terminology.

Khalas, masheeeha, min shaan allah.