Тёмный

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

Code Decode
Подписаться 136 тыс.
Просмотров 86 тыс.
50% 1

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:
openinapp.co/u...
Course Description Video :
yt.openinapp.c...
Solid Principle Interview Questions part 2 : • Solid Principles Inter...
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
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : www.youtube.co...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
--------------------------------------------------------------------------------------------------------------------------------------
#solidprinciples #javainterviewquestions #codedecode

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
Далее
Se las dejo ahí.
00:10
Просмотров 2,5 млн
КОТЯТА В ОПАСНОСТИ?#cat
00:36
Просмотров 1,1 млн
SOLID  Principal - Interview Questions and Answers
24:04
SOLID Principles: Do You Really Understand Them?
7:04
Просмотров 179 тыс.