Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Object-oriented Programming (OOP) / Event-Driven Programming (EDP) versus Proced

ID: 3901976 • Letter: O

Question

Object-oriented Programming (OOP) / Event-Driven Programming (EDP) versus Procedural Programming (PP)

Identify at least two (2) advantages to using OOP as compared to using only PP.

Create one (1) original example of a class with at least one (1) attribute and one (1) method. Identify what the class in question represents, the attributes the class stores, and the purpose of the related method. Next, examine the relationship between the class, attributes, and methods that you have identified.

Describe at least one (1) feature of object-oriented programming that Visual Logic lacks.

Identify at least one (1) advantage to using event-driven programming, as compared to using purely procedural programming.

Explanation / Answer

Two advantages to using OOP as compared to using only PP are as follows

a.OOP has a concept of Encapsulation.Encapsulation is like a black box which binds the code and data together.It acts like a wrapper which prevents the code being accessed by any other code which is defined outside the block.

b.OOP introduces the feature of shallow copy or deep copy.

class Test
{
void display()
{
System.out.println("Welcome");
}
public static void main(String[] args)
{
Test obj=new Test();
obj.display();
}
}

Here the class Test is created which is having one function named display which return type is void.And from the main function the object of the class is created and with the help of that object the function display is called.When the function is called it print the string Welcome to the console.

Visual logic does not have the concept of class defination as used in the object oriented programming language.

The main advantage of using event driven programming over purely procedural programming is that it can be done using hardware interrupts.