What are Procedural, Event Driven and Object Orientated Programming
- Subject: Theoretical Tutorials
- Learning Time: 0
Procedural Programming –
procedural language is a list of instructions telling a computer, step-by-step. In this programming practice developer write line by line code which executes a single action each line. In procedural programming first line of code is executed, then the second, then the third and so on, lines cannot jump from the 1st to the 7th to achieve something it must first complete 1-6 in order to get to the 7th line. procedural programming also focuses on the idea that all algorithms are executed with functions and data that the developer has access to and is able to change. Procedural programming uses a top down approach to executing codes. Examples of procedural languages are – BASIC, COBOL, PASCAL, FORTRAN, C and PL1.
C# Flappy Bird Hunting Game MasterClass
Create a interactive shooting game with Flappy Birds
- Use OOP to make the game
- Backgrounds and Play Music
- Work with Multiple Forms
- & Much more ..
In this new course we will recreate the very popular game with a twist. We will create this game from an empty project to a fully compiled EXE file using Visual Studio. Click here to see the full course details.
Event Driven Programming –
Object Orientated Programming – OOP
OOP languages are very popular and they widely used in various different software applications and games. To think about this simply imagine a airplane it has 300 seats, two wings, 2 massive rotor fans and various controls. Now if we want to break it down we can create objects of those 300 seats and instead of making them one at a time we can design the perfect seat once and then have the program make 299 of them exactly the same way. In OOP programming this is called creating an OBJECT. That’s the first word in OOP.
To make an object in object oriented programming we give the object various different properties for example we need the height, width, colour, fabrics, padding, cushion, adjustment features etc for the plane seat. All of them can be inside that one object and then we can use the program to add the chair 300 times to the plane job done right, its awesomely simple.
Now you might be thinking about the wings, we all know plane wings are not exactly the same but I didn’t pick the plane example to lose now did I. Lets imagine we make the right wing object in programming including the shape, width, height, flaps, rotor location etc we don’t need to make any changes to that wing object however for the left one we can simple INHERIT the properties from the right wing and change the values as we need to. For example we can keep the width, height, flaps and rotor location but can change the shape to the left one so it’s more suited to the plane. Can you imagine a place with two right wings, that would be impractical and funny. Inheritance is a powerful feature in object oriented programming, it refers to defining a new class with little or no modification to an existing class. The new class is called derived class and the one from which it inherits is called the base class.
This explanation has taken a simpler approach because we are looking at what it is and what it does here is the technical version –
object orientated programming refers to the creation of reusable software object types and classes that can be efficiently developed and easier incorporated into multiple programs. Unlike the procedural programming practice which is a top down approach to executing the code OOP is a bottom up approach.
OOP also provides data hiding which improves the programs security, for example you can set public, private, internal and protected label on a class to make sure no one from outside the program can see the inner workings of your program.
In OOP an object presents an entity in the real world (the properties we talked about before). An OOP program is a collection of objects that interact to solve a task or problem.
Example of object orientated programming languages are C#, Java, Action Script, C++, Objective C, Ruby on Rails and others.