Sunday 8 February 2015

The Most Irritating Software Development Attitude

Hey all,

Over the years of being a Software guy I've come to develop some serious irritations with some ways in which development is approached.  Be it BDD, Agile or Object Oriented programming, it seems no development paradigm has ever managed to avoid being completely misinterpreted and abused.

One of the typical issues I've seen with the uptake of a paradigm is developers thinking they're doing BDD just because they're using Cucumber.  I wrote a blog post about this.

The term "REST" seems to be thrown around whenever a service is written using Jax-rs.  There doesn't seem to be much consideration for the fact that REST is a specification for sound semantics around the use of HTTP, which you could find out by simply looking up what REST stands for and why.

Object oriented programming seems to have deteriorated to "I'm liberally using Java-isms", and the blight of 1000-line classes with names like "GenericUtility" continues to spread.

I could go on.

So what anti-pattern can we distill from this mess of paradigm-abuse?

From what I have observed, it all seems to boil down to this:

"Using the tool means I'm following the paradigm".

This may sound sensible at first glance.  Clearly tools like Java, jax-rs, cucumber etc. were written to support particular paradigms.  All I have to do to follow these paradigms is to use the tooling that supports them, right?

I'd like to make the case for why this is horribly wrong.

Let's take the REST example.  REST (representational state transfer) is a specification for clean use of HTTP semantics to support the design of fluent CRUD-based web services.  Jax-rs is a set of java APIs that support the development of REST web services.

Say our business problem is to create a web service API for the managing of documents.  Jax-rs can be used to create a "/documentCreate" service with a POST method for the purpose of creating documents.   It can be used to create a "/documentRetrieve" service with a GET method that allows you to retrieve a document.  However, as "representational state transfer" suggests, URL paths should represent resources, not actions, and HTTP methods should represent changes in the state of a given resource.

The above is clearly not a RESTful approach, the RESTful approach being to create a single "/document" resource with the appropriate POST and GET methods.  Jax-rs facilitates the creation of RESTful interfaces, but it cannot mandate that it is used correctly.  As a result, it is time and again used to create semantically unsound, noisy looking web services with the label of "REST" slapped onto them.

And on that note, I return to my point.  The attitude of "using the tool means I'm following the paradigm" is plain and simply damaging and un-conducive to writing good software.  But let's give this attitude a bit of merit.  I think it stems from the urge to get things done, a pragmatic mindset perhaps.  My take on a solution to this is to encourage a healthy balance between pragmatic and academic thinking.  Don't just get things done, hit the books regularly too.

So in summary, using Cucumber doesn't mean you're BDDing; using jax-rs doesn't mean you're following REST; using Java doesn't mean you're doing OO and so on and so forth.  Using the tool does not equate to following the paradigm, so learn the paradigm before you start using the tools.  Hit the books, develop an opinion on any given paradigm, then get to using the appropriate tooling!

Let me know what you think below,

Cheers,

Shrek

No comments:

Post a Comment