Solid Design Principle Interview Questions and Answers for fresher and experienced | Code Decode

preview_player
Показать описание
In this video of Code Decode we have covered Solid Design Principle Interview Questions and Answers for freshers and Experienced

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

SOLID Principles Covered with live demo. With steps on how to implement these in day to day life.

Why we need solid Principle?

The broad goal of the SOLID principles is to reduce dependencies so that engineers change one area of software without impacting others. Additionally, they’re intended to make designs easier to understand, maintain, and extend. Ultimately, using these design principles makes it easier for software engineers to avoid issues and to build adaptive, effective, and agile software.
they lead to better code for readability, maintainability, design patterns, and testability.

What are solid Principles?

The following five concepts make up our SOLID principles

Single Responsibility
Open/Closed
Liskov Substitution
Interface Segregation
Dependency Inversion

What is Single Responsibility Principle in solid principles?

It states that “One class should have one and only one responsibility”
Which specifically means - we should write, change, and maintain a class only for one purpose.
Change Class only when you need to change state of one particular object or instance
Example : POJOS follow SRP.
Suppose we have Employee and Address Class, If we want to change the state of Employee then we do not need to modify the class Account and vice-versa.
If you world have merged both as single POJO , then modification in one field for address (like state ) needs to modify and Whole POJO including Employee
Worst Design - which don’t follow SRP Hitting Database in POJO of Employee Class. That’s why we have service layer, DAP layer and Entities separated.

Why is Single Responsibility Principle IMP?

In Real world, Requirement changes and so does your code implementation to cater the changing requirement ,
The more responsibilities your class has, the more often you need to change it. To prevent frequent changes to same class,
Testing is easier - With a single responsibility, the class will have fewer test cases
Easier to Understand
Less functionality also means fewer dependencies to other classes.
So best practise says : Use layers in your application and break God classes into smaller classes or modules

What is Open/Closed Principle in solid principles?

It states that “Software components should be open for extension, but closed for modification”

The term “Open for extension” means that we can extend and include extra functionalities in our code without altering or affecting our existing implementation.

The term “Closed for modification” means that after we add the extra functionality, we should not modify the existing implementation.

In real world, You must have noticed that you change something to cater a new requirement and some other functionality breaks because of your change. To prevent that we have this principle in hand. It s one of the most imp concept in in solid principles

How to implement Open/Closed Principle in solid principles?

The application classes should be designed in such a way that whenever fellow developers want to change the flow of control in specific conditions in application, all they need to extend the class and override some functions and that’s it.

Example - created a pojo employee with id , name. now new functionality comes which says add Training location. your constructor will fail for employees who didnt do training. better extend employee class, name it Traineed employee then add constructor.

Code Decode Playlists

Subscriber and Follow Code Decode

--------------------------------------------------------------------------------------------------------------------------------------

#solidprinciples #javainterviewquestions #codedecode
Рекомендации по теме
Комментарии
Автор

Please add cqrs design pattern. I am big fan of your explanations.

abirchaudhary
Автор

Please try to upload the 2nd part of this videos ASAP. This is really helpful for the interviews and thank you so so much for the content. ❤💯💯

dhareppasasalatti
Автор

Mam really most valueable content which you are providing. And lastly please share the ppt content with us in the form or pdf or whatever you want so that we refer those later as well. Love and support from

mohdfahimsaad
Автор

Excellent, thanks again! 👍I was waiting for this topic from Code Decode ✌️

vulligadlarohith
Автор

Thanks for covering this
Yes please make a continuation on this

dpkpk
Автор

Why can’t we create one more parameterised constructor instead of creating new class for open/close principle?

sureshkumar-kqjm
Автор

Such a great informative explanations. 👍

dynamicdeveloper
Автор

Thank you for making this video.
In a recent interview, This question is asked to me.

suryanarayansubudhi
Автор

Please upload second part of this vedio.
It will be really helpful to understand SOLID in easy manner.
Thanks 👍

nandkishor_patil_
Автор

Thank you for clear explanation. Please cover other three principles also

bsarvani
Автор

Please create remaining part of this soon.... getting better understanding of concepts. Thank you so much

Rohit-yoik
Автор

It will be great, if you can explain the other 3 as well. Thanks.

SharifulIslam-nvdq
Автор

Good job !! Nice explanation of 2 solid principles for fresher and experience. Please make video for rest 3 . Waiting...

rahulshukla
Автор

With your every video lecture, I am getting some clarity that I didn't come to know, although practicing the same for a quality time. Thanks a ton again !!

When I saw title this time, I thought it's something irrelevant to me and was about to skip it. But fortunately, I started playing and then it's only you and your voice for next 15:50 minutes 😁😁

KumarGaurav-xDsoCH
Автор

This part was clear, well explained. Can you please provide link, if you have already done second part of this?
If have not done second 2nd part, can you please do it?

VoyageofLittleLiya
Автор

Thankyou for this video, Please make another video for other three remaining principle.

akhileshyaduwanshi
Автор

Hi madam, your explanation is good with suitable example, plz complete solid principles L, I and D

HkH
Автор

Nice explanation...Can you please upload the second part of it. Thank you!!

gauravjaiswal
Автор

Very well explained mam. Thanks a lot👍.

dnyaneshwarjadhav
Автор

Yes please complete all remaining solid principles.

pulkitkhandelwal