Skip to main content

What is Abstraction ?

Code The major characteristics of oops are re usability and ease of usage. The ideas of oops include inheritance, abstraction, polymorphism, encapsulation, etc.

According to Richard Gabriel, abstraction is "the process of identifying common patterns that have systematic variations; an abstraction represents the common pattern and provides a way to specify which variation to use."

A parent class that permits inheritance but never allows for instantiation is known as an abstract class. One or more abstract methods from abstract classes don't have implementations. Inherited classes can specialize thanks to abstract classes.

/// C#
using System;
namespace AbstractionSample
{
public abstract class Bank
{
private float _account;
private float _amount;
public float Account
{
get
{
return _account;
}
set
{
_account= value;
}
}
public float Amount
{
get
{
return _amount;
}
set
{
_amount= value;
}
}
public abstract void CalculateAccount();
public abstract void CalculateAmount();
}
}
We can say in real time words,

Abstraction is the process of identifying and concentrating on a situation's or item's crucial attributes while excluding/filtering out the undesirable characteristics of that situation or object.Take a person as an example, then examine how that person is represented abstractly in various contexts.

* A doctor views the individual as a patient (abstract). The doctor is curious about a patient's name, height, weight, age, blood type, previous or present illnesses, etc.
* An employer views a person as an employee (abstract). Employers are interested in a person's name, age, health, educational background, employment history, etc.

You can see that the foundation of software development is abstraction. We can only define the fundamental components of a system through abstraction. Modelling (or object modelling) is the process of determining the abstractions for a certain system.

In the aforementioned scenario, the doctor might not be interested in personal traits that the employer is, and vice versa. Both an employer and a doctor are unlikely to be interested in all of a person's traits, such as the clothing they choose to wear on a certain day, the foods they consume, their family, etc. However, some factors (like name, age, height, etc.) are the same for the doctor and the employer. This shared characteristic allows for generalization. In other words, if we omit enough specifics from an abstraction, it becomes sufficiently generalized to be used in a variety of contexts.


Comments

Popular posts from this blog

OOP Concept with Real Time Examples

A design philosophy is OOP. Object Oriented Programming is what it stands for. In contrast to outdated procedural programming languages, object-oriented programming (OOP) employs a separate set of programming languages. In OOP, everything is categorised as self-sustaining "objects". As a result, you achieve re-usability using the four core concepts of object-oriented programming. Programmes are organised around objects and data rather than action and logic in the object-oriented programming (OOP) paradigm.    Let's use your "Leg" as an example to grasp the object orientation clearly. The class "Leg" is one. Left and right legs are objects of type Leg on your body. A series of electrical impulses supplied through your body parts (through an interface) are what manage or control their primary functions. As a result, the body part serves as an interface between your body and your legs. The Leg is a well-designed class. The attributes of the Leg are m...

Windows Application Development - Dotnet Environment Basic understandings

The development life cycle for creating Windows desktop applications using the .NET framework typically involves several stages. Here's an overview of the typical life cycle: Requirement Analysis: Gather and analyze the requirements for the Windows application. Understand the business needs, user expectations, features, and functionalities that the application should have. Design: Create a design for your application's user interface (UI) and overall architecture. Decide on the layout, controls, navigation flow, and other visual aspects. Plan the data storage mechanisms, database schema, and integration with other systems if necessary. Development: Begin coding the application using the .NET framework. Use programming languages like C# or VB.NET. Create classes, forms, controls, and implement the business logic. You'll work on creating the UI, handling user interactions, data processing, and any required integrations. Testing: Thoroughly test the applicatio...

Web API - ASP DOTNET, MVC

We will attempt to grasp what a Web API is in this post, as well as the fundamental elements of a Web API project. HTTP is a potent foundation for creating REST-compliant APIs that expose services and data. Almost any platform can use the HTTP library. An excellent framework for developing RESTful applications is the ASP.Net Web API.A wide range of clients, including browsers, mobile devices, and desktop programmes, are served by the Net Framework. Although WCF may be used to create RESTful services as well, there are two key arguments in favour of Web API usage among users. The inclusion of ASP.NET Web API in ASP.NET MVC clearly increases the use of the TDD (Test Data Driven) approach in the creation of RESTful services. RESTful services can be easily developed utilizing web APIs whereas WCF still requires a lot of configuration settings, URI templates, contracts, and endpoints. MVC creating Web APIs is supported natively by ASP.Net core. Applications' ability to communicate wit...