DEV Community

Cover image for The Most underestimated topic of the interview-OOPS Design Pattern.

Posted on

The Most underestimated topic of the interview-OOPS Design Pattern.

Hello there, I hope you and your loved ones are doing great in these unprecedented Times of COVID-19.

In this blog, I have tried to cover the OOPS design pattern, knowledge of which surely can place you ahead in the interview and not-Awareness about this can lead to rejection as well.

Let's get started!!!!

what's the Desing pattern and why it's so important???

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Design patterns have two major benefits.

1). Provide you with a way to solve issues related to software development using a proven solution. They isolate the variability that may exist in the system requirements, making the overall system easier to understand and maintain. 2). Design patterns make communication between designers more efficient. Software professionals can immediately picture the high-level design in their heads when they refer to the name of the pattern used to solve a particular issue when discussing system design.

Object Orientated Programming(OOP) System is one of the Desing patterns that most software engineers used to build a highly scalable service in a simple(Sober) and neat way.

So, what the heck is this OOPS??

Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts like

Objects,Classes, Inheritance,PolyMorphism, Encapsulation.... (Sounds a bit advanced...don't worry..just continue with the blog).

Object:- Any entity that has a state and behaviour is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical.

Class:- Collection of objects is called class. It is a logical entity.

A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space. Inheritance

Inheritance:- When one object acquires all the properties and behaviours of a parent object, it is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Polymorphism:-If one task is performed in different ways, it is known as polymorphism. For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc.

In Java, we use method overloading and method overriding to achieve polymorphism.

Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.

Abstraction:- Hiding internal details and showing functionality is known as abstraction. For example phone call, we don't know the internal processing.

In Java, we use abstract class and interface to achieve abstraction.

Encapsulation:- Binding (or wrapping) code and data together into a single unit are known as encapsulation. For example, a capsule, it is wrapped with different medicines.

A java class is an example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.

Advantage of OOPs over Procedure-oriented programming language

1) OOPs makes development and maintenance easier, whereas, in a procedure-oriented programming language, it is not easy to manage if code grows as project size increases.

2) OOPs provides data hiding, whereas, in a procedure-oriented programming language, global data can be accessed from anywhere.

In general programming style, global data can be accessed by any of the methods which leads to a security issue. OOPS provide security by just allowing access to global data to that method that is authorized to use it.(We use the getter and setter method to control this)

3) OOPs provides the ability to simulate real-world event much more effectively. We can provide the solution to real-world problem if we are using the Object-Oriented Programming language.

Thanks, I hope you enjoy my little tiny effort to bring back to the community. Plz, share if you found content inside it useful.

Top comments (0)