On Thursday 03 May 2012 15:22:56 Jonathan Lange wrote: > > Enums are nearly always better than a bool. I've lost count of the number > > of times I've seen loads of mutually exclusive bools because people > > didn't plan ahead. > > Or because people didn't update existing bools to enums when they > decided they needed a new mutually existing one. It's not that we > don't plan ahead, it's that we often don't update code when the > situation or our understanding changes.
Updating a bool to an enum is not trivial and requires a database migration, potentially of millions of rows. The path of least resistance at that point is to add more bools. > If we add this as an enum, it will only have two fields. Some time > from now, someone unfamiliar with this conversation will look and ask > "Why is this an enum? It only has two fields" and then they'll switch > it to be a boolean. I really doubt that. Especially when you add a comment to explain the potential use of the enum. You comment your code, right? :) I really don't understand the reticence to use enums instead of bools, there is zero harm in doing so. _______________________________________________ Mailing list: https://launchpad.net/~launchpad-dev Post to : launchpad-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-dev More help : https://help.launchpad.net/ListHelp