On Mon, Sep 2, 2013 at 9:20 PM, David Deutsch <skoremail@gmail.com> wrote:For that specific "entire content of a function" case I mentioned the
>> A proper and predictable process flow is something I learned to appreciate
>> during my years as a software developer.
>
> Sure, although I don't understand how my approach makes it any less
> predictable. All I have done is fan out the if/elseif structures and,
> arguably, that makes it easier to check through them. Maybe changing it to
> no-oneliner-ifs will make this a little clearer for you, but the return
> statements really stand out when you scroll through the code - whether or
> not they are wrapped in if blocks or individually.
>
>
>> What's wrong about if clauses with proper indenting? These can even be
>> collapsed with a sexy IDE.
>
> Nothing wrong with them. It's just: Do you wrap the entire content of a
> function in an if or do you make a negated if -> return statement? The first
> doesn't scale, the second makes things more readable - that was really all I
> was trying to convey.
exceptions that allow returns at the beginning of a function that
check preconditions.
But I'm more referring to your initial refactoring in
https://github.com/daviddeutsch/roundcubemail/blob/cleanup-3/plugins/archive/archive.php#L17
In such cases I think a sequence of if/else if/else blocks makes more
clear for the reader that these are three distinct cases handled in
the plugin init function.
~Thomas
_______________________________________________
Roundcube Development discussion mailing list
dev@lists.roundcube.net
http://lists.roundcube.net/mailman/listinfo/dev