DELAPARRA
Index
Color
NL
Category: Programming paradigms

Procedure / Routine

Explained by Updated

What is Procedure / Routine?

Procedure / Routine: A named, reusable block of code that performs a task. In modern terms: a function without a return value (void) — like printReport() or saveToFile(path). A procedure, or routine, is a named block of code that performs a task, like printReport() or saveToFile($path). In modern terms it is a function, often one that does something rather than returns a value.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Procedure / Routine

How is Procedure / Routine used in practice?

Grouping steps into procedures was one of the first big steps in making programs readable. Instead of repeating the same lines, you call the procedure by name, and the name explains the purpose.

What should you keep in mind with Procedure / Routine?

The same advice applies as for any function. Give it one clear job and a name that says what it does. Keep side effects, such as writing files or sending emails, obvious from the name, so callers are not surprised. A procedure called getCustomer() that also updates a database record is a trap for the next developer who calls it.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with P

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.