• gnasher729 (unregistered)

    About the unit testing: It's absolutely fine to have lots of quite trivial unit tests. For example, if you just use a setter to store a 1 and the getter to verify that it is one, that wouldn't catch if the setter sets the wrong variable and by coincidence the variable is already set to the expected value. You can have lots of test for trivial cases, which will then find really stupid bugs that would otherwise go undetected until the software is in the hands of a customer.

  • (cs)

    M.C. as in "Escher", right?

  • Dave (unregistered)

    Most folks might agree that you don't need unit tests for one line functions but most folks would be wrong.

    The tests are there to prevent your code from regressing. What if someone changes the set not to set the value? What if someone changes the get to return a constant value?

    The getters and setters like this generally violate Tell Don't Ask.

  • Chris (unregistered)

    TRWTF about the RSA fob inventory is that they appear to have 13k+ people editing the same spreadsheet in the space of 1 week. If everyone works the same 40 hour week, then they have about 11 seconds each to lock the spreadsheet, make the change and unlock it again. I'm guessing there were a lot of people without access the next week.

  • merb (unregistered)
    public String []dayNames = { "Sunday", ..., "Saturday" };

    The real WTF is starting with Sunday?

  • (cs) in reply to merb
    merb:
    public String []dayNames = { "Sunday", ..., "Saturday" };
    The real WTF is starting with Sunday?

    http://www.timeanddate.com/calendar/days/ Ask no more.

    P.S. http://en.wikipedia.org/wiki/Sunday

  • (cs)

    That was the reason I left my position as an Architect after being promoted from a development position. My new boss (Senior Architect or something) didn't want us to get dirty with "coding", debugging, etc.

  • Jim Blog (unregistered)
    one-line functions such as get/set methods don't need unit tests as you'd only be testing the language's ability to set/retrieve the value of a variable.

    Can't agree with that; returning or assigning the wrong field from a get/set is a pretty common mistake, especially when there's a bunch of getters/setters in a class and they've been coded by copy-and-pasting from some template. It's always a good idea to test (a) your getters/setters are consistent, and (b) they don't corrupt the values of other properties on the object.

    That said, by-line code coverage statistics are a definate WTF, as they tell you almost nothing beyond giving you a nice number to feel warm & fuzzy about. As the article says, behavioural coverage is what actually matters.

  • nobulate (unregistered)

    Tl;DR

    CAPTCHA: walls of text give a paratus sensation.

  • Smug Unix User (unregistered)

    The real WTF is not using Google Docs for keeping RSA keys amirite?

  • MrFox (unregistered)

    Sadly they often don't work. Instead use commen sense and code reviews. Parts of my company have recently started developing software for government. The work method there is that we discuss software wishes with hundreds of government employees but develop software ourselves with their considerations in mind. In the end the governments will hopefully buy our software.

  • Meep (unregistered)

    "We can all agree that unit tests, implemented properly and kept up to date, can provide a safety net against mistakes. Most folks will agree that one-line functions such as get/set methods don't need unit tests as you'd only be testing the language's ability to set/retrieve the value of a variable."

    No, unit tests are not a "safety net against mistakes." They're there to make refactoring reliable: you make a structural change, see what tests break, and fix all breakage, then refactoring is complete.

    Since getters and setters are obvious targets for refactoring, they should have unit tests. The fact that the unit tests are easy to write doesn't make them less important.

  • (cs)

    At least they keep those guidelines safe from the rest of us.

  • Meep (unregistered)

    And regarding the example, the reason they're called "unit" tests is because they test a specific unit of functionality. In this case, unless the setter is supposed to do something special for 0 or -1 or INT_MAX, there's no need to test any particular value. Testing whether different values cause anomalous behavior is fuzz testing, which is a different kind of test, and usually performed on IO, or process parameters.

  • Chaarmann (unregistered)

    I learned by painful experience that storing constants in a single common place ("island of data") is better than having them defined in each of many different classes in many programs. If you exchange data and one class has defined {Sunday, monday,...}, another {monday, tuesday, ..} then when transmitting the corresponding integer values (0,1 etc.) between services, a Sunday suddenly becomes a Monday. If you submit strings, then there may be no match (lowercase and uppercase in the case above) because two things mean the same or spelling mistakes. E.G "Christmas" and "Xmas", "grey" and "gray", "seperate" and "separate" etc. Also storing these values in the database makes correction of them (or translation in a different language) easy and can be done immediately with a single SQL statement; no need to change any code and deploy it everywhere and having downtime etc. You are just more flexible. Imagine you sell paint and you run out of yellow. Then you just delete the corresponding record from the table of available colors instead of changing hundreds of classes!

  • srsly (unregistered)

    Sorry, but I've got a quick note from the PC police.

    "SheMale" is a word that exists mostly in pornography. There are people who either transition from male to female or vice versa, and referring to them by what porn refers to them as would be like referring to an Asian woman colleague as... well... you don't need me to expand on that. For the most part, the people others might call "SheMale" or "Tranny" find those words dismissive and offensive. The people themselves will generally refer to themselves as a trans person, as in trans woman, trans man or transgendered.

    I get that you were trying to make a joke, and that thedailywtf is a comedy site, but that word in particular is better suited towards Howard Stern than DailyWTF. Besides, in these days we're coming to understand that gender is often not as simple as "baby blue boy" or "princess pink girl", and joking that gender is as inflexible as the days of the week is pretty stuck in the mud. On that same note, getting corporate types to even include an "other" field for gender is often a struggle in and of itself, so every little bit of support helps.

    Could you update the story to at least not include the word SheMale?

  • the beholder (unregistered) in reply to srsly
    srsly:
    Sorry, but I've got a quick note from the PC police.
    No, you're not sorry. You're just trying to be an ass. The article didn't apply any meaning good or bad to the word SheMale; you did.
  • YAWTF (unregistered)

    Arithmetic WTF: If 13,000 users (the minimum specified in the story) were to line up in perfectly orderly queue to access the spreadsheet at the end of the story, and required only 60 seconds to download, open, update the spreadsheet (including finding their own row and saving the file), and upload the spreadsheet... it would take 780,000 seconds, or more than nine days... assuming the process continued throughout every available second of every 24-hour day, rather than just the work day. And they only had "one week" to do it.

    Apparently, security-mindedness includes the willingness to claw your way to the mandatory shared resource over the broken corpses of your rivals (once referred to as "co-workers") in order to finish this vital administrative task.

    Darwinian reduction-of-force: anyone too weak to complete the task in the alloted seven days deserves to die. Or at least be fired for being unable to do their jobs.

    CAPTCHA: "ratis". It's a ratis race. And only the ratises are winning.

  • (cs)

    With the correct setup, it might be possible to collaboratively edit a spreadsheet. Might.

    And about the getters, you are clearly doing it wrong if your code does nothing but setting and getting a property. Just expose the real property already. Good languages allow you to access getters and setters as if they were properties in case you change your mind later.

  • (cs)

    Government will have twelve levels of security to allow an employee access to an unprivileged workstation, but run untested code full of exploits on a web site that millions of people are required by law to access.

  • srsly (unregistered) in reply to the beholder

    I don't feel like I was being aggressive here, and I tried to be as little demanding as possible.

    Regardless, the word shemale does have meaning outside the article. The article might not have meant it badly, but that means that the article shouldn't have included the word, not that the word is okay just because the author didn't mean it to be harmful.

  • (cs) in reply to srsly
    srsly:
    Besides, in these days we're coming to understand that gender is often not as simple as "baby blue boy" or "princess pink girl", and joking that gender is as inflexible as the days of the week is pretty stuck in the mud.
    Yeah... you see, biology is a science, so no, you don't get to decide you're a girl because you like pink.
  • sighmericans (unregistered) in reply to ShachMaT

    P.S. americans and their measurement units as well as formats are dumb.

  • (cs) in reply to srsly
    srsly:
    I don't feel like I was being aggressive here, and I tried to be as little demanding as possible.

    Regardless, the word shemale does have meaning outside the article. The article might not have meant it badly, but that means that the article shouldn't have included the word, not that the word is okay just because the author didn't mean it to be harmful.

    I propose that all databases remove "sex" or "gender" and simply include a field for sex chromosomes.

  • srsly (unregistered) in reply to operagost
    operagost:
    srsly:
    Besides, in these days we're coming to understand that gender is often not as simple as "baby blue boy" or "princess pink girl", and joking that gender is as inflexible as the days of the week is pretty stuck in the mud.
    Yeah... you see, biology is a science, so no, you don't get to decide you're a girl because you like pink.

    Right. And biologists know that physical gender is set as a function of how much testosterone a fetus receives in the early stages of pregnancy. That testosterone can be distributed unevenly - an XY fetus can have unusually little, an XX fetus can have unusually much, the hormone can come early or late, and that's not to mention fetuses with unusual chromosomes, XXY, XXX, etc. Since the process is highly fluid, a minority of people aren't simply male or female.

  • Richard (unregistered)

    Architects generally know pretty much everything there is to know about how a given system works, what makes it tick, it's capabilities, limits, and the data and messages that it passes around.

    A big exception to the rule is when the architect has been brought in to work on an existing system and hasn't had time to learn its ins and outs, or possibly that much about it. I tend to do a lot of secondment work with different teams in different companies owned by the Big Umbrella Company, so except in situations where I am there from the start of the project I get into this situation quite a bit. Of 6 recent projects, I've been there from the start of two.

  • A Guy (unregistered) in reply to srsly
    srsly:
    [snip self important PC-Lawyer]
    So by your reasoning 'SheMale' is a rather good example for an erroneous value?
  • (cs)

    Oh right, more gender discussion from people who don't know what they're talking about and don't see the difference between sex and gender.

    And for those who think that gender is a fixed data type that never ever changes, look at the latest Facebook updates. ;)

  • Charles F. (unregistered)

    It sounds like the architect was pretty reasonable. You want to specify data flows, interconnects and key relationships. You don't want to do the implementers' jobs for them. Let them develop it they way they need to and review it to make sure that they didn't do something that undermines the architecture.

    TRWTF is M.C.:

    M. C. had written a detailed design document
    Waterfall! Awesome! That never fails to produce a quality product!

    (A lot of the other stuff was pretty much BS)

  • (cs)

    Hey... my cousin works at ██████.gov/corpname, say hi to him for me!

  • Gary B (unregistered) in reply to srsly

    To Srsly, This is not my area of expertise, but the only uses I've seen of shemale have been people (usually men) who have had themselves surgically and hormonally altered to have both sets of 'tools' - i.e. not transgenders. Not that there's anything wrong with that, etc. ...

    Of course this doesn't detract from your point, just adds that little bit of weirdness we need on the interwebs.

  • (cs)

    Let me tell you of government story in India. There is a big corporation run totally by Government. one day they invite bid to build a pylon towers. 15 contractors bid for the job. 3 are called into private mtg room. They are told there is no tower that is actually going to be built. We will pass tenders and we can split the fortune (tax payer money) among some officers of the corporation and the contractors. 3 months later there is another invite for a bid to demolish the tower. These kind of inefficacies exist because of human nature. Human nature has no solution in the long run. In the short run, humans can be trained, but in longer period they will revert to their basic nature.

  • (cs) in reply to RichP
    RichP:
    Hey... my cousin works at ██████.gov/corpname, say hi to him for me!
    $ whois xn--4zhaaaaa.gov
    % DOTGOV WHOIS Server ready
    No match for "XN--4ZHAAAAA.GOV".
    

    Last update of whois database: 2014-03-20T14:20:48Z <<< Please be advised that this whois server only contains information pertaining to the .GOV domain. For information for other domains please use the whois server at RS.INTERNIC.NET.

  • (cs) in reply to srsly
    srsly:
    Could you update the story to at least not include the word SheMale?

    Reasonable request. Changed to Octember.

  • (cs) in reply to operagost
    operagost:
    I propose that all databases remove "sex" or "gender" and simply include a field for sex chromosomes.
    So… that would be a BLOB column?
  • (cs) in reply to Mark Bowytz
    Mark Bowytz:
    srsly:
    Could you update the story to at least not include the word SheMale?

    Reasonable request. Changed to Octember.

    Octember is a perfectly cromulent word.

  • anonymous (unregistered) in reply to DCRoss
    DCRoss:
    Mark Bowytz:
    srsly:
    Could you update the story to at least not include the word SheMale?

    Reasonable request. Changed to Octember.

    Octember is a perfectly cromulent word.

    But a perfectly delicious number.
  • ANON (unregistered) in reply to Chaarmann
    Chaarmann:
    Also storing these values in the database makes correction of them (or translation in a different language) easy and can be done immediately with a single SQL statement; no need to change any code and deploy it everywhere and having downtime etc.

    What you're talking about is true for string constants, but it's about enums, they only exist in the source code like variable names.

  • ANON (unregistered)

    Great article btw.

    I really enjoyed it.

  • CigarDoug (unregistered) in reply to operagost
    operagost:
    srsly:
    Besides, in these days we're coming to understand that gender is often not as simple as "baby blue boy" or "princess pink girl", and joking that gender is as inflexible as the days of the week is pretty stuck in the mud.
    Yeah... you see, biology is a science, so no, you don't get to decide you're a girl because you like pink.
    Sex is binary. When your dead body is lying on a slab in the morgue, the medical examiner will determine your sex from your physical characteristics.

    Everything else is behavior.

  • anonymous (unregistered) in reply to CigarDoug
    CigarDoug:
    Sex is binary. When your dead body is lying on a slab in the morgue, the medical examiner will determine your sex from your physical characteristics.
    By then it won't matter any more!
  • (cs)

    For a moment, forget that people write functions with side affects.

    The expression is side effects.

  • Chelloveck (unregistered) in reply to Mark Bowytz
    Mark Bowytz:
    srsly:
    Could you update the story to at least not include the word SheMale?

    Reasonable request. Changed to Octember.

    Sorry, have to send out the PC Police again.

    "Octember" is a word that exists mostly in pornography; namely the hentai variety featuring men or other creatures with eight male members. There are people self-identify as multi-phallused and who may have surgery to give themselves multiple penises. Referring to them by what porn refers to them as would be like referring to an Australian male colleague as... well... you don't need me to expand on that.

  • my name (unregistered) in reply to dkf
    dkf:
    operagost:
    I propose that all databases remove "sex" or "gender" and simply include a field for sex chromosomes.
    So… that would be a BLOB column?
    So then we'd have to insert a blob of chromosomes? Won't that possibly spawn a child process? :P
  • C-Derb (unregistered) in reply to Chelloveck
    Chelloveck:
    Mark Bowytz:
    srsly:
    Could you update the story to at least not include the word SheMale?

    Reasonable request. Changed to Octember.

    Sorry, have to send out the PC Police again.

    "Octember" is a word that exists mostly in pornography; namely the hentai variety featuring men or other creatures with eight male members. There are people self-identify as multi-phallused and who may have surgery to give themselves multiple penises. Referring to them by what porn refers to them as would be like referring to an Australian male colleague as... well... you don't need me to expand on that.

    ^ This made me laugh. Well done.

  • (cs) in reply to C-Derb

    Please show some sensitivity.

    I had a son who suffered from octember, and let me assure you it was no laughing matter.

    (Had to do it...could not resist... please forgive me)

  • Duke of New York (unregistered)

    So basically M.C. is faulting this company because

    • they have a security setup that is probably mandated by law
    • the architect does his own job as an architect, and not M.C.'s job as a dev
    • other people don't jump at his every whim about the way things should be done and the way decisions should be made in a company that has commitments decades into the future.

    Hopefully he's found a job at a stealth startup, where his randomness won't cause as much trouble.

  • Developer (unregistered) in reply to Jim Blog

    One could write a generic unit test using reflection to grab a setter method, check the name-matching member variable and also the getter method. One could also extend this generic unit test to be fed by a list of object classes to go through and check test all automatically. Without Writing Stupid Unit Test Coverage Code Over And Over Again.

    Or.. some stupid could waste hours writing stupid unit tests

  • Chris Angelico (unregistered) in reply to Developer
    Developer:
    One could write a generic unit test using reflection to grab a setter method, check the name-matching member variable and also the getter method. One could also extend this generic unit test to be fed by a list of object classes to go through and check test all automatically. Without Writing Stupid Unit Test Coverage Code Over And Over Again.

    Or.. some stupid could waste hours writing stupid unit tests

    Better solution: Use a language that doesn't require you to write getters and setters. Python lets you happily "reach in" and manipulate members with direct assignment, and if you ever need to change things around (that's the whole point of getX() and setX(), after all - you can change them to not simply be direct getter and setter), you can create a @property that lets you write, effectively, the getter and setter. Of course, that's WAY too smart for bureaucracy.

  • Tux "Tuxedo" Penguin (unregistered)

    TRWTF are getters/setters. If outside class need to access internal variable of another class, just make it public. If you don't want field to be modified outside, just mark it as readonly. Most sane languages have methods for that. Getters/Setters were worst design choice made when creating Java.

    As big pain it causes me, C# being M$ product, it fixed most of Java's issues. .NET runtime (be it Mono or .NET from M$) is just faster and C# uses saner language constructs than Java does.

Leave a comment on “Government, Inc.”

Log In or post as a guest

Replying to comment #:

« Return to Article