Jump to content

Procedural code

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Furrykef (talk | contribs) at 09:34, 29 December 2004 (fmt, sp). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The procedural code anti-pattern involves writing code by compiling all of the steps needed to accomplish a task in sequential order as opposed to abstracting the fundamental components of the task. This is like following a set of driving instructions as opposed to finding your way with a map. The driving directions are highly context sensitive and of little use to those who do not share the same point of origination or destination. The map, however, could be used in many different contexts and the components (streets, compass points, distances) could have many different applications.

Procedural code is not necessarily unproductive in small scripts, or in moderation and at a high level in the code, in fact it could be argued that at some point there must be some procedural programming element to any useful software project. However, procedural code can become unmanageable in larger projects.

Object-oriented and Declarative programming languages aim to avoid the pitfalls of procedural code.