For me all 3 possibilities could be equally used.
I see what Charlie proposes, it's about avoiding break the logic flow,
which supposed to make code more readable... But IMHO it's questionable.
WBR,
Alexey.
charlie hunt wrote:
> There's another Jackpot transformation called "if statements that can
> be simplified".
>
> What it is finding in the grizzly framework source is structures that
> look like;
>
> public boolean isOpen(){
> if (selector != null){
> return selector.isOpen();
> } else {
> return false;
> } }
>
> And, it suggests to transform them into:
>
> public boolean isOpen(){
> if (selector != null){
> return selector.isOpen();
> }
> return false; }
>
> I'd like to hear others opinions on this "simplification". I don't
> know as if I find the transformation any simpler.
>
> In fact if I were to transform the initial implementation I would do
> something like:
>
> public boolean isOpen(){
> boolean result = false;
> if (selector != null){
> result = selector.isOpen();
> }
> return result; }
>
> charlie ...
>