Quality Code

We were struggling to get developers at the office so in managements whizdom we took on an offshore team of 5.
They have since been let go - here is an example of how they fleshed out their code…

        public static bool Comparison(bool? status)
            if (status == true)
                return true;
                return false;


Amazing skills :slight_smile:

@ Gus - Bit early init?

As is, this is indeed “funny” or at least not really glorious :wink:

But… maybe there was some code inside the IF sections at some time ?
Something like displaying messages, debug code or even calls to other methods depending on the test result. Once not useful anymore, thoses lines of code may have been removed but not the structure, hence leaving such a beautiful code…

What makes me thinking at this is the fact that a specific function has been created for a comparison. If it was a simple logical test, there was no need to even create the function. You see what I mean ?

Anyway, a second reading of the code should have avoided leaving such a thing, I admit. :slight_smile:

@ Bec a Fuel - there was never any other code in there it was just a “simple logic test” written by a “Mid level developer”…

hmmm really…
i must admin they must be smart people, simply because they know how to create a lot of work that simply does nothing (and get paid) i wonder how long they were doing this under your noses… so hey they had to get innovative and start creating code that does a lots of noting … and they take that nothing and run it through a function that would make sure it is truly nothing.

lucky for me that these folks existed otherwise, the management would have never knew how my skills really matter…
back to fixing code…:slight_smile:

Its a nullable bool type… maybe they had something in mind up front… Its not fair to judge without knowing their intension.

@ Jay Jay - indeed. The really scary part of it is that was at least readable even thou it did nothing, you should see what they did with Background Worker threads…OMG…

@ RobvanSchelven - The object could never be null that they used the code on and they explicitly check for null before calling it :slight_smile:

Awesome skills :slight_smile:
Is the producer of this masterwork available on the market?

@ Bec a fuel:
Even if they thought that sometimes someone needs to extend that code - YAGNI
You aint gonna need it.

[quote=“Weiti”]@ Bec a fuel:
Even if they thought that sometimes someone needs to extend that code - YAGNI
You aint gonna need it.


Indeed. And I completely agree.
My purpose was more to say that these guys might have needed at some time in the process to add some “useful” code (at leat, useful for them) in the IF structure and that after they didn’t need it anymore they have removed it but forgot to/didn’t remove the now unneeded IF structure.

And what if status == null ? :slight_smile:

@ WouterH - it can never be null.

you can assign null to a nullable bool

Yes but the object that they were using that code on can never be null.

That makes it even worse :slight_smile:

@ WouterH - Indeed, they where also using alot of BackgroundWorker Threads and Invoking UI updates on DoWork

Get a couple of fresh, hungry to learn people and train them.

I generally don’t trust any code that wasn’t written at my own desk. That probably makes me a jerk, but at least when stuff breaks, I know who to blame :wink:

If you’re looking for someone to blame when something breaks then in my book you’ve already failed :frowning: