Sunday, May 29, 2005

gosub and design patterns

I started programming in BASIC on the Commodore 64 back when I was in Jr. High. At the start I used the GOTO statement to control program flow.

After a few months I was excited because I found out about this useful command called GOSUB. The GOSUB command allowed me to reuse blocks of code and the system would conveniently return control back to the calling point when the GOSUB block was done.

Later on in university I took the intro to programming in Pascal. An early topic in the course was "subroutines", expressed in Pascal using procedure and function. When they were talking about subroutines I immediately recognized this as GOSUB.

So "subroutine" can be considered a design pattern. It's a generic way of doing things that can be reused in many contexts. With GOSUB, I was using the subroutine design pattern without knowing about the formal label for it.

I've never read Design Patterns. I don't really plan to. A number of people I work with have. I've never seen anything in their code that is startling that makes me think I'm missing something important. My theory is that it's like with GOSUB. I already use the stuff, I just don't have the special labels for it.

If I ever lose my job and am out of work I'll have to read it so that I can be considered "competent" by the shops where it's a big deal.

No comments: