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

Indeed, the original code was, IMO, incorrect.

It looks like the purpose is a pretty common one in iOS - you have a table view populated by many rows, each of which can be a different class that renders and behaves differently. It's a common need in iOS apps.

What he really needed was an enum, not flags. The choice of class is mutually exclusive and flags are horrible for tracking this, and are great for hiding bugs - one erroneous flag flip and suddenly your code is walking down a completely different path that's non-obvious on first debug. Using a bunch of bools to approximate state is error-prone and IMO just bad architecture.



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

Search: