A procedure should do exactly one thing and the name of the procedure should reflect what it does. Sometimes I find it very hard to find a name for a procedure and after some pondering I realize that it does too much and needs to be further split up. My procedure names usually start with a verb as a procedure usually does something. This should be reflected by the name.

Procedures are the building blocks inside a module. I try to keep them small. My soft limit is one display size which corresponds to 60 to 80 lines. Having all code of a procedure visible in one display makes it easy to navigate and understand the procedure.

My soft limit for the number of parameters for a procedure is 10 though I usually have less than 5 parameters in a procedure interface. I don’t use parameters for passing data back to the caller. I always use the return parameter for that. If I need to pass multiple values of a different kind back to the caller I group them together in a data structure. If the values are of the same kind I return them in a list. I usually use a Linked List or ArrayList. By using these dynamic lists I don’t have to worry about the number of elements I may return in some conditions because those lists grows and shrink dynamically.