Article 4941Z CodeSOD: Getting to YES

CodeSOD: Getting to YES

by
Remy Porter
from The Daily WTF on (#4941Z)

"We're a dynamic, multi-paradigm organization, and we do most of our new development in a blend of Ruby and Go. We're not the kind of company that is dogmatic about tools though, we just want to deliver the best product for our customers."

That's what Delphia was told in the interview. She didn't quite grasp why they were mixing those two techs in the first place, but the interview went well, and she took the job. It was then that she discovered that everything she'd been told was technically true.

The company had just finished a sprint where they tried to pivot and reimplement their 15 year old codebase in Rails and Go. At the same time. It was difficult to tell from the code if this were a case where they did both together, or they were parallel projects, or frankly, if there was any coordination between either of them. That was their new development.

The company didn't do much new development, though. The core of the company's business was a 7,500 line PHP file which contained a single form. It depends on includes from dozens of other files, some of which depend on functions defined in the main PHP file, and thus can't be used in any other context but that include. It's less spaghetti code or even a big ball of mud, and more a career killing meteorite.

But it makes more money for the company in a day than Delphia can rightly count.

One function that Delphia kept seeing invoked a bunch was yesorno. It was used almost everywhere, but she had never seen the definition. So, curious, she went digging. And digging. And digging. Someplace around the fifteenth or thirtieth include file she read through, she found it.

function yesorno($in) { if($in == 'YES') return 'YES'; else return 'NO';}

That indentation, by the way, is typical of about 30% of the codebase, maybe less. You wouldn't expect any sort of consistency in this kind of code, would you?

proget-icon.png [Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how! TheDailyWtf?d=yIl2AUoC8zAb1XU26HACDc
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments