Type of paper:Â | Essay |
Categories:Â | Computer science Software |
Pages: | 4 |
Wordcount: | 909 words |
Programming involves a series of creative processes in which a programmer writes instructions that direct a computer on what to do. A computer program is a set of codes that directs a computer on what to do in order for it to solve a particular problem or carry out a given task. Various approaches to developing computer programs exist today. They include object-oriented approaches (OOP) and procedural programming (PP).
Advantages of Object-oriented programming (OOP) over Procedural programming
Object-oriented programming approach is the newer programming paradigm. It implements the use of abstraction which is in the form of classes and objects to create objects. Objects are the real world elements thus the name Object-Oriented Programming. In an object-oriented application, objects communicate to another to request services. Objects are capable of sending, receiving, and processing tasks. A collection of objects makes up a class. Fields and methods are referred to as members of a class. Object-oriented programming also enforces the use of modularity which makes the work of developing a program easy. In this approach, a large complex program is broken down into smaller more manageable parts. For example in an application that manages a store, a module that manages finance is designed separately from the one which keeps track of the stock (Nanz, 2015). These two modules are later brought together into one big program. This makes the program manageable and understandable. The process of debugging is also made easy since a module that contains an error can be tested separately and debugged. An example of an OOP is C++. Inheritance is one of the best advantages of OOP over other languages. Objects of one class are able to acquire characteristics of objects of other class therefore enhancing reusability of code.
Procedural Programming (PP) on the other hand is a different programming approach altogether. This approach solves a particular problem step-by-step beginning from top to the bottom by use of procedures thus procedural programming. Procedures also called routines or subroutines interchangeably, tells a computer what to do in a step-by-step manner. PP implements no classes or modularity, therefore, a program must be completed before being tested making the development and debugging process complex. An example of procedural language is C language (Nanz, 2015).
Example of a class with attributes and methods
A class is made up of several objects. Objects depend on classes and therefore one must have a class before they can be able to create an object. An example below shows a class and objects.
To declare a class in java, identifier class is used followed by curly braces between which the body of a class is placed in. Here is an example
Class A
{
//Body of the class
}
Declaring a method on the other hand begins with a keyword static which is optional. The syntax below shows how a method is declared in java.
[static] returnType identifier (parameters)
{
//Body of the method
}
Here is an example which declares a class called Book and instantiates it with several objects
In the above example, the two methods which have been used are getTitle() and getPubYear() which use return statement to return their respective values. These two objects belong to the class Book. Taking an example of borrowing a book from a library, a book typically possesses various attributes such as year of publishing, book title and the publisher which must be captured in a system as it is in the program above (Smith, 2015).
Features of object-oriented programming that Visual Logic lacks
Object-oriented programs consist of several features that other languages lack. OOP is one of the creative programming paradigms which ease the entire programming process. It has several features which other paradigms lack. When compared with Visual Logic, for example, various features of OOP are not available in Visual logic. One of the features that Visual Logic lacks is the feature of polymorphism. This feature basically means taking many forms. In OOP, polymorphism is a concept in which functions, variable take different forms. Objects which belong to the same hierarchical tree may possess the same name but perform multiple functions. Polymorphism allows a programmer to program in general rather than doing it in a specific manner. Despite the importance of this feature, Visual Logic does not implement it. Inheritance is another key feature that OOP is made up of which Visual Logic lacks.
Inheritance is the feature in which objects of a class inherits the features of other objects of a different class. This feature enables a class to be derived from an existing class, therefore, enabling reusability of code.
Advantages of Event driven programming over Procedural programming
Event driven programming is an interesting programming paradigm in which a program is triggered by events of the user such as the mouse-clicks, pressing of keys among other user or thread generated actions. This paradigm is different from procedural programming in which a program is program solves a problem beginning from top to bottom. Execution of a program in event driven programming is much faster compared to procedural programming. This is basically due to the event driven program executing only events that have been triggered as opposed to procedural programming approach where execution is done from top to the bottom. This also affects the speed of compilation of code.
References
Nanz, S. &. (2015). A comparative study of programming languages in Rosetta Code. In Proceedings of the 37th International Conference on Software Engineering-Volume 1 (pp. 778-788). IEEE Press.
Smith, B. (2015). Object-Oriented Programming. Apress.
Cite this page
Free Essay on Programming Paradigms. (2019, Sep 27). Retrieved from https://speedypaper.com/essays/programming-paradigms
Request Removal
If you are the original author of this essay and no longer wish to have it published on the SpeedyPaper website, please click below to request its removal:
- Free Essay with Tricks for Getting Inspired to Write
- Drinking: A Love Story Summary and Detailed Analysis of the Outcomes
- Essay Example My Strange Addiction
- Origins of Inequality by Rousseau. Free Essay Example.
- Essay Sample: Differences Between Wahhabism and Other Salafi Currents
- Free Essay Example on Business Processes
- Essay on Digital Transformation: Moving Beyond E-Commerce Experiments to Harness Growth
Popular categories