Deep nesting vs early returns
rikki cattermole
rikki at cattermole.co.nz
Fri Oct 5 03:40:09 UTC 2018
On 05/10/2018 8:23 AM, Nick Sabalausky (Abscissa) wrote:
> I was in college during the height of the Java craze, so my instructors
> highly recommended the deep nesting approach. This was because return
> statements are control-flow, and control-flow isn't very
> object-orientedy, and is old-fasioned and in the same category as the
> dreaded goto and was therefore bad. So I switched to the
> nesting-instead-of-returning style because it was "The Right Way".
"Terminology invoking "objects" and "oriented" in the modern sense of
object-oriented programming made its first appearance at MIT in the late
1950s and early 1960s."[0].
And this is why you have to be very careful with any sort of trend in
programming. Because it was already done before you were born (assuming
you began learning after 1990) ;)
[0] https://en.wikipedia.org/wiki/Object-oriented_programming#History
More information about the Digitalmars-d
mailing list