The Worst Code

  • Comments posted to this topic are about the item The Worst Code

  • All 5 fingures are not equal. The same way all developers are not equal and their skills vary based on interest, knowledge and experience. As all human are unique could not produce same result in one area but good in other area. That doesn't mean that one should able to catch their worst code. But here Jeff Atwood is mentioning about competent developer and it could be one of the ciriteria but not the only criteria to judge.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I understand the pragmatic need to get stuff done.

    One thing I have learnt about compromised solutions is that the time saved by short-cuts increments in a linear fashion (up to a point), the value of what has been delivered decreases geometrically.

    Take a short cut and exclude data quality checks. Massively decrease the worth of the data.

  • The worst code I have seen is either by the people who are so arrogant that they feel that nothing that they can do is wrong or simply don't care. I am never satisfied with my own code but sometimes achieve pride in my own work that the pragmatist in me allows. Too much satisfaction leads to complacency.

    I have yet to be satisfied with an OS, application or utility. That is not to say that I haven't been impressed but that I feel that there has always been room for improvement.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Oh God Steve, don't get me started!

    Good editorial!


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Regarding software that comes bundled with hardware, is not the actual software itself, but rather the buggy install package and the stealth marketing crap and spyware that attempts to hook into the web browser. Video device drivers are notorious for this.

    The worst programming code I've seen on the job originated life as a completely different project, and then another less talented programmer (or perhaps the same programmer crunched for time) starts a new project by copying the codebase and hacking it into something else entirely. A square preg will fit into a round hole, if you hack around the edges long enough and bang it with a hammer a few times.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • We also need those little wins that come from having our endeavors solve problems, even if we'd build software better the next time. The important thing is that you try to do better the next time.

    Two important things in that quote.

    1. It's great to write something that solves a problem

    2. It's a good mentality to strive to become better at solving those problems and writing better code.

    Great Editorial.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • dwain.c (3/18/2014)


    Oh God Steve, don't get me started!

    Good editorial!

    Oh please - get started Dwain 😉

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • dwain.c (3/18/2014)


    Oh God Steve, don't get me started!

    Good editorial!

    Thanks

  • Well maybe close to the worst code I have ever seen was written by me. We had 16k of room to print out a large document in an old version of BASIC. I kept running out of memory space trying to print it so the code ended up with more GOTO's than sand grains in a small beach. I SWEAR there was no other way to write it but when one of the other programmers had to upgrade it to a newer version of that BASIC he was not 'happy'. I actually felt fortunate that I was his boss at the time as otherwise I would have had to upgrade the code. 😀

  • John Hanrahan (3/18/2014)


    Well maybe close to the worst code I have ever seen was written by me. We had 16k of room to print out a large document in an old version of BASIC. I kept running out of memory space trying to print it so the code ended up with more GOTO's than sand grains in a small beach. I SWEAR there was no other way to write it but when one of the other programmers had to upgrade it to a newer version of that BASIC he was not 'happy'. I actually felt fortunate that I was his boss at the time as otherwise I would have had to upgrade the code. 😀

    Love the honesty. I have written bad code. Its just that I have seen worse. That says more about them than me.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Whether the worst code we've ever seen was somebody's elses or ours is not what's important. We have to own our code, just like we own the responsibility of our kids. We can examine our own stored procedure that been running "just fine" in production for years and make it run 2x faster by day's end, or we can spend forever pointing out flaws in someone elses code and accomplish nothing.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • The article is so true. I've been a developer since before the COBAL and Fortran days and long before the interactive programming days came along. But there is one thing I'll always remember from my first Programming 101 course: my instructor told us up front that coding is like making pancakes, the first program is always for throw-away! The batter's not correct, the griddle is not hot enough, etc. The dog gets the first pancake!

    Unfortunately, most of our employers don't want to pay us to make the second pancake even when we learned from our first attempt exactly how to make the perfect second one.

    Also unfortunately, most of us figured out that we always learned from each additional pancake flipped that there was an additional pancake that we could make that would be so much better than the last. And it is this knowledge that can frustrate the hell out of you the longer you program.

  • thood1 (3/18/2014)


    The article is so true. I've been a developer since before the COBAL and Fortran days and long before the interactive programming days came along. But there is one thing I'll always remember from my first Programming 101 course: my instructor told us up front that coding is like making pancakes, the first program is always for throw-away! The batter's not correct, the griddle is not hot enough, etc. The dog gets the first pancake!

    Unfortunately, most of our employers don't want to pay us to make the second pancake even when we learned from our first attempt exactly how to make the perfect second one.

    Also unfortunately, most of us figured out that we always learned from each additional pancake flipped that there was an additional pancake that we could make that would be so much better than the last. And it is this knowledge that can frustrate the hell out of you the longer you program.

    I never let the dog eat the first pancake...I like it!!!

    What does that say about my code? :ermm:

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • I love the pancake analogy. It perfectly describes my first attempts. The problem I see is too many developers never throw away that first pancake but add tons of syrup and toppings to cover for the crappy pancake and in the end, you get really sick eating the thing.

    Translation: to support a bad application we, as DBAs are forced to try and tune the database instance and hardware to make up for the bad code and we end up with a monster server for a solution that could have run faster on a tenth the resources.

Viewing 15 posts - 1 through 15 (of 27 total)

You must be logged in to reply to this topic. Login to reply