Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Just got my first bad taste of spaghetti (code)...

edited June 2006 in Vanilla 1.0 Help
So I work for a direct mail company and I do their programming for them. I've rigged up several little file convertors and data input systems using Rails. Today I come in and my boss asks me to check out the file analyzer system that the guy here before me wrote in PHP. Basically it lets you upload a file and then it'll go through and spit out a sample of the first 10 or so records and also give stats such as what records contain the biggest fields. All he wants me to do is make it so that instead of showing a sample of the first 10 records, also to show a sample of the very last record. I think, no problem...that's just not that hard. Boy was I wrong. I open up the PHP file that does the work, and I immediately notice that this sucker contains everything...PHP, CSS, JavaScript, HTML, you name it. Alright, not that big of a deal. I'm not real familiar with PHP, but I've become a pretty decent programmer over the next few months, so I figure it shouldn't be too hard to figure out what part of the file displays samples. So I find it and I edit the code around to where the row number is the very last record. Okay, not so bad. Then I try and actually display that record. I get nothing but an empty row doing that. Hmm...so I look around, and as I suspect, only the first 10 records are being read out of the file. Not a problem, I'll just change that value. So I set the number of records to be read in to 9999. Hey, it worked! Oh, wait...not only did it read in those records, but it also displayed all 9999 of them. Great. Back to square one. I've met the guy in real life and he's literally a genius. That sure didn't stop him from writing some mean spaghetti code. Wow I finally understand the frustration that programmers express for it.

Comments

  • Options
    Yeah I've dealt with stuff similar. Very annoying to have to learn something like that when you're tied with time limits at work.

    Lucky for me it was a freelance job and I was getting paid by the hour :D
  • Options
    MarkMark Vanilla Staff
    edited June 2006
    The biggest mess I ever had to deal with was a ColdFusion site. This site was MASSIVE and they needed a huge amount of changes. I tried to convince them to switch languages and start from scratch, but they refused. So, I learned ColdFusion and did the work. It was three months of hell.
  • Options
    I love starting from scratch... Best method ever :)
  • Options
    MarkMark Vanilla Staff
    Me too!
    Especially when you already have a framework you can use to get going quickly :)
  • Options
    What I don't get it companies who hire you for your knowledge and experience etc and then proceed to tell you what they believe is the way to do everything and ignore what you say.
  • Options
    +1 Rewrite :D That is the happiest word in the world.
  • Options
    Oh yeah definitely rewrite. It takes half the time mostly to rewrite their stupid code rather then trying to figure out how they did it in the first place.
This discussion has been closed.