• Debra (unregistered)

    bool firstEnabled = true;

  • Pjrz (unregistered)

    a) How on earth does the client get source code and the right to incorporate his own code into it? b) How was his code not reviewed in any way before being incorporated?

  • JG (unregistered) in reply to Pjrz

    They are the client, and by definition right.

  • Bob (unregistered)

    a) Because they are the customer, they demand loudly and threaten to terminate the contract and management gives in and provides the source b) Because customers think they know best and demand to be able to make arbitrary changes which must be upstreamed into your codebase and they will not accept any feedback on their work.

  • Little Bobby Tables (unregistered) in reply to Pjrz

    Who cares as long as the customer pays? Shaneka's in a job for life.

  • TH (unregistered)

    How does this code have dependencies that rely on its bad behaviour? Its only side effect is to irreversibly switch the display off (if passed false). How do swathes of code rely on a behaviour which prevents the display being switched on?!

  • Vault_Dweller (unregistered) in reply to TH

    Because someone didn't trust the method to do it's job the first time and called the method multiple times in succession to ensure the screen was really switched off?

  • TheCPUWizard (unregistered)

    " instead updated the documentation for this method and wrote a new method which behaved correctly." - Which it the proper thing to do when one follows (as one should) the OCP [Open Closed Principle] from SOLID.

  • Roburius (unregistered) in reply to Vault_Dweller

    Or various places are calling it with either true or false, but expecting it to turn off the display regardless?

  • (nodebb) in reply to TH

    Because the anonymisation process changed the side effect.

  • Reginald P. Linux (unregistered) in reply to TheCPUWizard

    No, you interpret it wrong.

  • Zenith (unregistered) in reply to Bob

    Client must not have been government. Typically when the vendor barks "JUMP!" we meekly ask "how high, sir?"

  • gleemonk (unregistered)

    To answer the question of how the client gets the source: By asking for it in the contract. One doesn't sign a contract that doesn't ensure source with all deliverables.

  • Little Bobby Tables (unregistered) in reply to gleemonk

    I worked on one project where the contract called for a field software engineer to perform any updates as required, but omitted to include in that contract any actual source code for the client to actually get any of those changes dbne by said field software engineer. As that very FSE, I had 2 years on a very lucrative contract where the most technical thing I needed to actually do was reinstall it.

  • Smash (unregistered) in reply to Zenith

    Sir, I see you are a government-employed witness of many WTFs. I can totally relate.

    To those wondering how Zenith's statement could possibly be true when it is usually the customer who "is always right", take into account that

    a) That vendor got a government contract, and b) The reason they won the bid was because they are best buddies with someone who happened to be elected/appointed recently.

    So if you're a reasonable employee who don't want WTFs to creep in, too bad. You can't put your foot down because they have clout far above your pay grade.

  • DrPepper (unregistered)

    The "displayEnabled" is a global; so it is possible that some other code somewhere else is triggered to look at this value and turn the state of the display on or off. There might be another thread that "warms up" the display when it sees the value of displayEnabled is changed. We simply don't know. It looks to me like -- if you want the display turned off, turn it off right now; but if you want it turned on, just set the flag and wait for some other thread to turn it on.

    So it's the other thread that is broken, not this method.

  • Chris (unregistered)

    The correct implementation would surely be as follows, which also returns a boolean to indicate success:

    bool InformationDisplay::Enable(bool state) { displayEnabled = state;

    if (!displayEnabled) { enableDisplay(false); } else { enableDisplay(true); }

    return displayEnabled ? true : false; }

  • Brian Boorman (google) in reply to Pjrz

    I don't know any sane client who wouldn't insist on source code and IP ownership for software going into an embedded product being sold. It's not some silly web app or service. We routinely subcontract code development, and we specify our ownership of the IP. Your job is to write, test, and hand over.

  • (nodebb)

    Another WTF (besides pointlessness of the entire annotation) is near the end of the very first line. It actually makes two comment blocks out of it:

    /*************************************************************************//

    • @brief Method, which enables display
    • @param true = turn on / false = turn off
    • @return None *******************************************************************************/

    WHY??

  • Dave (unregistered) in reply to Zenith

    I once worked on a government contract where our end had been negotiated by someone even more inept than the civil servant doing the same for the government. When they said 'jump!', we said 'can we come down yet?' and paid penalties for failing to stay in the air until they answered.

  • Аноня (unregistered) in reply to Vault_Dweller

    Is that a challenge?

  • seba (unregistered)

    This obviously must be the tri-state bool from https://thedailywtf.com/articles/What_Is_Truth_0x3f_

  • markm (unregistered)

    @Brian Boorman: I don't know any sane client who wouldn't insist on source code and IP ownership for software going into an embedded product being sold.

    Then I've had at least two insane ones - large companies that think of "hardware" as bolts and pipe fittings, and barely understood that there was software in their devices. One had asked the engineer before me (who eventually retired to get out of it) if he could reverse engineer the software from the EPROM - and the device they wanted modernized was so old that the micro read the code from a separate IC (and almost certainly was written in assembly language - c compilers lag the invention of new architectures, and it used to be much worse). They couldn't even give a behavioral description of the program (inputs, outputs, what happens for each combination of inputs) either, and writing new software from that would have been easier than disassembling hex code and trying to understand it with no variable or function names, no labels, and not even a memory map or a spec for where the code ended and constants kept in EPROM started. What my predecessor finally did was to program the same code into a newer version of the micro (leaving all the new features unused), and use logic circuits to translate between the old software and the new and somewhat improved machine.

  • markm (unregistered)

    And that wasn't even the reason this project was a disaster. They wanted to change the control of AC motors up to 1 HP (these are BIG HEAVY industrial motors) from huge and expensive relays to solid state devices, which in theory would never wear out - IF their specs were never exceeded. But as the first production units came back with burned out solid state controls, it became clear that this customer didn't even have any records of how many different brands and models of motor they had used over the years, nor of all the places they'd installed machines. By the time I managed to disengage from them, I was having nightmares about finding the original British 25Hz alternators and transformers still in use in some backwards corner of the world, and this customer insisting that we had to make it work...

    The second time the subject of embedded software came up, they actually had source code - not an ASCII file, but Z80 assembly printed on dead trees, with an unknown number of pages missing. All I needed to do was to interface a tester to this device, so I was able to use this with just a few times I had to trace a call into the missing portion and disassemble a small function from the EPROM. (Well that, and getting the circuit boards to fill a card rack into production - from hand-taped board layouts on film, and the film, schematics, and BOM often being three different versions.)

  • markm (unregistered)

    And this was with a customer where the management style was shooting the messenger, screaming and yelling, and blaming someone else. How did this company survive? They were firmly set in a niche market, with only one competitor, and so many employees went back and forth between the two companies that they had equally dysfunctional management. To duplicate their full product line might have required $10 million and 5 years. To then sell the products would take 100 salespersons another 10 years... I'm sure that somewhere in China, there is a company that is making copies of the whole product line for the local market - and eventually they'll gain the confidence to start building the sales staff needed to penetrate the worldwide market. (Intellectual property? Patents expire in 20 years, and no doubt they have still the products they bought from the OEM's over 20 years ago stashed somewhere. Software copyright might be effectively eternal, but I don't think this company could prove it was their firmware - and the Chinese company could throw manpower at the problem until they had "clean room" firmware that probably worked better.)

    The second customer was a public utility - in other words, they had a monopoly and if their stupidity ran up the costs, they'd go to the PUC and get a rate hike to restore profitability. They had a decade-old design that had to be upgraded because several of the components weren't made anymore, including a PIC microcontroller. This was without any specification aside from the obvious (UL-approval, etc.), and with neither source code nor object code (the security bit was set in the microcontroller so you couldn't read it back, and they outsourced the production and threw away the hex file). I hooked up a logic analyzer and oscilloscopes and started working out what the old board did, not how. Once I had reverse engineered the spec, the rest was relatively easy...

Leave a comment on “The Enabler”

Log In or post as a guest

Replying to comment #496755:

« Return to Article