×

Approach in C++

Object oriented programming languages like Java or C++ use a bottom-up approach that identifies each object first.  In the bottom-up approach, we create a small problem first, and try to solve the smaller problem. After solving the smaller program, we will integrate it into a whole subprogram and then to a complete solution to the main program. This approach is mainly used by an object-oriented programming language like C++, Python etc.

In the bottom approach, we specify a small problem and firstly solve it. We can say that all the individual parts of the system are specified in full detail like every individual part we have solved, same as we do in object-oriented programming, we create objects and, finally, we combine the problem, so what we need to do in the bottom-up approach we start to combine all parts of the program. Suppose, there are four parts we combined, it will make another bigger problem and this will be once again combined to solve another larger problem so this is our concept of bottom-up approach same as object-oriented programming we see (e.g.) c++ or java.

So, we can say, in bottom-up approach, we will create smaller programs first with full descriptions, then the smaller programs integrated and linked to other components then these components are linked to form a complete main program. In this program, we will solve the smaller solution and then bring the solution together to create a great program. This approach is used when we have a lot of details about smaller programs, and by using the result, we have to create the main program.

Some specifications of a bottom-up approach

1. Start with small modules and add them together

2. After every step, communication is mandatory

3. Generally used by object-oriented programming

4. Works on the concept of data hiding and encapsulation

5. After every step, checking is important

This approach works when we have enough idea about each section module of a program but have yet to learn of the overall program. This approach mainly focuses on how Data is secure. To put it simply, we use bottom-up, which means we can make programs in small pieces first and then as a block to build a large program.

Approaches in Programming

For developing any software and mobile app, we have mainly three different approaches, which are: The top-down approach, bottom- up approach, and Hybrid.

Approach in C++

1. Top-down approach:

In this approach, we develop an overview of the program before developing processes. After that, we create every module with basic prosperity and a basic structure for our project. After creating the basic structure, we work with every individual after that. We work on every individual module. This approach is used when we have a good overall idea of what we need but need more information about each section of our program. In this approach, the problem is divided into small modules. Each problem is analyzed, and the solution of all subproblems is combined to produce the overall result of the program. this process of implementing a structured design is called structure programming

Some characteristics of top-down approaches are given below:

  • emphasis is on doing things.
  • Large programs are divided into smaller programs known as function.
  • Most of the functions share global data.
  • Data move openly around the system from function to function.
  • no data security.
  • transformation of data from one to another.
  • In top-down approach addition of new data and function is very difficult.
  • this is mainly function-oriented.
  • not extensible.
  • it follows procedure-oriented programming.
  • simple user-defined data types are created.
  •  programming languages like c, pascal follow this approach.

Advantage of the Top-down approach

  • easy to discover an error in a program that is well-analyzed and well designed
  • easy to modify a program.

Major drawback of the top-down approach

  • we have to solve each module individually even the module is common or not.
  • It is the approach used when we have a good idea of the final result, but we have very few details about each section
  • this approach is focused on how the task is done.

2. bottom-up approach: It starts with creating small modules in great details all they module in detail,

These modules are then linked to create components, which are then linked to form the complete program. In this approach, we solve the smaller problem first and then bring this solution to create a great program, this is used when we have a lot of details about certain components of the program and we want to build the rest of the program around those components.

Some characteristics of top-down approaches are given below:

  • Emphasizes on data rather than procedure
  • programming is divided into what is known as objects
  • function that operates on the data are tied together in the Data structure
  • Data is hidden and cannot be processed by an external function
  • data security exists.
  • with the help of function, objects may communicate with each other
  •  new data and functions can be easily added when necessary
  • this is mainly data-oriented.
  • security of Data is to exist
  •  extensible
  • it follows object-oriented programming, which can create complex user-defined objects

programming languages like c++ java follow this approach.

 An object-oriented programming language is an approach that divides a program by creating an object(data + object) that can be used as a template for creating copies of such objects on demands. Object-oriented programming mainly focuses on the security of data.

In this approach, we move bottom to the top of our program. This approach is used when we have enough idea about each section/module of the program but have yet to learn of the overall program.

2. Hybrid approach:

It starts with creating a detailed core of the program with basic modules put together, then we add modules to this core and add functionality to the program. This approach ensures to get a broader vision of the program, like in a top-down approach. And also, the precision in each module is provided by the bottom-up approach. This approach is very balanced and is used instead of the top-down approach when we have a good overall idea and enough details of individual modules.

Why is the bottom approach used in C++?

Yes, C++ follows the bottom approach. The bottom approach divides a complex problem into smaller, easier parts. If these parts are still complex, we further divide these into more manageable, easier tasks and keep repeating this process until we get the easiest parts. By doing this, we get the most basic parts of that complex problem, here easiest tasks are solved or processed first then the result of these easiest parts, we process higher-level tasks and repeat this process with the next higher-level tasks. We get the solution of the main complex,

If we want to store an object's data, we first get that object's most basic details. Then taking those basic details, we keep on processing its further higher-level details according to requirements. We can also do the same tasks in procedural-oriented language, but the object-oriented language could be better for data security.

In an object-oriented language, if we want to store data of students, then we first decide to take the most basic details like no, name, class, fees absents, etc. we get these entries then we can process this Data for getting basic details,, of a student, fees related processing, attendance related processes we can provide the final result of an object.

For example: if we are creating a student management system

in bottom up: We create students, courses, subjects first, and then top-level departments, classes, reports, etc.

In top-down: We create top-level objects like a report, results, etc. then later, students, sources

Now, taking the most basic details of the student object, we reach to complex result-creating process. Object-oriented language provides data security features.


Related Topics

Features of OOPS in C++

What is OOPs? The main reason programmers prefer C ++ language over C is because of the support of object-oriented programing in C++. As the name suggests, object-oriented programming or OOPs...

3 minutes read.

What does Buffer Flush mean in C++

A buffer flush, to explain simple layman's terms, is nothing but the transfer of computer data which is being stored in a rentable temporary memory of your computer running either...

3 minutes read.

C++ operator

In this article, we will discuss about the operators in C++ with their types and examples. An operator is specially a symbol that tells compiler to perform specific manipulation. C++ contains...

5 minutes read.

How to create a directory or folder in C/C++?

A directory is to lists all files and subdirectories in a directory, set of the files will be kept in the directory, which is a location. A subdirectory is a...

5 minutes read.

Sliding Window Technique in C++

Sliding Window Technique or Window Sliding Technique is a computational technique that is mainly used to reduce the use of nested loop and replace it with a single loop. It...

4 minutes read.

C++ Continue in Do-while loop

Continue statement: Inside the loop, the continue statement is used to control the loop. C++ utilizes the continue keyword to implement the continue statement, which transfers the program's flow at the start...

4 minutes read.

C++ Switch

In C++, an expression or variable can be tested against a range of constant values using a switch statement, which is a control flow statement. It offers a productive method...

4 minutes read.

How to enter a name in C++

A name is a string or array of characters or letters. The string is one of the most helpful data types offered by the C++ library. A string helps the...

4 minutes read.

C++ Forward Iterators

Iterators : Iterators serve as a link between algorithms and STL containers, allowing the data inside the container to be modified. They let you to iterate through the container, access and...

3 minutes read.

Similarities between C++ and Java

People who are preparing for software engineering roles must have come across either one of these languages because as all the companies do not accept python for hiring a fresher...

3 minutes read.

How to call a void function in C++

Generally, any function has two types: 1. Void function: It doesn't return any value. 2. Non-void function: It returns some value. Program to call a void function in C++ #include <iostream> using namespace std;  void check() {  ...

2 minutes read.

Multiset in C++

Introduction Multisets are part of the C++ STL, or Standard Template Library. In C++, a multiset is a set of associative containers that hold ordered items. Items in a multiset can...

10 minutes read.

Structure of C++ Program

Many people believe that C++, an object-oriented programming (OOP) language, is the finest language for developing demanding applications. A superset of the C language is C++. Java, a closely comparable...

4 minutes read.

ATM machine program in C++ using functions

Automated Teller Machines (ATMs) carry out daily financial transactions. They are straightforward and simple, allowing customers to complete self-service transactions quickly. ATMs can then be used to withdraw cash, deposit...

3 minutes read.

Converting string into integer in C++

When programming in C++, we'll frequently need to change one data type to another. When we use C++ to create apps, we must transform data from one type to another. When...

7 minutes read.

C++ File Handling

File handling is a mechanism that manipulates the data stored in files. File handling store output data from the program to external file and read file data to the program. There...

3 minutes read.

Hospital Management Project in C++

The following capabilities are required to build a hospital management project: These are as follows: hospitals' names, contact information, and lists of doctors and patients. Activities Supported Hospital Data Print Patients' data to...

4 minutes read.

Size_t Data Type in C++

In C++, the type to express the object size in bytes is defined as Size_t, an unsigned integer type offered by the standard library for describing the object's size and...

3 minutes read.

C++ int into String

Data type conversion is a standard editing process. You may need to convert variable from one type of data to another in a variety of situations. There are two ways...

5 minutes read.

C++ 11 vs C++ 14 vs C++ 17

C++ is a language that is used to create a high-performance application. C++ 11, C++ 14, and C++ 17 are the different version of C++. There are some differences between...

1 minute read.