Don’t Be That Developer

Back in April of 2005, I came across a strange syntax in some java programming I was doing for work.


Back then, there was no convenient free StackOverflow site to quickly find an expert who would know off the top of their head what that syntax meant. And searching for “[” on Google certainly wasn’t a winning solution since square braces weren’t even indexed characters. How do you search for something that you don’t know the name of?

It took a while to find the answer. It turns out, it was a tricky way, using reflection of saying the same thing as short[].class

Really? Who would have guessed? It certainly wasn’t clearly documented anywhere, especially not in the code where it was used. And where it was used, there was absolutely no reason it needed to be using reflection and using some sneaky syntax.

Had the developer just kept it simple and written so much as a comment, or used a more straightforward, well-documented syntax the code would have been easier to maintain. We’re not playing Code Golf here (though even if we were, the non-reflection version still comes out shorter)!

Leave a Reply

Your email address will not be published. Required fields are marked *