[LRUG] A snippet of code that some may find entertaining

Patrick Gleeson patrick.c.gleeson at gmail.com
Wed Dec 20 03:25:10 PST 2017


As it's the season of giving, I thought I'd share with you one of the most
fascinating pieces of code I've ever had the pleasure to inherit, back when
I was working with an entrepreneur who had outsourced his webapp MVP to an
agency.

If you've ever worked with Mongoid you'll know that Mongoid::Document#all
is, of course, widely known to be unperformant and buggy, and that any
serious developer will write their own implementation as step one of
building any sort of model layer for their application. This particular
example demonstrates admirable innovation with respect to naming
conventions, use of instance variables, `for` loops and method arguments.
Sadly, the identity of the original author of these lines is lost in the
mists of time (as the codebase sensibly eschewed 'version control' in
favour of 'having multiple copies of each file and appending `__1` to the
end of their names to mark older versions'), but I suspect they were the
same person who took the time-saving step of hard-coding the production
database credentials into both the production and development sections of
`mongoid.yml`, so that there was no need to set up a local database.

https://gist.github.com/patrick-gleeson/2932c2b2eb8418e1cee8c25a86d52273

However much the agency in question charged the entrepreneur in question to
write the codebase in question, I'm sure I've more than received value for
money from the entertainment I have experienced by reading it.

Merry Codemas, everybody!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20171220/7732f687/attachment.html>


More information about the Chat mailing list