Structured Programming and Procedural Programming

We have been learning, accessing, and applying methods available in Python (it would be impossible to teach Python without doing so). Although the syntax and use of these methods are inherently object-oriented, we have been using them in the context of procedural program design and in the form of structured programs. Recall that procedural programs use functions as a way of breaking a program down into a set of procedures to solve a problem. Read this page to learn why we have been arranging our programs the way we have.

Coding Guidelines

The practice of coding style varies with organizations, operating systems, and the language of coding itself.

The following coding elements may be defined under the coding guidelines of an organization:

Naming conventions - This section defines how to name functions, variables, constants, and global variables.

Indenting - This is the space left at the beginning of a line, usually 2-8 whitespace or single tab.

Whitespace - It is generally omitted at the end of a line.

Operators - Defines the rules of writing mathematical, assignment, and logical operators. For example, assignment operator '=' should have space before and after it, as in "x = 2".

Control Structures - The rules of writing if-then-else, case-switch, while-until, and for control flow statements solely and in a nested fashion.

Line length and wrapping - Defines how many characters should be there in one line, mostly a line is 80 characters long. Wrapping defines how a line should be wrapped if is too long.

Functions - This defines how functions should be declared and invoked, with and without parameters.

Variables - This mentions how variables of different data types are declared and defined.

Comments - This is one of the important coding components, as the comments included in the code describe what the code actually does and all other associated descriptions. This section also helps in creating help documentation for other developers.