In this chapter:
Different types of routines
Advantages and disadvantages of routines
How the call stack works
Writing good routines
How parameters work
Passing values by value or by reference
Understanding value types and reference types
OFTEN, A PROGRAM MUST PERFORM THE same task in several different places. For example, a point-of-sale application might print a customer invoice as soon as a sale is complete. Each week, it might reprint invoices that are more than 30 days overdue. It might also allow you to select a customer and reprint that customer’s past invoices. In all three cases, the program does the same thing: it prints an invoice.
You could duplicate the code needed to print an invoice in all three places, but that would ...