logo

Study resource

Programming paradigms revision notes

Study Programming paradigms with curriculum-aligned Revision Notes resources, practice links, and exam-focused support.

At a glance

revision notes

Resource type

Topic

Programming paradigms

AqaA LevelComputer ScienceFundamentals of programming

Revision notes

  • Programming Paradigms: Procedural and Object-Oriented Design

    Procedural-oriented programming

    The procedural paradigm uses a structured approach to program design and construction. A program is designed as a set of procedures or subprograms, with the overall task divided into smaller, manageable parts. A hierarchy chart can show this decomposition: the highest-level task is at the top, and the procedures that contribute to it appear beneath it. For example, a ProcessOrder task might be decomposed into ReadOrder, CalculateTotal and DisplayReceipt. The chart should show the structure of the design clearly before implementation begins.

    The structured approach helps a programmer organise a complex problem into separate parts. Each procedure can be designed and constructed as part of the wider solution, making the program structure easier to follow and reason about. A common error is to confuse a hierarchy chart with a flowchart: a hierarchy chart shows the relationship between program components, whereas a flowchart represents the sequence and decisions within an algorithm.

    Object-oriented programming

    A class defines the methods and property or attribute fields that capture common behaviours and characteristics of objects. An object is based on a class. Objects are created through instantiation, using a constructor, which may be implicit or explicit. A reference to the created object is assigned to a reference variable of the class type. In C#, for example:

    ```csharp class Account { private decimal balance; public void Deposit(decimal amount) { balance += amount; } }

    Account accountReference = new Account(); ```

    Here, Account is a class, accountReference is a reference variable, and new Account() instantiates an object using a constructor.

    Encapsulation combines data and the methods that operate on it within a class and controls access using specifiers. public members can be accessed wherever the class permits, private members are restricted to the class, and protected members are available to the class and relevant inherited classes. A frequent error is describing encapsulation merely as “using classes”; it also concerns controlling access to class members.

    Inheritance allows a class to be based on another class. Overriding occurs when an inherited method is provided with a new implementation in the inheriting class. Polymorphism allows an operation involving a class type to work with objects of related class types, so the appropriate overridden behaviour can be used.

    Aggregation and composition represent relationships between classes. In UML, aggregation is shown with a white diamond line and composition with a black diamond line. Do not reverse these symbols in a class diagram. A class diagram may also show single inheritance, attributes, methods and access specifiers: + means public, - means private and # means protected.

    Design principles

    Object-oriented design principles include encapsulate what varies, favour composition over inheritance, and program to interfaces, not implementation. The specification expects awareness of these principles. Practical programming to interfaces is beneficial, but it is not explicitly tested as a practical requirement.

    Object-oriented programming is used when the solution can be represented through classes and objects with common characteristics and behaviours. Be prepared to write programs involving user-defined classes, abstract, virtual and static methods, inheritance, aggregation, polymorphism and public, private and protected members.

Related topics

Study nearby topics next