Rant : Your abomination is my clever hack

by Tom 2. December 2009 03:55

When I read the article from OdeToCode about the abuse of a programming language to create shortcuts, I felt the need to respond.

What is it about ?

Simply stated, it is about using some clever tricks to make it easier for the developer to reach his goal. The example was a stackoverflow post : Abuse of C# lambda expressions or Syntax brilliance?

Which discusses code that looks like this :

.Attributes(style => "width:100%")

What is the issue here ?

The issue was that the reaction of the c# language designers. They said it was unacceptable to use such a shortcut, since it was not originally intended in the language design. According to them, one should never use such a construct. I firmly disagree...

Why should one be allowed to abuse a development language ?

Simply stated : because you can. Every single thing that can help a developer to make cleaner/safer/better code (in his/her opinion) should be allowed. Why do we develop most of our applications in c#/java/ruby/PHP and not in assembly ? Because using these languages is considered cleaner/safer/better then using assembly. So while the original language designers might not like the idea, the hacks provide an extra cleaner/safer/better way to address a certain implementation subdomain. After all, the language is there as an intermediate between the developer and the hardware, and anything that allows better communication between the developer and the hardware, should be considered a plus... Which brings us to our next point of attention.

Who is saying that the approach you use here is cleaner/safer/better ?

Actually : nobody. That is something that you need to find out yourself. While some people might like to use the shown constuct, others might like the more verbose way of expressing things. Most of the time, these shortcuts are there as an alternative to the "common" way to do something. In most cases, the fact whether you like or dislike something is based on your background/knowledge/reference frame .
The fact that the alternative was built means that somebody had the intention of providing a better/safer/cleaner way of doing something. Whether you agree or disagree with this person is completely up to you... (Although I must admit that I certainly agree with this person). If you look at the dynamicobject feature (another heavy point of discussion), then you might see that this actually does something simular as the shortcut used here, so the language development team is actually doing the same.

Please note that it does not stop here; some people found the original c#/vb.net language to constraining, so they developed their own, including a manifest.

So, to conclude, if you think you can make your own life easier by using certain 'abusive' constructs : please do !!!

Bookmark and Share

Comments

12/2/2009 6:00:03 AM #

pingback

Pingback from topsy.com

Twitter Trackbacks for
        
        Rant : Your abomination is my clever hack
        [corebvba.be]
        on Topsy.com

topsy.com |

About Tom

Tom Janssens op LinkedIn

Tom Janssens op twitter

Core bvba RSS

 

Tom Janssens is an independent freelance ICT consultant that has been "into computers" ever since the age of 7.

Typing source code from a book evolved into exploring the limits of coding in procedural, assembly and object-oriented languages.
As he matured in software coding, he started focussing on the problems surrounding software development, and learned that software development is usually about people and interactions first, and about technology second.

Due to his diverse track record he gained insights in a lot of aspects of the software development process. Currently his main focus is on strategic ICT advice, lean product/project development and improving the software development process and architecture.

He avoids ivory-tower-approaches by applying and verifying the applicability of the latest tech buzz in software experiments.

He is also the founder of the following LinkedIn groups:

CQRS Professional
BDD Professional
Asp.Net MVC professional

More info about Tom and his company...


Advertisement

Forget all your SCRUM -, Kanban - and other Agile and Lean certificates

Here is the only true AGILE and LEAN certificate you will ever need:

The Creative Recursive Analysis Process Certificate
(CRAP Certificate for short)

More info can be found at the official CRAP certificate website:
http://bit.ly/CRAPCertificate