22
noScode
3y

You will know your 2 year old dev team is messed up when the 'best programmer of the bunch' does a line like:

boolean check = ...some logic...;
if(check == true) {...

:/ and I'm going to be leading this team..

Comments
  • 13
    Bad code. Should have been

    if (check != false)
  • 10
    Haha, I got a legacy app to refactor, I found this type of code:

    (true ? logic one : same logic one ) || true
  • 9
    This is nothing guys. I once had to explain why this is a bad test

    var service = new MockLibrary.Fake<MyService>();

    service.dosomething();

    service.VeryifyWasCalled(s => s.doSomething());
  • 4
    Being there, Done that.
    Just hang in there my friend and never forget, killing stupid people is still a crime.

    My biggest sigh of relief was the guy resigned voluntarily. 6 months after he left, the codebase was 30% the size.
  • 2
    I once saw something like this: if something == true, return true, else return false. I asked “why don’t you just return that Boolean variable?”, then he said “just to be sure”.
  • 3
    I don't see the problem here.
  • 1
    If the logic is sort than it's a silly style. If the logic is complex than it's perfectly valid:

    bool goodblah = some_mess < whatever;
    bool frobnacious = messy_crud != junky_expression;
    bool yetanother = long_winded_condition;

    if (goodblah || (frobnacious && yetanother)) {
    ...
    }
  • 0
    @Crost i have no idea what that does what language is that?
  • 1
    @hjk101 seems like c#
    and seems like the VerifyWasCalled takes function (delegate) as a parameter.

    it probably wants to be used as
    VerifyWasCalled(service.doSomething), basically providing a pointer to that function to the VerifyWasCalled one.

    what is being done there instead, is creating a lambda (anonymous) function, which, when called, calls the service.doSomething() function, and then passing that lambda to the VerifyWasCalled.

    *syntax for providing a pointer to the function (delegate) in my explanation is incorrect, i don't use delegates in this way too often, so i don't remember exactly how you create one/cast a function to one/whatever. as a bonus, delegates were always a bit confusing to me for some reason.
  • 0
    ... i think/assume
Add Comment