Article 5N53Q CodeSOD: Not to Contradict You…

CodeSOD: Not to Contradict You…

by
Remy Porter
from The Daily WTF on (#5N53Q)

Sometimes, readers submit code and say, "every line is wrong!" Usually, they mean that every line contains a bad choice, or represents a bad way of accomplishing the program's goal, or there's a series of compounding mistakes.

David sends us a block which... well, yes, every line is wrong, because every line contradicts every other one.

 /** * gets instance of Product Status object * * @return object Warehouse Supplier object */ function __construct() { $this->_price = new OrderValidator(); }

The only thing "correct" about this is that PHP does have you name your constructor __construct. Ignoring that, between the comment and the one line of executable code, not a single thing agrees with anything else. I'd suspect that this was progamming by copy/paste, but I feel like that'd be more coherent. It might be really bad AI generated code, but David assures us that this was written by an actual human.

otter-icon.png [Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today! TheDailyWtf?d=yIl2AUoC8zA-vtb3898n3o
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