6. Major Project Theme



Procedural Programming (PP)


Procedural programming (PP) is a programming paradigm that focuses on step-by-step execution of instructions, using procedures or functions as modular building blocks. It is employed in languages such as C, Pascal, and Fortran. Unlike object-oriented programming (OOP), PP lacks the concept of objects and emphasizes the execution of procedures. (Smith, 2021)


Procedures and Functions


Procedural programming divides a program into reusable modules called procedures or functions, which perform specific tasks. These modules take inputs, process them, and produce outputs. They resemble methods in OOP but do not involve objects and their associated data. (Johnson, 2020)


For instance, a program calculating the average of a list of numbers would define a function called "calculateAverage." This function would sum the numbers and divide the sum by the count to obtain the average. (Johnson, 2020)


In pseudocode:


function calculateAverage(numbers)

    sum = 0

    count = 0


    for each number in numbers

        sum = sum + number

        count = count + 1


    return sum / count


The function abstracts the average calculation and can be reused throughout the program. (Johnson, 2020)


Data and Variables


Procedural programming uses variables to store and manipulate data. Unlike OOP, variables do not have associated methods. They represent memory locations and are scoped within procedures or functions. (Smith, 2021)


In the previous example, variables "sum" and "count" accumulate the sum and keep track of the count, respectively. These variables are local to the function. (Smith, 2021)


Benefits of Procedural Programming


Procedural programming offers simplicity, making it easier to understand and debug. It is efficient in terms of speed and memory usage, making it suitable for performance-critical applications. The modular nature of procedures promotes code reusability and maintainability. (Lee, 2019)


Conclusion


Procedural programming is a paradigm focused on step-by-step instruction execution using procedures or functions. It lacks objects and is suitable for specific applications. Understanding procedural programming fundamentals expands developers' skills for choosing the appropriate paradigm. (Smith, 2021)


References

Johnson, R. (2020). Procedural Programming Explained: Definition

Lee, G. (2019). Modern programming: Object-oriented programming and best practices. www.ebsco.com. Available at: shorturl.at/nvHT2 (Accessed: November 5, 2022).

Smith, J. (2021). Procedural Programming Overview.

Comments