23

Started a new job this week.

Just learned that my manager strictly prohibits while loops and "if else" statements.

Comments
  • 0
    Any reason why?...
  • 0
    "They cause errors".......... ?
  • 1
    Oh... Okay... I see... Cause everything else will definitely not fail...
  • 0
    ............................ I don't even know.
  • 18
    Well... One thing's for sure... From now on you'll have a lot of great material to post on devRant 😂
  • 0
    ,.................
  • 11
    WHILE this isn't funny, IF pm gets hit by a bus: celebrate! ELSE keep calling him an idiot.
  • 2
    @orijin you're fantastic
  • 2
    Keep us updated on his further higher informatical insights. This is going to be an interesting one :)
  • 2
    Depending on language and environment I can see his actually making sense. Putting a focus on functional paradigms instead of imperatives constructs can result in more resilient code.
  • 0
  • 0
    ...though I must admit: you can perfectly work without else. First set the value and only change it if the condition is met.
  • 0
    @Lukas and if you want to do two different function calls depending on a condition?
  • 1
    @returningsam ok.. well.. Have fun :D
  • 2
  • 1
    @P3t3r6 exactly. I'm not saying it's not possible, just insanely arbitrary.
  • 1
    @returningsam Absolutely. I can't see how you'd replace 'while' tho...
  • 2
    dynamic calling: but that's not possible in every language. Save the methode name in a string and the 'execute the string content'....other solution: case/switch...and this one is very elegant in OO: strategy pattern.
  • 1
    http://antiifcampaign.com/

    Just gonna leave this here.
  • 0
    Actually I too try to avoid if else IF I CAN. I always try to structure code in a way to eliminate conditions with IF and then have my else code after that.

    Looks clean. But at times, you just can't live without if/else.
  • 2
    @P3t3r6 and @Lukas You van also do tail recursion with a check for the stop-condition at the top: doOneStep(...params) {if (stop-condition) return; do-stuff; return doOneStep(... params-for-next-step);}
  • 1
    i love how much a set of dots conveys SO much disbelief
  • 1
    Guess I'm lucky as mine encourages the use of Do While, as long as it's appropriate and the right approach.
Add Comment