Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Coding Horror

Options
1212224262737

Comments

  • Registered Users Posts: 3,945 ✭✭✭Anima


    It's C++ but anyway, it's a joke!


  • Registered Users Posts: 3,337 ✭✭✭Wombatman


    3363_0919_650.jpeg


  • Registered Users Posts: 4,758 ✭✭✭cython


    Came across the below in an internal test framework:
        	final String doSomethingOneWay = ContextUtils.getDoSomethingOneWayFromFrameworkProperty(executionContext);
        	long s = System.currentTimeMillis();
    
            setUpStuff(doSomethingOneWay);
           [B] if (!(StringUtils.isNotBlank(doSomethingOneWay) && doSomethingOneWay.equalsIgnoreCase("true"))) {[/B]
            	// Do some stuff that's equally badly written in using the string as a boolean again
                }
    
    And the same guy wrote the method returning the string, below (so there's no excuse of "but I had to work with what the code gave me"):
    public static String getDoSomethingOneWayFromFrameworkProperty(final ExecutionContext context){
        	Properties properties = context.getProject().getProperties();
            final String doSomethingOneWay = FrameworkPropertyUtil.loadOverridableProperty(
        			DO_SOMETHING_ONE_WAY, properties);
            return doSomethingOneWay;
        }
    


    Why in the name the Flying Spaghetti Monster does someone use a String in a situation that's crying out for a boolean?! Even if the odd piece of crap code is expecting a string in, this is a boolean property, representing it as a string makes no sense whatsoever :mad::eek::confused: The mind f*cking boggles.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,800 Mod ✭✭✭✭Capt'n Midnight


    4785_e0a7_500.jpeg


  • Registered Users Posts: 27,073 ✭✭✭✭GreeBo


    cython wrote: »
    Came across the below in an internal test framework:
        	final String doSomethingOneWay = ContextUtils.getDoSomethingOneWayFromFrameworkProperty(executionContext);
        	long s = System.currentTimeMillis();
    
            setUpStuff(doSomethingOneWay);
           [B] if (!(StringUtils.isNotBlank(doSomethingOneWay) && doSomethingOneWay.equalsIgnoreCase("true"))) {[/B]
            	// Do some stuff that's equally badly written in using the string as a boolean again
                }
    
    And the same guy wrote the method returning the string, below (so there's no excuse of "but I had to work with what the code gave me"):
    public static String getDoSomethingOneWayFromFrameworkProperty(final ExecutionContext context){
        	Properties properties = context.getProject().getProperties();
            final String doSomethingOneWay = FrameworkPropertyUtil.loadOverridableProperty(
        			DO_SOMETHING_ONE_WAY, properties);
            return doSomethingOneWay;
        }
    


    Why in the name the Flying Spaghetti Monster does someone use a String in a situation that's crying out for a boolean?! Even if the odd piece of crap code is expecting a string in, this is a boolean property, representing it as a string makes no sense whatsoever :mad::eek::confused: The mind f*cking boggles.

    Is there a doSomethingAnotherWay or the like?

    Seems like either a boolean or an enum was the way to go alright...


  • Advertisement
  • Registered Users Posts: 4,758 ✭✭✭cython


    GreeBo wrote: »
    Is there a doSomethingAnotherWay or the like?

    Seems like either a boolean or an enum was the way to go alright...

    Nope. This was literally a toggle introduced to facilitate the legacy way of doing things (extensive mocking in a local JVM), or whether to use RMI against a remote JVM to actually test the code in a representative (of the client environment) application server, so there isn't a third option/scenario, and I can't foresee there being one any time soon either.

    On the plus side once I highlighted the complete lack of a code review for these changes across approx 100 files, and how this likely contributed to the above poor "design", I was pleasantly surprised that it actually ended up on the individual's (I hesitate to call them a developer in light of the above, even if that is technically their job title) list to fix, and has since been done.


  • Registered Users Posts: 3,337 ✭✭✭Wombatman


    PeryFXB.jpg


  • Posts: 0 [Deleted User]


    I don't get the MongoDB reference


  • Registered Users Posts: 3,945 ✭✭✭Anima


    I think it's a bit of a meme.

    https://www.youtube.com/watch?v=b2F-DItXtZs


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    Anima wrote: »
    I think it's a bit of a meme.

    https://www.youtube.com/watch?v=b2F-DItXtZs

    Brilliant. I hadnt seen that before.


  • Advertisement
  • Registered Users Posts: 3,337 ✭✭✭Wombatman


    W2QudRY.jpg


  • Registered Users Posts: 1,717 ✭✭✭Raging_Ninja


    Lol no way that would stand up in any court since nobody was trying to buy or sell anything


  • Registered Users Posts: 14,715 ✭✭✭✭Earthhorse


    It's gotta be a joke.


  • Registered Users Posts: 6,236 ✭✭✭Idleater


    Earthhorse wrote: »
    It's gotta be a joke.

    Years (God, quite a few now that I think of it) I applied for my own job (junior roles, my second job iirc) because it said "Salary Negotiable" on the spec. I was working via a third party placement service.

    Got the usual PFO letter, which I responded to saying thankfully at least I had a job and stated that job. They asked why I had applied, and though I gave the above reason, they declined to negotiate or evaluate my salary.

    I moved on to a role elsewhere and the job was off-shored about two months later again.


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    That letter is hilarious.
    I cant imagine anyone could be forced to pay for their interviewers time.

    Id love to know what the recipients response was.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,800 Mod ✭✭✭✭Capt'n Midnight


    That letter is hilarious.
    I cant imagine anyone could be forced to pay for their interviewers time.

    Id love to know what the recipients response was.

    "We refer you to the reply given in the case of Arkell v. Pressdram."


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows




  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    3 layers of legacy code -> PM:"lets build our new app on top of it"


  • Registered Users Posts: 3,337 ✭✭✭Wombatman


    9464_0601_615.jpeg


  • Registered Users Posts: 1,559 ✭✭✭Dante


    A pretty simple yet amusing one I came across a few weeks back. I was recently brought in to help refactor some pretty horrific legacy code in one of my company's systems. After setting up a Jenkins build I soon noticed that some of the tests seemed to be randomly failing despite having not touched the underlying classes.

    A quick bit of investigation led me to this beauty of a test:
    @Test
    public void check_expired_time_limit() {
    	LocalDateTime currentDateTime = LocalDateTime.now();
    	int hour = currentDateTime.getHour();
    	boolean expired = uut.isExpired(hour);
    	assertTrue(expired);
    }
    

    As if using the current time in a unit test wasn't alarming enough, I then looked into the isExpired method of the class being tested to find that it was actually testing the current time against a hard-coded integer value.
    public static final int EXPIRY_HOUR = 16;
    ...
    public boolean isExpired(int hour) {
    	return hour < EXPIRY_HOUR;
    }
    

    Meaning that if the tests were run after 4pm the entire build would fail. Like seriously, wtf?


  • Advertisement
  • Registered Users Posts: 27,073 ✭✭✭✭GreeBo


    __Lily__ wrote: »
    Hi Guys,

    Just letting you know that Fitbit are hosting a developers night next week, for those of you that may be interested in creating new apps! There will be free food, drink and an opportunity to win a new Fitbit. If you're interested, come along! :)
    You can read more about it on Meetup or message me for information on location.

    FitBit, we want your Coding Horrors!

    :P


  • Registered Users Posts: 2,320 ✭✭✭Q_Ball


    GreeBo wrote: »
    FitBit, we want your Coding Horrors!

    :P

    They got rid of most when they bought pebble! :pac:


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,800 Mod ✭✭✭✭Capt'n Midnight


    1811_1b78_420.png


  • Registered Users Posts: 1,461 ✭✭✭Anesthetize


    Came across this gem in some Arquillian tests belonging to a code repository my team are taking over.
    @Test
    public void someTestWhichTestsSomeThing() {
        /*
        All lines of test code commented out
        */
    }
    
    And as a result the test always shows up green in the test reports :)

    Looking back through the Git history, it looks the code inside the test was commented out just because it had started failing due to a change introduced somewhere!


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    Came across this gem in some Arquillian tests belonging to a code repository my team are taking over.
    @Test
    public void someTestWhichTestsSomeThing() {
        /*
        All lines of test code commented out
        */
    }
    
    And as a result the test always shows up green in the test reports :)

    Looking back through the Git history, it looks the code inside the test was commented out just because it had started failing due to a change introduced somewhere!

    Thats one way to fix a failing test!!


  • Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,054 Mod ✭✭✭✭AlmightyCushion


    Came across this gem in some Arquillian tests belonging to a code repository my team are taking over.
    @Test
    public void someTestWhichTestsSomeThing() {
        /*
        All lines of test code commented out
        */
    }
    
    And as a result the test always shows up green in the test reports :)

    Looking back through the Git history, it looks the code inside the test was commented out just because it had started failing due to a change introduced somewhere!

    I'd bet money it was commented out "temporarily" until someone had time to come back and fix it.


  • Registered Users Posts: 46 Rologyro


    I find this thread sort of depressing. In what other industry would you find a boards thread dedicated to making fun of other peoples mistakes?

    I'm a software developer three years out of college and I will put my hand up and say I have written bad code. On the other hand I love what I do and improve all the time. The one thing that discourages me from working in this area is some of the people...

    I find the industry to be full of arrogant willy-wavers who get a kick out of pointing out other people's lack of knowledge or mistakes. The same people who are actually impossible to work with because they loathe admitting their own mistakes.

    Well, when new grads come in looking to improve, you know what I'm going to do? Help and encourage them (revolutionary I know).


  • Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,054 Mod ✭✭✭✭AlmightyCushion


    Rologyro wrote: »
    I find this thread sort of depressing. In what other industry would you find a boards thread dedicated to making fun of other peoples mistakes?

    I'm a software developer three years out of college and I will put my hand up and say I have written bad code. On the other hand I love what I do and improve all the time. The one thing that discourages me from working in this area is some of the people...

    I find the industry to be full of arrogant willy-wavers who get a kick out of pointing out other people's lack of knowledge or mistakes. The same people who are actually impossible to work with because they loathe admitting their own mistakes.

    Well, when new grads come in looking to improve, you know what I'm going to do? Help and encourage them (revolutionary I know).

    I don't think there is a developer on this thread who hasn't looked at some old code they've written and tried to figure out what the hell they were thinking when they wrote it. In fact, some of the posts in this thread have been people posting old code they wrote themselves that was bad. The thread is just a bit of fun.

    There's nothing wrong with pointing out when someone has made a mistake, how are they meant to learn otherwise? How you point it out is another thing, however.

    Also, I'd like to point out, the same people on this thread would probably be the first to help you out if you started a thread about an issue you were having.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice



    Also, I'd like to point out, the same people on this thread would probably be the first to help you out if you started a thread about an issue you were having.

    This.

    I know I've written some cringeworthy drivel in my time.

    Having a snigger at some horrendous code != an unhelpful person / dick in general


  • Advertisement
  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Rologyro wrote: »
    I find this thread sort of depressing. In what other industry would you find a boards thread dedicated to making fun of other peoples mistakes?
    https://www.reddit.com/r/Justrolledintotheshop/

    All industries do it. It just so happens that the internet is the domain of software developers, so that's how horror stories are shared.

    Builders, plumbers, sparks, mechanics, designers, they will all share horror stories, pictures and videos about stuff they've done and encountered too.

    If you think this is a thread with experienced devs all pointing and laughing at new devs, then you've definitely gotten the wrong end of the stick.


Advertisement