Chapter 8. Methods

Logic is divided into methods, not smooshed together in one big lump. Why? What problems can be solved by introducing a new one of those pieces? What is the point of having methods at all? Conceptually, at least, you could organize any program as one gigantic routine with control jumping every which way. While this was how early programs were structured (with occasional recent reversions), the big-lump-of-logic suffers from problems. The most serious is that it is difficult to read. With one giant routine it is difficult to distinguish important parts from less important parts. It is difficult to understand part of the program now and leave some details for later. It is difficult to separate what is important for invokers ...

Get Implementation Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.