4.1.2.1 Programming paradigms Flashcards
What is a programming paradigm?
A method of programming. Some programming languages are more suited to certain paradigms
What is a procedural / imperative programming paradigm?
Writing a program in steps with statements, functions executed in order
e.g C++
What is a object-orientated progarmming paradigm?
Organized around objects rather than actions.
Data and functions are stored in the same memory location
e.g python, java
What are the advantages of procedural programming?
Simplicity compared to OOP, as its easy to keep track of program flow
You can reuse the same code at different points using subroutines
One practical way in which the programmer will use a structured approach to programming is the use of subroutines (procedures/functions). Give three other ways.
Procedures which have an interface / using parameters to pass values ;
Use of modules / use of libraries ;
Avoid global variables / use of local variables;
Meaningful identifier names;
Consistent use of case for identifiers ;
Use of selection / loops / iteration ;
Avoid the use of GoTo structures ;
Effective use of white space / indentation;
Use of named constants ;
Use of user-defined data types ;
Use of pseudo-code / top down approach