Notes
Untitled
Content of the notes (3)
Page 1
Procedural programming and Object-Oriented Programming (OOP) are two different approaches to writing computer programs.
Procedural programming is a programming paradigm that is based on a step-by-step procedure or recipe for solving a problem. It is primarily focused on writing procedures, or functions, that perform specific tasks or operations. Procedural programs are typically organized around functions that are called in a specific sequence to accomplish a particular task. Procedural programming languages include C, Pascal, and Fortran.
On the other hand, Object-Oriented Programming (OOP) is a programming paradigm that is based on the concept of objects. An object is an instance of a class, which is a blueprint for creating objects that have specific properties and behaviors. OOP is focused on creating and manipulating objects that interact with each other to accomplish tasks. OOP languages include Java, Python, and C++.
The main difference between procedural programming and OOP is the way in which the programs are organized and the level of abstraction. Procedural programming is typically used for small to medium-sized programs, while OOP is used for larger, more complex programs that require a greater level of abstraction and organization.
In summary, while procedural programming focuses on procedures and functions that perform specific tasks, OOP focuses on creating and manipulating objects that interact with each other to accomplish tasks. Both paradigms have their strengths and weaknesses and can be used in different situations depending on the requirements of the program.
Page 2
Procedural programming has several disadvantages, including:
Code complexity: As the program size increases, the code complexity can also increase rapidly. This can make it difficult to maintain and update the code in the long run.
Limited code reuse: In procedural programming, code is often written as a series of functions, which can make it difficult to reuse code in other parts of the program or in other programs.
Lack of modularity: Procedural programs can be difficult to modularize, which can lead to code that is tightly coupled and difficult to test and maintain.
Difficulty in handling large programs: Procedural programming can be difficult to manage in larger programs, as it lacks the ability to encapsulate data and behavior within objects.
Poor support for parallelism: Procedural programming often lacks the features necessary to easily implement concurrent or parallel programming, which can limit the performance and scalability of the program.
Difficulty in handling complex data structures: As programs become more complex and require more sophisticated data structures, procedural programming can become unwieldy and difficult to manage.
Page 3
In C++, an object is an instance of a class. A class is a blueprint or template that defines the properties and methods that all objects of that class will have.
To create a class in C++, you use the class keyword followed by the name of the class.
class fruit{
public :
int price;
string name;
};
Information
- Description
- Note on Untitled, created by Nihar Joshi on 07/04/2023.
- Created by
- Nihar Joshi
- Views
- 1
- Rating