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
1171820222337

Comments

  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    What goes around comes around ...

    On a new project, we're trying to optimise the build process and shoehorn it into a proper CI/CD approach. The traditional build process took about 6 hours, and one reason was the inappropriate list of dependencies in the make files. One of the guys pointed out that there was a dependency of one C file on another C file (not a header file) which surprised me. After a little investigation, I realised that it was a piece of wonderful workaround-code that I had written myself in a former existence 16 years ago!

    Hopefully I'm not as daft any more.


  • Banned (with Prison Access) Posts: 963 ✭✭✭Labarbapostiza


    bpmurray wrote: »
    One of the guys pointed out that there was a dependency of one C file on another C file (not a header file) which surprised me. After a little investigation, I realised that it was a piece of wonderful workaround-code that I had written myself in a former existence 16 years ago!

    Hopefully I'm not as daft any more.

    I don't see anything wrong with that or that it's bad practice. I think you need to compile the referenced C file, and then place the OBJ where the linker can see it.

    Are you suggesting writing everything in one monolithic C file is good practice, as opposed to splitting code over many C files?


  • Registered Users Posts: 1,275 ✭✭✭bpmurray


    I don't see anything wrong with that or that it's bad practice. I think you need to compile the referenced C file, and then place the OBJ where the linker can see it.

    Are you suggesting writing everything in one monolithic C file is good practice, as opposed to splitting code over many C files?
    No - having something in multiple C files is fine - for this particular subproject there were probably upwards of 100, with about that number of header files too. My point was that having an "#include <file.c>" is, frankly, bizarre - at the very least, it should have been an "#include <file.h>"


  • Registered Users Posts: 428 ✭✭[Rasta]


    This was the best piece of code that I could find in a class I recently looked at.
    private static void UpdateNode(XmlNode theNode, string nodesNewValue)
    {
        theNode.InnerText = nodesNewValue;
    }
    


    I checked through version control and it has never been changed.

    :)


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


    [Rasta] wrote: »
    This was the best piece of code that I could find in a class I recently looked at.
    private static void UpdateNode(XmlNode theNode, string nodesNewValue)
    {
        theNode.InnerText = nodesNewValue;
    }
    


    I checked through version control and it has never been changed.

    :)
    Such magnificent naming conventions.


  • Advertisement
  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    I've been working on this right little... so-and-so of an issue since before Christmas. New scrum-master trying to impress others sends a wide email (I don't know if anybody wasn't CCed on it) this morning,
    Hi c_man,

    As we all know, you're behind on *issue*. I was thinking about this, have you considered asking on Stack Overflow?

    :rolleyes: Never thought of that... Oh and I was the one who happened to notice *issue* the day before they were all set to push this out to thousands of customers. But nah, yeah it's my fault.


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins


    c_man wrote: »
    I've been working on this right little... so-and-so of an issue since before Christmas. New scrum-master trying to impress others sends a wide email (I don't know if anybody wasn't CCed on it) this morning,

    :rolleyes: Never thought of that... Oh and I was the one who happened to notice *issue* the day before they were all set to push this out to thousands of customers. But nah, yeah it's my fault.

    Only one thing for a person like that.

    Jakes-Epic-Flying-Punch-To-The-Face-On-Adventure-Time-Gif.gif


  • Registered Users Posts: 880 ✭✭✭moycullen14


    c_man wrote: »
    I've been working on this right little... so-and-so of an issue since before Christmas. New scrum-master trying to impress others sends a wide email (I don't know if anybody wasn't CCed on it) this morning,



    :rolleyes: Never thought of that... Oh and I was the one who happened to notice *issue* the day before they were all set to push this out to thousands of customers. But nah, yeah it's my fault.

    I feel your pain. Every high profile issue seems to attract at least one 'Helen Lovejoy' to the email thread. Stating the bleeding obvious, non sequitors and contributing nothing.

    They seem to have an uncanny knack of rubbing salt in the wound. 'As we all know' - tosser.

    Me, I'd call him out on that email - In public. Why did you send it? What were you hoping to achieve? If you had any constructive ideas, why not sit down with me and go through them?

    You could try an troll him by replaying 'What is this Stack Overflow of which you speak?'

    The other approach is to whack him about the head with a keyboard (using the key side, naturally).


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    I thought about what to do (lots of similar approaches to the above) but I thought the best thing to do was just let it hang there, no reply. Not worth responding to.


  • Registered Users Posts: 13,104 ✭✭✭✭djpbarry


    You could try an troll him by replaying 'What is this Stack Overflow of which you speak?'
    Or better still, respond with:

    "I'm not sure Stack Overflow is a suitable forum to seek advice on dealing with a scrum master who's being a dick".


  • Advertisement
  • Moderators, Society & Culture Moderators Posts: 17,642 Mod ✭✭✭✭Graham


    djpbarry wrote: »
    Or better still, respond with:

    "I'm not sure Stack Overflow is a suitable forum to seek advice on dealing with a scrum master who's being a dick".

    http://workplace.stackexchange.com/questions/43068/how-to-handle-the-situation-where-the-scrum-master-is-not-supportive

    :D


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    Programmers will never be free until the last Product Owner is strangled with the entrails of the last Scrum Master.

    Or something like that :P


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


    In my opinion the best response would be, "Thanks for the suggestion, X. After the issue was raised I investigated it <however you investigated it>. This included looking for answers both on Stack Overflow and other online resources. Unfortunately we have moved beyond that now but I will keep you all posted on any progress made.

    Regards,
    c_man


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


    c_man wrote: »
    I've been working on this right little... so-and-so of an issue since before Christmas. New scrum-master trying to impress others sends a wide email (I don't know if anybody wasn't CCed on it) this morning,



    :rolleyes: Never thought of that... Oh and I was the one who happened to notice *issue* the day before they were all set to push this out to thousands of customers. But nah, yeah it's my fault.

    Or you could reply all and say "Hi ScrumMaster, I would like to have a private discussion regarding your suggestion".

    Fairly clear to everyone on the list what your going to say in this private chat.


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    Or you could reply all and say "Hi ScrumMaster, I would like to have a private discussion regarding your suggestion".

    Fairly clear to everyone on the list what your going to say in this private chat.

    Perhaps. I'm not good with confrontation and as I'm relatively new enough myself, I don't quite feel I could do that just yet. Don't get me wrong, in previous jobs I have done similar.

    Oh well, I fixed the issue and everyone's happy. Though tbh I don't like this job and don't see myself here in 6 months :(


    Edit: And he does seem to rubbing other engineers up the wrong way. Witnessed two arguments this morning over bloody minor things.


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    Opening a "manager" class, responsible for all manner of threading funkiness. Then I see this...

    #if defined WIN32
    ......
    #elif defined Linux
    //this is guess work! Have no Linux machine


    Repeated throughout the class.


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


    c_man wrote: »
    Opening a "manager" class, responsible for all manner of threading funkiness. Then I see this...

    #if defined WIN32
    ......
    #elif defined Linux
    //this is guess work! Have no Linux machine


    Repeated throughout the class.


    and if its a 64 bit?


  • Closed Accounts Posts: 4,436 ✭✭✭c_man


    and if its a 64 bit?

    It won't cause any problems, Win32 is merely an artifact of days gone by.

    From http://msdn.microsoft.com/en-us/library/b0084kay.aspx
    _WIN32
    Defined for applications for Win32 and Win64. Always defined.


  • Banned (with Prison Access) Posts: 963 ✭✭✭Labarbapostiza


    c_man wrote: »
    Opening a "manager" class, responsible for all manner of threading funkiness. Then I see this...

    #if defined WIN32
    ......
    #elif defined Linux
    //this is guess work! Have no Linux machine


    Repeated throughout the class.

    What kind of threading was it? Was it something like Posix , (portable Unix standard). The internal data types and native threading are different between Windows and Linux, and there are differences between the standard C data types and OS types. The handling doesn't always work perfectly, hacking a header file may be required....but that doesn't always work. I'd say the guy(or gal) found their code was crashing because something was switching it to the Linux types........and one fix is to cut and paste those defines from a header. The define as linux may not have been necessary, but the code may have been alternative using both types. Header file hacking can work too, but it can lead to a different kind of hell....code that works perfectly in the environment with the hacked headers, but nowhere else, unless you can figure out what's been hacked. (I get a terrible feeling nerds sometimes do this deliberately, to make building their code a frustrating adventure........I've come across this on Linux)

    Using WIN32 as a generic for all windows OS comes from a feature/bug Microsoft created themselves. Code compiled on Windows NT machines, would have WINNT in the exe's as OS type. This could lead to unpredictable behavior.....Windows NT machines could handle WIN32 as well as the WINNT switch.


  • Registered Users Posts: 1,712 ✭✭✭neil_hosey


    One of the "senior" guys in current place on me pushing for TDD..

    Oh yeah go ahead, but don't write too many unit tests because it will slow down the build..

    :mad:


  • Advertisement
  • Registered Users Posts: 1,463 ✭✭✭Anesthetize


    neil_hosey wrote: »
    One of the "senior" guys in current place on me pushing for TDD..

    Oh yeah go ahead, but don't write too many unit tests because it will slow down the build..

    :mad:
    There's "senior" guys where I work who just won't write unit tests full-stop.


  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    There are plenty of small to medium businesses where unit testing is not a reality - Even companies who's main line of business is software as opposed to those that just happen to have some internal software development.


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


    Another horror from StackOverflow:

    https://stackoverflow.com/questions/35634793/how-to-query-a-database-within-a-loop-in-c-sharp

    Some guy is running his SQL queries from embedded Razor in his MVC views. On phone so will post code later in case it is deleted.


  • Registered Users Posts: 13,080 ✭✭✭✭Maximus Alexander


    Good lord.


  • Registered Users Posts: 36,167 ✭✭✭✭ED E


    Another horror from StackOverflow:

    https://stackoverflow.com/questions/35634793/how-to-query-a-database-within-a-loop-in-c-sharp

    Some guy is running his SQL queries from embedded Razor in his MVC views. On phone so will post code later in case it is deleted.

    Twas
    Page Not Found
    This question was voluntarily removed by its author.

    Here are some similar questions that might be relevant:


    Here's a cached copy:

    Link


  • Registered Users Posts: 24,349 ✭✭✭✭lawred2


    Another horror from StackOverflow:

    https://stackoverflow.com/questions/35634793/how-to-query-a-database-within-a-loop-in-c-sharp

    Some guy is running his SQL queries from embedded Razor in his MVC views. On phone so will post code later in case it is deleted.

    Jesus H Christ


  • Registered Users Posts: 24,349 ✭✭✭✭lawred2


    [Rasta] wrote: »
    I'm in a 3 man development team and I asked the Senior Developer (SD) why we don't have any strategy for working on projects.
    SD says, something along the lines of:
    In the real world there is no time to plan projects, you just have to do stuff as you go along.

    The only way the SD tackles projects is by simply going to 1 meeting to get some specifications from the user and then cracking away writing code.

    And here's me wondering why there is no source control, no project plan, no documentation, no best practices, no software patterns used...
    The SD is adamant on writing everything in one class. If the SD sees more than 2-3 classes in a library you need to rewrite.


    We have an email group for error messages.
    I redirect those into a sub folder.
    It has about 7.5k emails after 6 months or so.
    When I questioned the SD about these, the SD said that i'll get used to seeing the ones that are actually bad errors

    I checked one of the server's event viewer.
    About 4k error entries in there.

    There is possibly new management rolling in, so I'm sure they'd spot and sort this madness.
    Gladly the other Developer is on the same page as me, so there seems to be a bit of hope.

    massive spoofer

    go somewhere else


  • Registered Users Posts: 24,349 ✭✭✭✭lawred2


    Had a look at some of our automated tests today and came across this test class which dozens of test methods like this:
    [TestMethod()]
    public void OpenTimeTest()
    {
        MyClass target = new MyClass();
        target.OpenTime = DateTime.Now;
        DateTime ActualTime = target.OpenTime;
        Assert.AreEqual(target.OpenTime, ActualTime);
    }
    

    The OpenTime is a field so no work is being done when it is set.

    I guess someone just wants to see lots of green ticks beside their automated tests.

    looks like an outcome from one of those 'we need to start unit testing our code' meetings


  • Registered Users Posts: 635 ✭✭✭MillField


    There's "senior" guys where I work who just won't write unit tests full-stop.

    I haven't documented a unit test case in months. :eek:


  • Advertisement
  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    El Reg has started running a regular article on a similar topic. From todays...
    I once found that an end-of-month report for our supply department had a value at the end of the document that had no meaning from a programming perspective. It used a table column that was long obsolete, and even though the data no longer meant anything, the program still reported the value.

    I removed the report entry, and explained to the supply manager the reasons for doing so. His response was, “I have always reported this figure to senior management, I must continue to do so.”

    All that was needed was a simple change to the code:
    Seed = today;
    ReportValue = random(Seed)*1000;
    
    Happy manager. Senior management none the wiser.


Advertisement