I first encountered routines in QBasic, around the time I started high school. I had been using GOTO and GOSUB commands in GW-BASIC for quite some time, but in QBasic, you had the ability to separate the code out from your main program, and to isolate variables from each other. Once I got the hang of the concept, it made programming much easier, and decreased the number of errors I had in a program quite substantially, since I could more easily isolate code, and look at a single block at a time, without having to scroll back and forth through the program (At the time, I was using a DOS based editor, so only 24 lines or so could fit on the screen at one time.)

Since then, working with routines has become much easier, and the IDEs and supporting tools have improved greatly. Documentation as been assisted through tools like Sandcastle for .NET, which takes comments assigned to routines when formatted a certain way, and generates documentation from them (In Java, the equivalent is Javadoc). The .NET IDE lets you refactor blocks of code into routines directly by selecting the block, right clicking, and choosing a menu item. Parameter passing and return values are handled automatically, and your routine is available for use in other blocks of code. Refactoring also allows you to rename routines easily, modify parameter order, and much more, making changes far less painful than they once were.

Over the next section, we’ll be covering routines in greater detail along with the book. Feel free to regale us with your stories of your interaction with routines, and how they affected your life by leaving us a comment below.