Deep nesting vs early returns

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Fri Oct 5 19:04:26 UTC 2018


On 10/04/2018 11:40 PM, rikki cattermole wrote:
> 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

It's not *my* statement about newer/older. If you recall the programming 
atmosphere around 2000, OO was widely being touted as a newer thing, 
superior to "old-fashioned" imperative, even though there's a million 
things about that whole assessment that are false (not the least of 
which being the at-the-time popular notion that Java-style OO somehow 
wasn't still imperative, or, as you pointed out, that OO was a new 
invention).

There's one minor aspect of it that was true though: Widespread 
popularity of OO was certainly a new thing, even if OO itself wasn't.


More information about the Digitalmars-d mailing list