The more things change...



  • So I just started a new job at a software company.  I found this lurking inside of a 5,000+ line class written in what looks like Procedural C#:

     goto IncludeCarrierStart;

     and in several other places inside of that method, as well.  

     A GOTO statement in 2011 (or I guess 2009 when the code was written), in C# 3.0, in a data processing class.  I guess whoever wrote the class didn't understand methods?

    And, of course, wanting to refactor this to be more efficient and maintainable would get shot down as wasting time.



  • See, that guy was on the right track.

    "[..] More than 10 years of industrial experience with Fortran have proved conclusively to everybody concerned that, in the real world, the goto is useful and necessary: its presence might cause some inconveniences in debugging, but it is a de facto standard and we must live with it. It will take more than the academic elucubrations of a purist to remove it from our languages. [..]"

    http://www.vf.utwente.nl/~neisser/public/reject.pdf



  • Ten years of Fortran?

    I'm surprised his S's don't look like F's.



  • @Juifeng said:

    See, that guy was on the right track.

    "[..] More than 10 years of industrial experience with Fortran have proved conclusively to everybody concerned that, in the real world, the goto is useful and necessary: its presence might cause some inconveniences in debugging, but it is a de facto standard and we must live with it. It will take more than the academic elucubrations of a purist to remove it from our languages. [..]"

    http://www.vf.utwente.nl/~neisser/public/reject.pdf

     

    My mom says that if I don't stop elucubrating I'll go blind and get hairy knuckles.



  • Are you sure this was written in 2009? Maybe its just a translation of an older Basic program...



  • There is nothing inherently wrong with the goto statement. Although there are often better or other ways to solve problems, in some situations it's still good to use. Without context, this is not a WTF. :)



  • Nope, it was written a few years ago.  The code, from what I've been told, has gone through about half a dozen developers - some outsourced, some inhouse, but nobody has ever been allowed to go back and fix these things and make things more compact.  There's no standards in the code (like naming conventions and stuff) and no real semblance of organization; most of the time code is stuffed into the code-behind of an ASPX page (I've seen quite a few with over 2000 lines) and just copied around where it's needed instead of consolidated and abstracted out into "Service" classes.

    The interesting thing is that there was no way to determine this in the interview short of demanding to view their setup and code, which would naturally be refused.  Everything else about the company seemed to be on the right track: Good computers, dual monitors, not-quite-cutting-edge-but-not-years-behind technology, use of version control (although their SVN looks like it was set up by someone who had no idea what they're doing and it's not organized at all), QA process... in short on paper it seemed much better than the environment is.

    I actually heard a rumour that the former IT Manager/Senior Developer was fired for repeatedly wanting to stop new development to go back and refactor all the cruft in the old stuff so it'd be maintainable; evidently the CIO disagreed and thinks refactoring and, god forbid, rewriting are wastes of time.  So the guys left now basically think that refactoring code should be ignored especially if it "takes too long" to do (which of course it does, since the cruft has built up through nobody caring to refactor even small things) and, of course, seem to have zero idea of design patterns or things of that nature.



  • @ObiWayneKenobi said:

    So the guys left now basically think that refactoring code should be ignored especially if it "takes too long" to do and, of course, seem to have zero idea of design patterns or things of that nature.
    I pity the kid that gets hired there as his first job. I pity even more the devs on his next job that will have to get all that crap out of his head.

    As for you... I'm pretty sure you can make napalm out of gasoline and styrofoam



  • Why not just refactor as you go? Increase your estimates by X hours and use that time for refactoring.

    Or do some refactoring after hours. It will most likely be worth it, even if you don't get paid.



  • Tell me about it. I feel dirty working with it.

    I needed the job. Ive had like six jobs in five years because I usually leave when I find the WTFs and realize nobody except me realizes they are WTFs. At least the commute here is nice. If I didnt care about quality and craftsmanship, I wouldnt care.

    Sadly, I do care about those things. Maybe thats the real WTF :)



  • @taylonr said:

    Why not just refactor as you go? Increase your estimates by X hours and use that time for refactoring.

    Or do some refactoring after hours. It will most likely be worth it, even if you don't get paid.

    Mainly because Ive only been here one week and its a monolithic codebase. Plus, naturally, there are no tests whatsoever so making changes is dangerous.



  • Ok, so start adding tests. Pitch it to the higher ups as ensuring code quality. It's far from ideal, but don't just sit on your hands and say "Well it sucks, guess that's it."



  • @ObiWayneKenobi said:

    I usually leave when I find the WTFs

    Serious advice: get out of existing/maintenance projects. They always contain suck, the only question is how much. And yes, part of the deal is that do not realize the WTFs (or they wouldn't have committed them)

    If that really ticks you off so much, find a job where you can build new things. They're much harder to find though. 



  • I dont mind so long as the team allocates time to refactoring and writing solid quality code. Everyone writes WTF code sometimes.

    I have a problem withg places that dont care about craftsmanship or quality, however, and sadly I see more and more software companies like that.


Log in to reply