• Mirko (unregistered)

    If this is C# how can this code even compile? Methods with a return type MUST return a value.

  • Rantanplan (unregistered)

    Hm... strange. The C# compiler would never accept such a method. All code paths must return a value if the method signature defines a return value for it. Did the submitter leave something out or did it get lost in editing it for the website?

  • (nodebb)

    This doesn't compile, in C# a value has to be returned explicitly from all paths. I guess this makes the code even worse? On the bright side, since it doesn't compile, it'll never run, and it'll never cause issues, so maybe it's the best code they have?

  • 516052 (unregistered)

    Worst of all he put the opening brace of a method on the same line as the method name. Disgusting. That is why we need certification, standards and a guild to drum such people out.

  • Stella (unregistered)

    "Maintenance" means "keep in the same way", not "fix anything". -- Sounds to me like it's a civil engineer maintaining bridges, not a programmer.

  • 516052 (unregistered) in reply to Stella

    Indeed. Unfortunately much like in civil engineering it's all too often for companies to rely on systems considered so critical that any change, even one for the better represents an unaceptable risk. In their minds it's better to only fix the mistakes of yesterday if and when they become a problem rather than risk introducing new ones. And of course, the down time and expense involved in changing and than properly testing the system are just unaceptably high.

    And as much as it pains me to say this they ain't wrong. As bad as that system is described to be can you imagine how much worse it could have been if each new generation of "maintenance" programmers had been given free reign to "fix" everything they dislike. After all who's to say that they know their job any better than the original guy that made it.

    It'd be like giving civil engineers free reign to do what ever work they need to make roads and bridges look "good" and up to what ever is in fashion this week.

    But that's why all other fields of engineering have certification and licencing to make sure that bridge gets put up right in the first place.

  • Brian (unregistered)

    This code is no problem at all. As others have pointed out, it won't even compile as-is, which means it's probably just sitting in some half-finished, forgotten file that was never part of the project in the first place but accidentally got committed to source control. The best thing Tammy could do to "maintain" it is "git rm" or the local equivalent.

    But speaking of teaching old dogs new tricks, one of my first jobs was working at a defense contractor where the majority of the devs spent all their time writing ADA. So when we got a new project, and it was decreed that it would use C (not C++, because OOP is scary) there was much fear and confusion all around. Imagine a fresh college graduate trying to explain pointers and pass-by-reference to industry veterans, and you've got a pretty good idea of how it went.

  • Duston (unregistered)

    At least the method isn't called PERFORM_HASDATACHANGED.

  • COBOL_VETERAN (unregistered) in reply to Duston

    Would have been HASDATACHANGED_SECTION.

  • my name is missing (unregistered)

    If it truly does not compile, why is it a WTF. Clearly it is not included, so how would it matter?

  • Chris (unregistered)

    So this method should be called AllowDataChange, not HasDataChanged. Like enabling and disabling a button. Of course, that's only one problem, but at least if they fix the name, it makes it easier to refactor the bigger problems, like using the static bools. Which of course won't happen, as explained.

  • Just another Embedded Designer (unregistered)

    Who says it is NOT included in the build, having seen many projects where people either IGNORE all warnings or change compiler flags so it compiles with only warnings or mask ALL types of errors. Even ones that link badly and link overlapping data areas.

    People dp this because the compiler must be wrong

  • DFYX (unregistered) in reply to Just another Embedded Designer

    The thing is, people are not talking about warnings here. Not returning anything from a method with a return type in C# is a compiler error. It won't compile, even when you disable all warnings. From the compiler's perspective it's just as bad as calling a method that doesn't exist or assigning a string to an int variable.

  • Tinkle (unregistered)

    Changing the Enabled property will raise the EnabledChanged event, so that is one possible source of exceptions. Ignoring them is still a bad idea though.

  • (nodebb) in reply to Chris

    The semantic of the function is "SetDataChanged" (method), not "HasDataChanged" (predicate).

    Just a bad name and return value, but the logic itself is surprisingly sane for what it's most likely supposed to be.

  • Jim Bednarek (unregistered)

    I'm a recovering COBOL programmer. When first moving to C# I did stuff like this.

    Took some patient instruction from experienced (but younger than me as almost everyone is younger than me) C# devs to use this new-fangled stuff correctly.

  • (nodebb) in reply to 516052

    Software isn't bridges, though.

  • (nodebb) in reply to Duston

    ... or is suffixed thus: HASDATACHANGED_2343 . The integer is this paragraph's (no "methods" in COBOL) order in the code listing so we can find the darn thing; an anachronism from the days of no interactive terminal editors. And, no, we don't change the name when physically rearranging

  • (nodebb) in reply to Brian

    Circa 1988, an intro course on ADA for the COBOL team. To a man (and women too), they were flummoxed by ideas like types, parameters, scope. Highly competent people but these concepts were sci-fi alien to COBOL. One thinks differently given different languages but disorganized thinking in any case results in mush. These conceptual guard rails do not stop the modern dimwit developer from pissing on the third rail.

  • Argle (unregistered) in reply to Just another Embedded Designer

    I worked on a project over 20 years ago done in C. The original programmers clearly didn't know how to fix their own warnings, so disabled all of them. I turned them back on and got slammed with thousands of warnings upon compile. There were hundreds of functions with no return statements and dozens of functions depending on the return value of those other functions. Happy ending: I wasn't asked to maintain the mess, but do a complete re-write.

  • Fizzlecist (unregistered) in reply to Mr. TA

    You're right. Bridges are designed. Most software is, well, ummm ...

  • CodeMonkey403 (unregistered) in reply to Fizzlecist

    I think "excreted" is the word you're looking for.

  • (nodebb) in reply to Fizzlecist

    Bridges can be designed. Software often can't. And even when a vendor ( MS) tries to invest into a language which makes it difficult to make mistakes (C#), some proponents of software certification among us argue against it on the grounds of "don't take away my powerful tools which let me do my job".

    ......

  • Jitendra Singh (unregistered)
    Comment held for moderation.
  • Best Vape Store In Uk (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to 516052

    free *rein

  • 516052 (unregistered) in reply to Mr. TA

    No, it's far more critical. When bridges fail all that happens is a handfull of corpses go splat. Software failure can literally bring down nations, cripple corporations, crash aircraft with hundreds of people on board, include predatory microtransactions, steal personal data and generally ruin far more lives than a bridge ever could.

    What's common for both is that the right way to make them is to give the people doing so powerful tools and make sure they are actually competent to use them. Not to let all sorts of incompetents play engineer and design the entire industry around holding their hand and playing whackamole with the new and inventive ways they find to screw up.

    You don’t ban concrete use in construction for fear of the architects eating the paste. You ban paste eaters from going into construction.

  • Beauty stoke (unregistered)

    Hi, Love your awesome blog Love what you are doing in your blog.... Just wanted to give you a head that you were featured in my new article on Beauty stoke. Here's the link: https://www.beautystoke.com/?m=1 I really hope it delivers some new visitors on your site.

  • Beauty stoke (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to 516052

    OK who decides what is and isn't paste eating? And what about countries who don't have this regulation?

  • 516052 (unregistered) in reply to Mr. TA
    Comment held for moderation.
  • ichbinkeinroboter (unregistered)

    I was a COBOL programmer and became a C# programmer (via VB). Never had any issue with OO (was doing it in VB, yes that was possible... anyone remember Deborah Kurata's great book?). Had no massive troubles going to nodeJs either - after I stopped being frustated trying to use ES5 classes as if they were C# classes and embraced the functional approach, that is! It isn't inevitable that people get stuck with "old ways", it just takes the right education - maybe these guys were just flung into other languages with different paradigms with no / bad / little training! That's probably the real WTF.

  • (nodebb) in reply to Brian

    "Imagine a fresh college graduate trying to explain pointers and pass-by-reference to industry veterans, and you've got a pretty good idea of how it went" - yes, they’d have been wondering what crazy management would want them to abandon a language where 90% of the time you don’t need pointers to implement pass-by-reference because the language lets you say how the parameter needs to be handled (is it just a value? if it’s a variable, can it be modified from its input value? or does it get overwritten?) and deals with any complication under the hood - and instead wants them to handle the complexity themselves, out front? (not to mention it being hard to overflow an array in Ada).

  • (nodebb) in reply to 516052

    "What's common for both is that the right way to make them is to give the people doing so powerful tools and make sure they are actually competent to use them." Powerful, yes; dangerous, not so much. And in this case, "not dangerous" means not using C or equivalent.

    Now, a powerful tool that generated C as a low-level implementation language for a formally provable specification language might be a different thing.

    So long as you’re sure yu’re actually building the right program.

    Addendum 2021-09-04 17:35: *you’re.

    (WTF does this site mean offering "edit" when all you can actually do is "add"?)

  • (nodebb) in reply to sjw

    It's a trap. You think you can just delete that ill-advised rant about your job, but no, you can't.

    Addendum 2021-09-06 15:22: Just a joke though.

    Addendum 2021-09-06 15:23: Though I am a bit surprised , that adding an addendum takes you back to the article while submitting a comment takes you to the comment list.

  • SyntaxError (unregistered) in reply to Mr. TA

    Obligatory analogy comparing software development to building a bridge: https://gizmodo.com/programming-sucks-why-a-job-in-coding-is-absolute-hell-1570227192

Leave a comment on “Maintaining Yourself”

Log In or post as a guest

Replying to comment #532248:

« Return to Article