Balboos wrote:
I think you're missing the story being told.
Obviously you are missing the point. Beginners are in fact beginners. If they were not beginners then they would not be beginners. If they knew as much or more than senior programmers then there would be something wrong with the world.
Balboos wrote:
This is a basic illustration of efficient flow control. This, but a single illustration, is representative of code that is (depending upon the optimizer) less efficient and harder to understand and maintain. If a number of items are all dependent upon the same state of the same member, that question should only be asked once, unless compelling reasons exist for the unnecessary separation.
After 40 years of programming in multiple languages I understand the example. With that experience I also understand that there is almost no chance that it will make a difference in real code.
Balboos wrote:
Indeed, scenarios could exist where the initial two statements should be kept separate, such as potential side-effects of the test: but even here, there's an error lying in wait: compilers often do not guarantee the order in which the conditions within the parenthesis will be executed . . . unless forced to do so by nesting. If code existed between these two statements, that could change everything: but not as illustrated.
Which has nothing to do with my point. Provide an argument where 90% of the applications in the world would be measurably affected if one choice was always used. Conversely provide an argument that demonstrates that if beginners were to know fundamentals of design/profilers it would not be a measurable advantage.