in reply to Why I Hate Nested If-Else blocks
Bravo! ++.
This sounds very much like a call to think through one's designs first. (You do design, right?) Laying out the branches on paper is a very good way of doing this.
Of course, there are some gotchas. For example, the place I'm at right now has a lot of legacy code that uses the form
This is vs. the (to me) more intuitivesub foo { my $self = shift; if (ref $self) { # Do stuff return $some_useful_value; } else { # Complain return undef; } }
*blinks* I guess I just proved your point, huh? :-)sub foo { my $self = shift; unless (ref $self) { # Complain return undef } # Do stuff return $some_useful_value }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
---|
In Section
Meditations