Wednesday, December 14, 2016

Gasp!

After reading But at least he enforced programming standards!, should I be laughing or crying?!?

Pilot fish is hired to take over the programming duties of a departing manager who also wrote code -- and that's not quite as simple as it sounds.
"He had several hard-and-fast rules for the programmers under him," says fish. "Rule number one: Never ever ever comment code, because a good programmer can figure out the code by reading it."
More of the ex-manager's rules that fish soon discovers:
  • Never use white space in code.
  • Use the shortest variable names possible. One-letter names are good.
  • Reuse code, even if the code you're re-using does something completely different than what is needed.
  • Put all vaguely related code into one procedure, and control which pieces actually execute on a call via complicated (and undocumented) parameter combinations.
  • Hide new business logic in whatever code is being worked on at a time. All code blocks must have unanticipated side effects.
"OK, that last one wasn't a rule -- it was just how he coded," fish says. "After ten years, I've refactored almost all of his code. I've not been able to get through all of it because there are too many places where I can see what the code is doing, but can't make heads nor tails of why it's doing it.


"For example, he would code around bugs found in other tiers of the code -- never fixing the bug at the source, just coding around it everywhere else. He also would change course mid-development, then leave all the dead-end orphan code in place. I can never tell if an unexplainable line of code is orphan junk or the string that would unravel the entire app."

While I never would reuse content from where it didn't serve the same purpose, this - reuse code, even if the code you're re-using does something completely different than what is needed - made me chuckle. I adore using "content reuse" instead of copying and pasting. I'd say I do go to an extreme. I admit that. My rule was simple. If I was about to write the same text that I knew existed elsewhere, I would create a snippet and store that text within it. I approached the documentation I was working on from the angle that I never wanted to copy and paste. I had gone through the text consolidation that I mentioned yesterday when dealing with the fiasco of the 18 Word documents. That experience was most definitely a driving force in my perspective.

No comments: