Unit Six Assignment 1. Chris Boardley. Task 1. P1 - Describe the application and limits of procedural, object oriented and event driven programming paradigms. The Procedural Paradigm.
P1 - Describe the application and limits of procedural, object oriented and event driven programming paradigms.
Procedural programming basically uses a set of computational steps (procedures) in order to accomplish a specific task. This is a fast process and because of it’s simplistic approach, it is often the paradigm used when teaching programming to beginners due to it’s relatively simple logic.
When writing code for complex software, procedural programming would not be the preferred paradigm because the complex software would require many lines of code, making it an unwieldy and perhaps confusing way of coding.
Procedural Programming Languages can include –
Object orientated programming focuses on using objects rather than procedures in order to accomplish a task. This can be beneficial because it is modular, which allows separate objects to respond to the same instruction differently. Also, it allows the programmer to alter specific objects without altering the whole program.
OOP has a steep learning curve, requires a lot of planning and consideration of the relationships between objects can be difficult to get used to. OO programs also tend to be larger in size, which can be a problem in some circumstances.
Object Orientated Languages can include –
Event Driven Programing languages can include –
P2 - Describe the factors influencing the choice of programming language.
P3 - Explain sequence, selection and iteration as used in computer programming.
An algorithm written in sequence will contain a series of steps. When the algorithm is run these steps will be executed in order from the first to the last without skipping any, because there is no method of selection and no available conditional branches. These algorithms will run the same way every time they are used, and will not respond to data.
An algorithm written in sequence makes use of boolean logic, true and false. In order for these algorithms to run there must be procedures to handle control structures, such as the words if, then, else, endif, switch and case. This allows for branches in programs to be created depending on what data is being manipulated.
Iteration algorithms make use of loops, doing something multiple times. Fixed loops will perform something a set number of times every time the program is run. Conditional loops will run until a condition is met, for example it will run until something becomes true or false etc. Another example of a loop is one that will perform a specific action whilst a condition is active, i.e. the loop will run whist a condition is true, and will stop looping when that condition becomes false.
P4 - Outline the benefits of having a variety of data types available to the programmer.
Having a variety of different data types (such as strings, bytes, booleans, integers, dates, floating points etc.) can be beneficial when programming for a variety of different reasons. Some of these reasons are -