• anonymous coward (unregistered)

    The real WTF is the deep nesting. The fact that nesting involves loops comes as a bonus, I guess. But this is not an exception, I am afraid, this is a standard pattern (C++):

    if (..) { if (...) { if (...) { ..... }}}}

    I think I counted 14 levels once (10 for sure).

    The justification around here is: avoid multiple returns, break, and continue.

  • (cs)

    I find that my LINQ to SQL code is considerably less efficient than the equivalent SQL. What I think needs to happen is a replacement language for SQL that is stored and run directly in the DBMS. SQL is powerful, but it can also be a nightmare for non-trivial queries. I think it's time we rethought the whole querying relational data thing and came up with a more modern language. :) But still something at the DBMS level.

  • Jeff (unregistered)

    It's not enough. We need to go deeper.

  • Dave (unregistered)

    The flip side here is that code like this, combined with non tech-ignorant management provide the perfect opportunity for any decent developer to come along, fix this with about 30 minutes work and become an instant hero for management.

    All praise to the original author you hero maker =D

  • The one, the only...... Nagesh Kukunoor (unregistered) in reply to hoodaticus
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

  • Gunslinger (unregistered) in reply to Bill's Kid
    Bill's Kid:
    This is what happens when a self-taught VB programmer teaches himself SQL.

    As someone who has taught himself both VB and SQL, I disagree. This is what happens when a bad programmer partially learns something and doesn't get their code reviewed.

  • Fedaykin (unregistered) in reply to steenbergh
    steenbergh:
    I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.

    I used to be like that, then I learned the value of using the right tool for the right job.

  • Gunslinger (unregistered) in reply to Bill's Kid
    Bill's Kid:
    This is what happens when a self-taught VB programmer teaches himself SQL.

    As someone who has taught himself both VB and SQL, I disagree. This is what happens when a bad programmer partially learns something and doesn't get their code reviewed.

  • Gunslinger (unregistered) in reply to Kang
    Kang:
    I have seen ABAP code very similar in general structure to that in SAP. And I'm not talking about what some junior ABAPer did--I'm talking about SAP-created functions.

    ABAP == As Bad As Possible??

  • Mark (unregistered) in reply to Valczir

    Team! Team, team, team, team, team. I even love saying the word 'team'. You probably think this is a picture of my family? No! It's a picture of The A-Team. Bodie, Doyle, Tiger, the Jewellery Man.

    Why isn't The Cow in that picture?

  • ÃÆâ€℠(unregistered) in reply to The one, the only...... Nagesh Kukunoor
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

  • (cs) in reply to SCSimmons
    SCSimmons:
    Scott:
    Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.
    No doubt. The struggles with answering those complainers are never-ending. "I don't think this report is correct." "Here's the documentation of exactly where all of the numbers on it come from." "I can't figure that stuff out, but I just don't think the report is right." "Why not?" "Well, it doesn't match the numbers on this other report." "Where do the numbers on that report come from?" "I don't know." "Then what makes you think those numbers are correct?" "We've been using that report for years! It must be right!" "I have another theory. It's that you've been managing to inaccurate data for years and never noticed." "You're not a team player." :(

    We have customers who do that to us, but in the context of comparing our product to a competitors product.

  • NC (unregistered)

    Clearly he did this all wrong, he should have put a 4 hour sleep and told the boss he halved the time the report took to generate.

    Then say he was still working on it, spend some days reading the interwebs, then change the sleep to 2 hours.

    Tell the boss hes halved it again but recons he can squeeze some more performance out of it. Spend some days reading the interwebs, then take the sleep off.

    1 week of free reading.

  • nobody (unregistered) in reply to Nagesh
    Nagesh:
    Power Troll:
    Impressive. Typically, my queries only go 8 or 9 layers deep.

    WTF? I don't think that it is necessary to go that deep.

    Chicks don't always like it when you go that deep.

  • (cs) in reply to boog
    boog:
    Timmorn:
    Anonymous:
    Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!
    ... in a dream.

    You need to go deeper!

    It's already 14 layers deep. We go any deeper, and the report will take an eternity to run.

    It's just FOREACHs, all the way down.

  • (cs) in reply to 3rd Ferguson
    3rd Ferguson:
    ...queries their queues...
    ...queries their queues...

    Hmm...

    A quarrelsome quest for questionable queries! A quotidian quagmire quickly makes quad-cores querulous. But quality code quashes quackery.

    Let's quit and quaff!

    /14 layers of queues?

    Quite!

  • (cs) in reply to Valczir
    Valczir:
    SCSimmons:
    Scott:
    Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.
    No doubt. The struggles with answering those complainers are never-ending. "I don't think this report is correct." "Here's the documentation of exactly where all of the numbers on it come from." "I can't figure that stuff out, but I just don't think the report is right." "Why not?" "Well, it doesn't match the numbers on this other report." "Where do the numbers on that report come from?" "I don't know." "Then what makes you think those numbers are correct?" "We've been using that report for years! It must be right!" "I have another theory. It's that you've been managing to inaccurate data for years and never noticed." "You're not a team player." :(

    Hello? What? Well if you can't work as a team you're all fired. That's it, you heard me, fired! Get your things and go.

    Hello, security? Everyone on floor 4 is fired. Escort them from the premises. And do it as a team. Remember, you're a team and if you can't act as a team, you're fired too.

    Dom, get on to recruitment. Get them to look for a security team that can work as a team. They may have to escort the current security team from the building for not acting like a team.

    Team! Team, team, team, team, team. I even love saying the word 'team'. You probably think this is a picture of my family? No! It's a picture of The A-Team. Bodie, Doyle, Tiger, the Jewellery Man.

    Also, do not type "Google" into Google. You can break the internet. Seriously. Don't even do it as a joke.

  • (cs) in reply to ais523
    ais523:
    I'm not sure about PHP, although it's generally less tolerant of interpreting a random string of characters as a program than Perl is, so I suspect it's invalid in PHP too.
    It is true, many useful codes are syntax invalid in PHP. $BOSS->$BOSS however is not invalid syntax, but HelloWorld(52)[3] is invalid syntax.
  • Tim (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi :
    What I want to know is how do you make time to refactor code like this? Every job I have worked at has always kept us developers swamped with "new" work and we are never allocated time to go back and fix things as the rule is "There is ALWAYS something to do"

    Get reasonable performance requirements written into the requirements for the product. By that I mean actual numbers e.g. "such and such and operation will take no longer than XXX seconds on YYY hardware" or "able to perform XXX operations within a YYY period with the ZZZ constraints <insert network bandwidth, CPU, etc as required>". Make sure that by your estimate the numbers should be achievable. Also make sure that any schedule includes an optimisation phase, and a stakeholder who needs those performance numbers met to champion it.

    If such performance is not met by the project, you then negotiate to do one or more of the following (preferably as early as possible):

    a. Relax the performance requirements; b. Change the hardware requirements; c. Add developer time for optimisation.

    On multiple projects I've negotiated an amount of time for optimising in the schedule (waterfall, agile and hybrid projects). I always advocate "make it work, then make it fast". On my last project we were well off the performance requirements after "making it work". I'd already got a committed 3 weeks for optimisation in the schedule. After the first 2 days of my "make it fast" phase I'd improved performance about 10x (working with my own codebase, so easier), but we still weren't at the numbers. After 1 week I'd achieved 100x improvement in the most important areas and we were well within our performance requirements.

    I then made it clear that the remaining 2 weeks were still committed for optimisation if I determined that it was needed.

    I was in the fortunate position of being the technical lead on that project, but I've previously managed to negotiate time for optimisation on projects where I was "just a developer". The important points are to "prove" that it is needed (e.g. customers set the requirements); to have someone with enough influence to enforce that it happens, and to be confident enough to say "I think this is achievable within XXX timeframe".

  • Tim (unregistered) in reply to Tim
    Tim:
    After the first 2 days of my "make it fast" phase I'd improved performance about 10x (working with my own codebase, so easier), but we still weren't at the numbers. After 1 week I'd achieved 100x improvement in the most important areas and we were well within our performance requirements.

    I should add in our defence that it was a J2EE project using JPA (Hibernate) and the initial slowness (most of which was due to the database) was (a) largely due to strong relationships between entities (i.e. fetching the entire tree instead of just what was needed) and (b) didn't show up until we had large amounts of data in our performance tests (actually a similar setup to the article - agents with skills, assigned to supervisors, etc - about 20,000 of them).

  • Anonymous (unregistered) in reply to xtremezone

    How about we added to DBMS the capability to store compiled code inside them? Then this code could be call-able through queries as functions or as procedures. I think I would call them saved procedures or stored functions or something like that.

    I might as well patent the idea right now.

  • Anonymous (unregistered) in reply to Anonymous
    Anonymous:
    How about we added to DBMS the capability to store compiled code inside them? Then this code could be call-able through queries as functions or as procedures. I think I would call them saved procedures or stored functions or something like that.

    I might as well patent the idea right now.

    (this was in reply to #336270 ).

  • The Web is the Root of All Info (unregistered) in reply to dohpaz42

    Are you sure he shouldn't be using some Spaten Optimator instead?

  • Guava Programmer (unregistered) in reply to Tim
    Tim:
    Tim:
    After the first 2 days of my "make it fast" phase I'd improved performance about 10x (working with my own codebase, so easier), but we still weren't at the numbers. After 1 week I'd achieved 100x improvement in the most important areas and we were well within our performance requirements.

    I should add in our defence that it was a J2EE project using JPA (Hibernate) and the initial slowness (most of which was due to the database) was (a) largely due to strong relationships between entities (i.e. fetching the entire tree instead of just what was needed) and (b) didn't show up until we had large amounts of data in our performance tests (actually a similar setup to the article - agents with skills, assigned to supervisors, etc - about 20,000 of them).

    I thought lazy loading is on by default?

  • GFK (unregistered) in reply to SQLDave

    The Elders of the Internets would never let you do that anyway.

  • GFK (unregistered) in reply to SQLDave
    SQLDave:
    Valczir:
    SCSimmons:
    Scott:
    Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.
    No doubt. The struggles with answering those complainers are never-ending. "I don't think this report is correct." "Here's the documentation of exactly where all of the numbers on it come from." "I can't figure that stuff out, but I just don't think the report is right." "Why not?" "Well, it doesn't match the numbers on this other report." "Where do the numbers on that report come from?" "I don't know." "Then what makes you think those numbers are correct?" "We've been using that report for years! It must be right!" "I have another theory. It's that you've been managing to inaccurate data for years and never noticed." "You're not a team player." :(

    Hello? What? Well if you can't work as a team you're all fired. That's it, you heard me, fired! Get your things and go.

    Hello, security? Everyone on floor 4 is fired. Escort them from the premises. And do it as a team. Remember, you're a team and if you can't act as a team, you're fired too.

    Dom, get on to recruitment. Get them to look for a security team that can work as a team. They may have to escort the current security team from the building for not acting like a team.

    Team! Team, team, team, team, team. I even love saying the word 'team'. You probably think this is a picture of my family? No! It's a picture of The A-Team. Bodie, Doyle, Tiger, the Jewellery Man.

    Also, do not type "Google" into Google. You can break the internet. Seriously. Don't even do it as a joke.

    The Elders of the Internet would never let you do that anyway.

  • Someone who can't be bothered to login from work (unregistered) in reply to steenbergh
    steenbergh:
    I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.

    Whereas I'm the kind of developer that likes to let the RDBMS do what it's good at. Frankly I'll push as much work as is possible and practical on to the database.

  • SG_01 (unregistered) in reply to imgx64
    imgx64:
    Electro Protonucleus:
    Ken B.:
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

    TRWTF is the programming language you seem to be using.

    This is either Perl (which I don't know much about) or PHP (which I used before it got all this fancy OO stuff). Either way, I don't think the second $BOSS should have $, but I could be wrong.

    This is valid PHP due to variable variables (pure evil):

    <?php class BossClass { public $BOSS; public $Offspring; public function __toString() { return "BOSS"; } } $BOSS = new BossClass(); $BOSS->BOSS = new BossClass(); $BOSS->BOSS->Offspring = Array("Offspring 0", "Offspring 1"); echo $BOSS->$BOSS->Offspring[1]; ?>
  • greyfairer (unregistered) in reply to boog
    I've seen this behavior before; a developer refuses to work with the database, so his act of "rebellion" is basically doing the database's job on the app side.
    Been there, done that. Complete with indexes, B-Trees and hash match calculations in the application. Even automatic defragmentation IIRC. In my defense, I was fresh out of college, with D. Knuth's TAOCP on my side.
  • Tim (unregistered) in reply to Guava Programmer
    Guava Programmer:
    Tim:
    I should add in our defence that it was a J2EE project using JPA (Hibernate) and the initial slowness (most of which was due to the database) was (a) largely due to strong relationships between entities

    I thought lazy loading is on by default?

    Having to remember back a bit (was made redundant, been fixing up a house for the last 6 or so months ...) but whether a relationship is lazy or eager by default is configurable and/or depends on the version of Hibernate (I'm pretty sure the default changed between major versions or something).

    In our case, an eager-by-default policy suited the third-party libraries we were working with (remember - first, make it work), in particular because the retrieved data needed to escape the EJB boundary - everything that was needed outside that boundary had to be loaded by the time it escaped. Selectively making relationships lazy and ensuring they were used appropriately made more sense. Unfortunately, this usually resulted in much much more data being loaded than was required.

  • Swedish tard (unregistered) in reply to ÃÆâ€â„Â
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

    स्तन

  • (cs) in reply to Guava Programmer
    Guava Programmer:
    Tim:
    Tim:
    After the first 2 days of my "make it fast" phase I'd improved performance about 10x (working with my own codebase, so easier), but we still weren't at the numbers. After 1 week I'd achieved 100x improvement in the most important areas and we were well within our performance requirements.

    I should add in our defence that it was a J2EE project using JPA (Hibernate) and the initial slowness (most of which was due to the database) was (a) largely due to strong relationships between entities (i.e. fetching the entire tree instead of just what was needed) and (b) didn't show up until we had large amounts of data in our performance tests (actually a similar setup to the article - agents with skills, assigned to supervisors, etc - about 20,000 of them).

    I thought lazy loading is on by default?

    Hah! That was a good one!

    Addendum - nevermind - didn't notice the Hibernate

  • (cs) in reply to Swedish tard
    Swedish tard:
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

    स्तन

    That translate to "boob" in english.

  • Nagesh Kukunoor (unregistered) in reply to Nagesh
    Nagesh:
    Swedish tard:
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

    स्तन

    That translate to "boob" in english.

    Imposter has proven nothing but his ability to use Google Translate.

  • (cs) in reply to ÃÆâ€â„Â
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.
    I am Nagesh Kukunoor and so is my wife!

  • (cs) in reply to boog
    boog:
    Perhaps the original developer didn't approve of the project's selection of database software/vendor? I've seen this behavior before; a developer refuses to work with the database, so his act of "rebellion" is basically doing the database's job on the app side.

    It's sad, really. Sad, and funny.

    I've seen that happened once, it was indeed sad and funny (specially funny since I didn't have to fix/deal with it:P)

    Funny thing is that the CodeSOD is exactly the type of code I had to deal with with my first full-time programming job. Only difference was that it was written in FoxBase (instead of forEach we had SCANs)... and at least this CodeSOD has decent indentation. Imagine this CodeSOD with truly random indentation, duplicated by the dozen in a single source file... and then hundreds of such source files (evil grin.)

    My team, myself, had to deal with that type of crap by the hundreds, literally hundreds of legacy reports originally written by a consultant who I'm sure charged more than all of us combined, with logic liberally copied and pasted from each other in a combinatorial madness.

    It took us about 2 years non-stop just to clean that shit with proper SQL and a modicum of modularity. Baptism by fire baby!

  • (cs) in reply to SQLDave
    SQLDave:
    Also, do not type "Google" into Google. You can break the internet. Seriously. Don't even do it as a joke.

    How about this: http://lmgtfy.com/?q=letmegooglethatforyou&l=1 ?

  • (cs) in reply to Kiss me I'm Polish
    Kiss me I'm Polish:
    BRAAAAAM If you see that your task becomes a 14 layers deep loop - or similar monstrous pattern, the first thing to ask yourself is - "am I taking the right approach?" and answer immediately with a "no."

    Indeed. When run amok, cyclomatic complexity can be an unforgiving fat singing lady.

  • (cs) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    What I want to know is how do you make time to refactor code like this?

    Depends on the type of organization you work and the urgency of refactoring. If the code is ugly and suboptimal, but the cost of living with it as-is is much less than the cost of fixing it, you just let it be.

    It's only for code that really needs to be refactor (because it can't be extended, or runs unacceptably slow, or whatever) that you put the effort to refactor, and only when the organization or team (not you) allocates time for it.

    Otherwise, it is typically a losing battle. And at this point, the only other alternative is to make sure that new code is properly refactored and written. Otherwise, it's like adding more techno-shit on a techno-shit lasagna... and this is typically what happens (sadly so.)

    And writing code with continuous, judicious refactoring should be way to go (barring emergencies), independently of whether the existing code base is good or bad.

    ObiWayneKenobi:
    Every job I have worked at has always kept us developers swamped with "new" work and we are never allocated time to go back and fix things as the rule is "There is ALWAYS something to do"

    Maybe you need to be a bit pickier where you work (which is obviously not an easy thing to do, specially with today's economy). When push come to shove, we work in whatever festering software cesspool that is available. Bread to the table first and foremost. But when the opportunity arises (and it always does if you keep your eyes open), one should pursue better teams, better projects, better organizations.

    Many times you will find that you cannot go back to fix things that are just truly ugly. So the only way to move forward is to work on the "new" things. And here I have to ask you: do you write these "new" things the proper way? Do you refactor? Do you constantly clean as you go forward?

    Because that's the only thing one can do when there is no time (or organizational will) to clean existing systems. The things that are written like crap is a given. The new things that come from that point, they are not given.

    So the only practical solution is to make things better by not making them worse, by raising a working standard. As you do that, typically, productivity goes up. And if goes up sufficiently, the organization might get the will (and the ability) to free resources to refactor (or replace) the old things that need refactoring.

    ObiWayneKenobi:
    My current job could do with a fair bit of code cleanup but there is no time allocated. Should I pretend to take longer on other assigned tasks and use that time to refactor some code

    Only if doing so directly helps you deliver on your current tasks on the required time, in a manner where refactoring is a living, continuous practice. At the end of the day, you are a professional on payroll, paid (for better or worse) to produce something on a schedule (on their schedule, not yours.)

    Even then, I would be hesitant to do such a thing because it artificially inflates the actual time to implement your current task. So from there it becomes impossible to estimate the actual cost of building things.

    Even worse, it hides the cost of refactoring old things, so all of the sudden management gets this improvement (old code being refactored) all of the sudden obtained for free (since the cost in man/hours is hidden.) They will semi-rightly assume (given the faulty data) that these things are easy to do. Good luck trying to convince them otherwise. And it will not be their fault, but yours.

    There are implications on inflating your current tasks so as to do other tasks that are under the radar, implications that can work against you and your team.

    What you can do is provide a root-cause analysis, linking code that needs refactoring to code that you need to implement, the "new" stuff. If you can prove that refactoring the old stuff your new stuff depends on will be beneficial to your new stuff (and perhaps other things on your pipeline), then you can track the refactoring of old stuff, you can make management aware of it and they can allocate time for it.

    Obviously, it depends on the type of management, but that's the part you cannot control. What you can control is the work you do and how you present that work to them, independently of whether they go for it or not. You have to think less in terms of coding, and more in terms of software engineering and process/resource management.

    ObiWayneKenobi:
    or develop a proof of concept to demonstrate how some things can be done better than they are currently?

    That could be a better thing to do, but you understand that you'll have to do it on your own time, not on the clock and certainly not to the detriment of your current tasks.

    I think that's the best thing to do in such situations. You use it also as a way to train yourself, to better understand those systems that need refactoring, to understand new technologies and ultimately to remain (and be more) employable, marketable.

    Even if management still doesn't go for it, the knowledge you get from it, it stays with you, and that's gold.

  • (cs)

    Obligatory xkcd reference to good code: http://xkcd.com/844/

  • (cs)

    This is not always a WTF. In particular, if the database was something like MySQL with the default backend, which implements only table-level locking, then a query which takes one minute to perform is a serious no-no, as it will cause all other queries to also grind to a halt for one minute. Thankfully, even MySQL has changed since the 90s and has provided backends which do not do this (although you still can, if you like).

    Sometimes, a procedure which takes 8 hours is better than a procedure which takes 1 minute, especially if the latter causes all other operations to grind to a halt.

    So I'd say either the original programmer was trained on MySQL and did not realize the advantages of a more mature database, or the original application was on MySQL, and the programmer was smart enough to avoid taking down the system for a management report (and the database was later upgraded without fixing the reports).

  • ÃÃ (unregistered) in reply to Nagesh Kukunoor
    Nagesh Kukunoor:
    Nagesh:
    Swedish tard:
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

    स्तन

    That translate to "boob" in english.

    Imposter has proven nothing but his ability to use Google Translate.
    ƒÆ’†â€â„Â

  • RickD (unregistered) in reply to Clumsy Kid

    Lol! I once worked on a program where the developers would not guarantee the results were accurate, only that the results would be the same as the previous versions gave.

  • RickD (unregistered) in reply to Clumsy Kid
    Clumsy Kid:
    Aether:
    That was only after several demonstrations showing that the output was, in fact, correct, because if it's running that fast, how can it actually be doing it right?

    What management would not want proper testing to show them that the end result is still the same?

    Lol! I once worked on a program where the developers would not guarantee the results were accurate, only that they were the same results as you got from previous versions.

    (better with the original post for context, eh?)

  • qbolec (unregistered) in reply to ÃÃ
    ÃÃ:
    Nagesh Kukunoor:
    Nagesh:
    Swedish tard:
    ÃÆâ€â„Â:
    The one:
    hoodaticus:
    The Real Nagesh Kukunoor:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    Nagesh Kukunoor:
    Nagesh:
    I registered now. Ha ha
    Why do you register my name? I see you try to impersonate me but for what reason do you do this?

    तुम खुद को ज्यादा शहाणा समाज रहेला है क्या?

    खुददा?? शहाणा, तुम खुद को ज्यादा शहाणा! रहेला है क्यासतुम खुद को ज्यादा शहाणा समाज रहेला है. क्याज रहेला है क्या? खुद दा शहा!!!!!!

    That made no sense at all! You fail.

    It made no sense because you cannot read Hindi. So my point is proven, you are imposter.

    Hai guys! What are you doing? Quit fighting over my name!

    Troll Wars!

    Sigh... another group of people trying to impersonate my greatness. And for the record, I don't speak Hindu at all, just another myth from the rumour from the gossip mill.

    Sigh... I am the one and only Nagesh Kukunoor. This is just how you anglicize my name. My language is so unique its encoding only exists on my computer, hence the mangled characters.

    स्तन

    That translate to "boob" in english.

    Imposter has proven nothing but his ability to use Google Translate.
    ƒÆ’†â€â„Â
    14 levels!

  • Dirk (unregistered)

    What? He couldn't get a select with a few joins to sub-second? Fire him!

  • David Wright (unregistered)

    If you have 14 nested foreach's, that's not 14 layers, it's 14 dimensions.

    WTF? String theory can explain the whole universe with 11 dimensions. Who needs 14?

  • Anonymous (unregistered) in reply to David Wright
    David Wright:
    If you have 14 nested foreach's, that's not 14 layers, it's 14 dimensions.

    WTF? String theory can explain the whole universe with 11 dimensions. Who needs 14?

    String Theorist: "The world consists of 11 dimensions!"

    Real Scientist: "Please just run the hoover round and be on your way Pablo, I don't have time for your flights of fancy today."

  • Luiz Felipe (unregistered) in reply to Anonymous

    No, its all ilusion of the projection of event horizon of a massive black hole in the center of universe. the universe has only 2 dimensions. everyting else is fake.

  • Luiz Felipe (unregistered)

    ps: the reality (tm) is a mere hologram.

Leave a comment on “14 Layers Deep”

Log In or post as a guest

Replying to comment #:

« Return to Article