Wednesday, November 17, 2010

OMG! that's so elegant! or is it?

Ah yes, the term used by developers that pretty much means "I found a cool way to make this reusable, or better, or check this out, or ... etc...".

This term is so often used in the development community that it is nearly meaningless.  You might as well paint one house blue and one house red, and call the red house elegant.  Elegant is an opinion so when you hear the term [elegant] take it with a grain of salt.  What matters when you are developing an application is that the application WORKS (uh oh, I hear the eyes of senior developers rolling).  Yes, of course you want to think through your process and try to make all the parts and pieces as reusable as possible.  However, that doesn't mean your way is wrong because someone tacked the word "elegant" to something they worked on, or look at your code like they just got punched in the stomach because it doesn't match their way of coding.

Here is an example:  Let's say you have a database call that relies on stored procedures as the command source.  How many ways can you think of to make this work?  I suppose you could create a constant "SPROC" variable and assign the stored procedure to it, and assign it to the command text where ever you need to call that stored procedure.  On the other hand you could just as easily say command source = stored procedure.

So which way is better?  It's a simple matter of choice.  However, I bet a certain percentage of people out there have already made up their minds on which is "better", and how their way, not represented in this example, would be "better".  And I imagine there are equally that many excuses as to why.

In conclusion I believe development is a bit like art.  Only the person, or team can decide the elegance of a bit of code.

-Matt