Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ah yes, the good old binary worldview. Such a delightfully simple algorithm.

    def decide_position(position)
      case position.party do
      when GOOD_PARTY
        cheer()
        return true
      when BAD_PARTY
        boo()
        return false
      else
        shutdown()
        raise InvalidPartyError.new "Warning: Logically impossible situation detected. There are only two parties, and one is good and the other is bad.  System shutdown initiated to avoid potential memory corruption"
      end
    end


I have some thoughts on this code:

1. Why is decide_position returning a boolean? The function signature, even without types, doesn't really indicate that it should return a true / false value. Perhaps a better name would be "is_position_good"?

2. Why would the memory get corrupted? Most operating systems should be able to handle such a case.

3. Why do we shut down the entire application? Surely there's a better method rather than killing the entire application due to a single boolean check.


It's funny that this is the exact opposite of what I said. I said "vote for policy". As it stands one party is at least on the right side of most major policies and one is on the wrong side. You'll never get 100% alignment but the two main parties are generally pretty good and aligning with the sensibilities of major blocs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: