18
medude
15d

My Java class started with a problem from CodingBat to return true if both inputs were true or false. This was my teacher's "best practice" solution because of how clear it is.

Comments
  • 5
    That's exactly how I would do it. Nice and simple.
  • 3
    It's a monkey trouble after all.
  • 5
    So you're complaining because you're in a class with others, and the teacher used an easy example to start with?

    You do realize you're not the only one in the class. There's other people with skill levels different from what you have. You might understand it instantly and think it's trivial, but the kid across the classroom might be seeing this for the first time and not quite grasp the concept instantly.
  • 28
    return aSmile == bSmile;
  • 2
    Well, explaining certain concepts can often be made easier by using more verbose or even inefficient solutions.
  • 3
    @Stuxnet True.. The teacher's now also showed how to think to the OP, how to get from logical code based on simple terms towards simplified and still understandable code. When you actually understand the language ur writing, you'll understand why this answer is far more efficient, and does exactly the same shit.
  • 2
    Just ask teacher to give you harder problems then others. Thats how my teacher does it for me and other classmate.
  • 5
    You have to apply the logical biconditional (XNOR). Or you can just drop the bullshit and use the equality operator as your prof did 😂

    return aSmile == bSmile, as mentioned before, is the cleanest (and my favourite) solution IMHO
  • 1
    @PonySlaystation Exactly what I had in mind. But it would probably confuse a few beginners.
  • 1
    Why is he returning falso?
Your Job Suck?
Get a Better Job
Add Comment