Glossary
Arguments
The actual values or expressions that are passed to a procedure when it is called, corresponding to the procedure's parameters.
Example:
When calling addNumbers(5, 10), the values 5 and 10 are the arguments passed to the addNumbers procedure.
Encapsulation
The bundling of data and methods that operate on the data within a single unit, allowing changes to be made internally without affecting external parts of the program.
Example:
A game character's movement logic is often encapsulated within a single procedure, so changes to how the character walks don't break the jumping or attacking animations.
Modularity
The practice of dividing a program into separate, independent parts or modules, making it easier to organize, debug, and update.
Example:
Building a complex game by creating separate modules for graphics, sound, and player movement demonstrates modularity, making development and debugging much easier.
Parameters
Variables listed in a procedure's definition that act as placeholders for the inputs the procedure will receive when it is called.
Example:
In a greetUser(name) procedure, name is a parameter that allows the procedure to greet different users like 'Hello, Alice!' or 'Hello, Bob!'
Procedural Abstraction
A programming concept that allows you to use a procedure without needing to know the specific internal details of how it works.
Example:
When you use a calculator's square root button, you're using procedural abstraction; you don't need to know the complex algorithm it uses, just that it gives you the square root.
Procedure
A named block of code that performs a specific task, also known as a function or method in different programming languages.
Example:
A procedure named calculateTax might take an income as input and return the calculated tax amount, simplifying financial software.
Readability
A quality of code that makes it easy for humans to understand and interpret, often improved by using clear procedures and good naming conventions.
Example:
Using well-named procedures like displayWelcomeMessage instead of a long block of print statements greatly improves code readability for anyone looking at the program.
Return Statement
A statement within a procedure that immediately stops its execution and sends a value back to the point where the procedure was called.
Example:
After calculating a student's grade, a procedure might use a return statement to send that final grade back to the main program for display.
Reusability
The ability to use the same procedure multiple times in different parts of a program or in different scenarios, often by providing different inputs.
Example:
A single drawCircle reusability procedure can be used to draw circles of different sizes and colors all over a graphic design program, simply by changing its parameters.
Void Procedure
A type of procedure that performs a task but does not return any specific value to the calling part of the program.
Example:
A printGreeting() void procedure might simply display 'Welcome!' on the screen without calculating or returning any specific data.