One of the nitpics that I received was a suggestion to replace some of my code with the ternary operator. Is this necessary? I truly hate the ternary operator because I think it is less readable and it certainly is less expandable. [ January 11, 2002: Message edited by: Matthew Phillips ]
About 95% of the time I would say that use of the ternary operator does not add readability, but there are cases where it does add readability, and one of the main things I try to do in the cattle drive is teach readability. Yes, I know I'm being redundant.
Here is a link where we discussed it previously. In particular, I'd like to point you to the last post in that thread. [ January 11, 2002: Message edited by: Marilyn deQueiroz ]
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I used to avoid it myself because it looked "strange", but recently I've become fond of it's ability to streamline certain idioms, such as if (someObjRef == null ) foo = 0; else foo = someObjRef.someMethod(); foo = (someObjRef == null ? 0 : someObjRef.someMethod()); There are other such idioms that escape me at the moment, but I've re-thought my aversion to the ternary operator and am putting it to good use now.
Joined: Mar 09, 2001
kicking up dust on the ground OK, I'll use it, but I don't have to like it.