Some recent events have led me to reconsider my early programming days. Only a few years in but with thousands of hours and 10s of thousands of lines of code under my belt I was beginning to feel pretty confident. I had a very lucrative gig and after a few rounds of layoffs my team was efficient and savvy. This was the late 90s mind you, and during that time J2EE had bubbled up as an industry standard. We were a creative bunch and after some strategic pruning we were finally producing pretty robust solutions. I had personally discovered Java reflection and was having a blast exploring the possibilities. When I declared in a team meeting that all of our web forms could “build themselves” it took about 30 minutes to dispel the skepticism and decide on a course of action. Remember, this was the 90s, forms must be statically and manually coded in HTML. The word “dynamic” was only just getting the attention it deserved.
It worked like a charm. Java is a strictly typed language, and every data type has a logical form control equivalent. Boolean could be a checkbox, strings a text field. We could even inspect the property max size and constrain the form field accordingly! Again, I must remind you that this was the 90s, nowadays this is a no brainer. Back then it was “pie in the sky”.
Our team got a lot of attention even before our modules were going live. I personally got to demo the usage pattern and experienced (or imagined) a collective wow from the group. It’s pretty amazing to change a data-type and see the input control change immediately on the form to accommodate it without any extra code and virtually no static HTML!
As you might imagine things were going to take a turn, and in this case the turn came when the team lead from a different group rejected our request that he provide getters (the J2EE convention for a method that retrieves the value of an internal property/variable) for all of his object properties. His claim? He could only provide getters for non-boolean data types as the standard convention was to use “is” for booleans. I thought it would be simple, satisfy the convention but also provide a getter so that we could accurately inspect the object. No dice. The discussion went all the way up to executive (and non-technical) staff where this guy referred to me and my team as “hacks” for wanting to violate the sacred convention.
Now’s a good time for a break from the techno-babble. I like to drive as fast as I can while still being safe and not damaging my vehicle. I’m sure I’m not the only one. Yet each person has their own interpretation of what exactly is “safe”. Conventions are great, in that they help us to make fairly predictable decisions. Now some people may call speed limits a “rule” and in a certain context they’d be correct. Yet, technically speaking a speed limit is not a “rule” it is more like a convention. If it were a “rule” in a programming sense then roads simply could not support speeds higher than the limit. Cars would never be capable of exceeding the limit. They wouldn’t break, they just couldn’t do it. Yet, as a convention, the possibility exists for stretching it and bending it. Every-so-often a cop comes along and writes you up because your notion didn’t match his. He wins, cause he’s the cop. Yet in programming world, when two equal team leads from different teams clash, the only cops are non-technical management. Back to the story…
The case was run almost like a jury trial. We both brought witnesses from our different teams and laid out the evidence. Long story short, I lost. The phrase “non-standard” being parroted in nearly every sentence coming from their side and at one point the claim was even made that aliasing the functions would break existing deployments. That of course was a blatant lie. Extending an object’s capabilities by adding a method alias really has no such potential. In fact in counter arguments I referred to these supposed bugs as “regression” only to be met with a spew of criticism that the term should be “ripple effect” not “regression”… Things were really getting ugly. So I bailed. Good thing too, the whole project dissolved in a matter of weeks.
Nowadays “convention over configuration” attempts to remove the developer’s brain from the equation by pre-deciding as many things as possible as a matter of convention. Ironically the same brain must then be used to remember all of the said conventions. The fact is, conventions are good. When firmly applied they work wonders at keeping code consistent. When applied strictly they become as impractical as a cop pulling over an ambulance carrying a cardiac arrest victim for speeding.
In training and teaching I’ve always tried to emphasize the need to think for ourselves. Freezing like a deer in the headlights whenever the speedometer hits 56 mph is not just bad, it’s dangerous! I won’t be so dogmatic as to reject all conventions, standards, acronyms, and whatever else someone decides to brand and market. I just warn you, don’t be so dogmatic as to reject thought. It is a necessary component of a successful project.