Outsourcing (the usual...)



  • I have the pleasure misfortune of taking over maintenance of a website originally developed by an outsourcing team in Pakistan.

    Really, I don't even need to finish this post. You know what comes next.

    .
    .
    .

    But I'll tell you anyway.

    The website was developed using CakePHP, which is basically an attempt to translate Ruby on Rails into PHP. I'm sure the fine membership of TDWTF will have plenty to say on that score, so I'll just note that the documentation, while broad, runs a little shallow -- and like many things PHP, the Google results for most searches yield only unanswered questions and the blind leading the blind.

    Now, CakePHP, like most of the modern web frameworks, enforces an MVC pattern. Cake goes one further, and gives you a separate Model file for each table, and a Controller and set of Views corresponding to each Model.

    Or at least, that's how it's supposed to work.

    Our Pakistani friends decided that that was too complex for them. Wouldn't it be so much simpler to just have one model and one controller, rather than a couple dozen of each?

    So they installed some ungodly hack that saved them the effort of creating separate model and controller files. In fact, they eliminated the model aspect almost altogether. Instead, every single view is a method in the grandaddy of controllers, which loads all models (using the "scaffolding" that isn't really meant for production sites to represent the ones they didn't bother to define) on every request, and manipulates the one or two that it actually needs to work with.

    In order to get this monstrosity to work, they also set up the URL routing such that every single request is funneled through this controller (except for admin requests, which all call the even more ridiculously overgrown admin controller). And instead of having any sort of dynamic page loading based on page IDs or slugs, there is a separate method in the controller for every single fucking page on the site.

    My current task is to add a new element to the site. In a properly architected CakePHP application, this would essentially entail adding a database table, generating default model, controller, and view files based on the table schema, and then customizing the defaults.

    I tried, I really did. But something in this morass of code is preventing the defaults from routing and loading properly. So, given that there is no time available for refactoring, I will be forced to perpetuate this dreadful scheme.

    I could follow up by chewing your collective ear off about the stylesheets where no margins are declared on paragraphs and no bullets on lists -- a situation remedied on some but not all pages by using inline style attributes -- but perhaps we'll save that for another day.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.