I can has new contract nao?



  • Back in the day I inherited an application, and was asked to "fix" it.  I was a trainer/mentor at the time, and coding wasn't really in my job description, but being interrested in making the move into professional software development I jumped at the chance.
    I already had a lot of experience from hobby projects, and I was fairly confident in my ability to read and understand code, and even write some pretty maintanable stuff myself.

    After looking at the PHP code for a while, I decided that this unmaintanable heap of spaghetti would need to be rewritten if there was to be ANY hope of "fixing" it, and ever adding any features to it.
    It was developed by a friend of the IT Manager.  Said friend, who is not a software developer by trade, clearly had even less experience with code than me, and it was truly horrible.
    Mind you, I said it then and I still stand by it:  "This is clearly the work of someone very smart, as the logic is flawless, but there is nowhere near the experience behind it needed to build a production application."

    A short list of the worst WTFs:

    • Inline SQL statements with not even a hint of comments, or even indendtation.
    • Exactly zero indices in the database.
    • The only comments in the whole codebase were commented-out lines of code
    • "Revision control" was a set of directories named things like "October" and "November_4" (Not the 4th of november, but the 4th "backup" in November)
    • The parts of code that were actually pretty well written and too "elegant" for my limited PHP knowledge were revealed by Google to be examples from php.net
    • I didn't even know PHP had a "GOTO" function, but I assure you, it does.  Where it goes to, however, is sometimes unclear.

    Generally speaking, it had a vibe of "Teach yourself PHP in 21 days" over it.

    I went to my (new/temporary) boss and told him the sorry state of the project, and that it would probably need to be rewritten completely.
    He said that this was absolutely out of the question, as they needed this in production, and fixed, RIGHT NOW.
    I explained that as my PHP is a little ... lacking, I might have better luck "fixing it" if I "translated it into Perl", and said that would only take about a week.
    I got the go-ahead on that, and starting rewriting it translating it into Perl.

    Fast forward about a week, and I had a pretty good feature-equal Perl script, but I had sinned on the documentation due to time constraints.
    Everyone was happy now that the poor souls using the software did not all end up with the same "case" if they clicked "Next case" within a minute of each other, and that performance was way better.  It even looked better, and the users could now log more than three "events" per "case", seeing as they were saved to a separate table rather than being CaseLog1, CaseLog2 and CaseLog3 in the cases table.

    Fast forward again, but this time to the present date.
    The software in question is still my job, and I'm named as "Lead developer" on it.  While it is documented, it's always in a constant state of adaption to business needs, so if I (or any member of the team, really) get hit by a bus we'll have a rather frustrating time picking up the peices worked on for the last week or so.
    Still, we're successfully rolling out the third generation of the software across Europe, and next year it's going to be set up in one of our sites in Africa as well.
    Let's just say the scope of the software has grown slightly...

    So, what's the title on my contract, then?  It's still "Mentor".



  • @Chewbacca said:

    I didn't even know PHP had a "GOTO" function, but I assure you, it does

    Only as of 5.3 but I very much doubt that's the version that was used for this app. Please clarify.



  • @hkolek said:

    Only as of 5.3 but I very much doubt that's the version that was used for this app. Please clarify.
    http://php.net/goto

    function foo () {
    include(somefile);
    if ($someVarIHaveNeverSeenBefore == 3)
    include(someotherfile);
    else
    include(somethirdfile);}


    Not exactly GOTO, but just as funky.
    Each file would have maybe 10-12 statements, and would sometimes be used only once.
    A lot of them would have more include() statements, or sometimes require().  Infinite loops were common in the more obscure places of the application.
    Randomly, some would have exit statements, or conditionals on variables not set in that file.

    I don't think I'm exaggerating much when I say there were about one twentieth as many files as lines, if you don't count require() and include() lines.

    No error checking.  Ever.  Basically, it was always assumed that all went according to plan.



  • @Chewbacca said:

    The only comments in the whole codebase were commented-out lines of code

    Yeah, I've been guilty of this one,  but only on projects that have taken me a week or less to write.



  • @Chewbacca said:

    I explained that as my PHP is a little ... lacking, I might have better luck "fixing it" if I "translated it into Perl", and said that would only take about a week.

    Wow! And what did you do in that week so you didn't end up with a steaming pile of Perl? How many pages/LOC were involved? Sounds pretty impressive anyway.

     

     



  •  @b-redeker said:

    Wow! And what did you do in that week so you didn't end up with a steaming pile of Perl? How many pages/LOC were involved? Sounds pretty impressive anyway.

     

     Haha, please don't be impressed.

    The application was three MySQL tables:  users, cases and (added by me) events
    User logs in (matched against users table).
    User clicks "next", gets a "case" according to some very simple rules, and then logs "events".
    When done, the user clicks "next" again.  Rinse, repeat.
    Stuff gets into the cases table by reading an uploaded CSV file.

    Now that I lay it out like that, I sort of miss the simplicity of the application back then.  I don't know the size in terms of LOC, but it was very simple, and it was contained in three .pm files.
    (mod_perl2, btw)

    These days, it's hugely more complicated, with support for everything under the sun, like auditing, reporting, reviews, two gazillion different types of cases all with different rules etc etc.  The logic behind "new" alone is about 1k LOC now, with advanced priorities based on everything but the moonphase...



  • @Chewbacca said:

     @b-redeker said:

    Wow! And what did you do in that week so you didn't end up with a steaming pile of Perl? How many pages/LOC were involved? Sounds pretty impressive anyway.

     

     Haha, please don't be impressed.

    The application was three MySQL tables:  users, cases and (added by me) events
    User logs in (matched against users table).
    User clicks "next", gets a "case" according to some very simple rules, and then logs "events".
    When done, the user clicks "next" again.  Rinse, repeat.
    Stuff gets into the cases table by reading an uploaded CSV file.

    Now that I lay it out like that, I sort of miss the simplicity of the application back then.  I don't know the size in terms of LOC, but it was very simple, and it was contained in three .pm files.
    (mod_perl2, btw)

    These days, it's hugely more complicated, with support for everything under the sun, like auditing, reporting, reviews, two gazillion different types of cases all with different rules etc etc.  The logic behind "new" alone is about 1k LOC now, with advanced priorities based on everything but the moonphase...

     

    how could you leave out the moon phase you fool?



  • @DescentJS said:

    how could you leave out the moon phase you fool?

    It already has a complex system for tital prediction and day-of-year, which amounts to the same thing, really.
    Come to think of it, I might actually have to implement day-of-lunar-year, seeing as there is a remote possibility it might be used in China.  Tacking moonphase on that would be easy.



  • @hkolek said:

    Filed under: you've been brainwashed by CS people who thought that Niklaus Wirth actually knew what he was talking about

    Not the only thing he was wrong about. His quote about software getting slower more rapidly than hardware gets faster is also pure bunk-- only true if you're talking about, say, IBM software. Or possibly anything written in Java. An MP4 encoder today is significantly faster, creates a significantly smaller file, and creates a higher-quality result than a MP2 encoder 4 years ago. Each version of IIS blows web server performance out of the water. Given, IIS had a slow start, but it's really kicking ass now. The entirety of Windows 7 is faster and runs in less memory than the entirety of Windows Vista, with more features, in only about 2 years of development. Ditto with practically every OS X release.

    It might, MIGHT, be true if you very narrowly define "software", or you forget to consider that programs gain more features over time. But still probably not.



  • @Chewbacca said:

    tital prediction

    Predicting... tits-all?

    I can do that. Very popular request too.



  • @blakeyrat said:

    His quote about software getting slower more rapidly than hardware gets faster is also pure bunk-- only true if you're talking about, say, IBM software. Or possibly anything written in Java.
     

    Or Microsoft Office.  Or anything written by Adobe.



  • @b-redeker said:

    Predicting... tits-all?


    Mmmm.... Tits.....



  • @b-redeker said:

    Predicting... tits-all?

    Yeah, that, or I typo'd on "tidal". I guess we'll never know, because when I happened to accidentally google "tits" I sort of got sucked in.



  • This was a good read.

    Good thing you posted it to the Sidebar. I shudder to think what it would have become had Remy Porter gotten his hands on it.



  • @Zecc said:

    This was a good read.

    One does what one can to contribute back. Thank you.

    @Zecc said:

    Good thing you posted it to the Sidebar. I shudder to think what it would have become had Remy Porter gotten his hands on it.

    Aaaaw, it's not THAT bad, is it?
    I mean, if you take the time to read the HTML comments it's sometimes quite funny.
    A little like undercooked goose eggs smell "funny", but we take what we can get.

    I, for one, feel like I'm getting my money's worth.



  • :(  I like Remy's articles.<!-- lol -->

    Chewie, what does your manager think about your title?  Is it tied to your compensation?

    Edit:  Whoa, check that out.  I can add Remy-style comments in this post, but it doesn't show up in the thread.  Yet when I edit this post, I can still see them in the HTML view.  So it seems CS does store them, but it feels compelled to take the time to scrub them from the final output.  Fascinating.



  • @Xyro said:

    Chewie, what does your manager think about your title?

    Who knows what management think?

    It's not likely to be changed any time soon anyway.

    @Xyro said:

    Is it tied to your compensation?

    Not at all, thankfully. Even though our mentors/trainers make OK money I don't think I'd do this work without better pay than [i]that[/i]. Sure, programming is more rewarding, but as a mentor there is relatively little stress and significantly less red tape.



  •  To ask more directly, does your title actually mean anything?



  • @Xyro said:

     To ask more directly, does your title actually mean anything?

    That he can call us vassals.

     




  • @Xyro said:

    To ask more directly, does your title actually mean anything?

    What, Mentor or Lead Developer?

    "Mentor" means "Trainer that also walks around and is available to answer questions on his/her subject outside trainings, and does side-by-side monitor and one-on-one training when needed", but that didn't fit on the company standard contract's "Title" field.

    Lead Developer means I get to make the decisions as far as implementation of the software goes, and I get to say when it's ready for QA.
    It also means my phone rings at odd times, and that I'm the one that has to deal with all the red tape so the rest can Just Write Codetm.
    Oh, and it means I get to do battle with the Dark Knights of ASP and the Beast of the PHP Wasteland to defend The Holy Ways of Larry Wall and Tim Toady.



  • Was this the beginning of what is now Bugzilla?



  • @crippledsmurf said:

    Was this the beginning of what is now Bugzilla?
     

    Haha, no, not even close.
    This is an in-house-only app for logistics issue tracking.  The company I work for is not a household name, but the one we do tracking/followup for certainly is.
    That said, I'm not comfortable telling you the client's name on here, so there is no need to ask.


Log in to reply
 

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