|more useful options|
Re: ?: = Obfuscation?by chargrill (Parson)
|on Dec 01, 2006 at 16:34 UTC||Need Help??|
I think the ternary operator is perfectly fine when used appropriately. For example, the following snippet:
... is a fine example of how NOT to use it when attempting to write maintainable code. Indeed, that's pulled from a properly indented and slightly deobfuscated obfuscation. On the other hand,
... seems like an acceptable alternative to the more verbose:
However, this type of shorthand is often best left to be decided by your environment. If you find yourself amidst folk who are comfortable with shorthand, by all means use that as a coding standard: "Where readability is not hindered, the use of the ternary operator in assignments is encouraged". If on the other hand your environment dictates that code be more explicit, whether its due to strict maintainability requirements or the presense of junior developers as maintainers, then adjust your coding standards to suit.