Solid Design Principle Interview Questions and Answers for fresher and experienced | Code Decode
ฝัง
- เผยแพร่เมื่อ 12 ต.ค. 2021
- 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/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
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 : th-cam.com/users/CodeDecode?...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
--------------------------------------------------------------------------------------------------------------------------------------
#solidprinciples #javainterviewquestions #codedecode
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. ❤💯💯
Sure we will upload it soon....
Please add cqrs design pattern. I am big fan of your explanations.
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 Indore.......
Excellent , thanks again! 👍I was waiting for this topic from Code Decode ✌️
Sorry for keeping you waiting. Will upload next part very soon 👍
Thanks for covering this Topic.....
Yes please make a continuation on this
Sure we will upload soon 👍👍
Please upload second part of this vedio.
It will be really helpful to understand SOLID in easy manner.
Thanks 👍
th-cam.com/video/zn2Sn7lMnLM/w-d-xo.html
Here you go 🙂👍
Thank you for making this video.
In a recent interview, This question is asked to me.
you are welcome suryanarayan
Such a great informative explanations. 👍
Thanks alot 🙂👍
Please create remaining part of this soon.... getting better understanding of concepts. Thank you so much
Publishing it today 👍👍🙂🙂
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 😁😁
🙂🙂Glad u found it helpful. Keep learning, keep rocking Man 👍👍
Thank you for clear explanation. Please cover other three principles also
Sure, we will post it next.
Good job !! Nice explanation of 2 solid principles for fresher and experience. Please make video for rest 3 . Waiting...
sure Rahul we will make it soon....
It will be great, if you can explain the other 3 as well. Thanks.
sure shariful we will create it soon
Why can’t we create one more parameterised constructor instead of creating new class for open/close principle?
yes we can, but what she explained is also a way
See here the principle is our code should not be modified but want to extend functionalities in it so using classes we can enable this principle we can wrap a code in structure,functions,interfaces,abstract classes and classes so on. Which of these concepts make your code actually support the respective principle,hope you got it
Thankyou for this video, Please make another video for other three remaining principle.
Sure next we will upload that 👍👍
Hi madam, your explanation is good with suitable example, plz complete solid principles L,I and D
sure we will complete it soon
please do the rest three! thanks!
Sure, we will upload that next 👍
Very Helpful !!!!
Thanks Manoj 🙂👍
Nice explanation...Can you please upload the second part of it. Thank you!!
We have it here
th-cam.com/video/zn2Sn7lMnLM/w-d-xo.html
Yes please complete all remaining solid principles.
sure pulkit we will make it
Ma'am pls make to video on other principles also.. your explanation gives good clarity to the concepts
sure ummar we will create it soon
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?
th-cam.com/video/zn2Sn7lMnLM/w-d-xo.html
Very well explained mam. Thanks a lot👍.
you're welcome
In that open closed example what I f we make another constructor with 3 parameters ie instead of separate class
Thanks!
Thanks Riya 😊
Thank you please cover the remaining too.
sure vengatesh we will make it soon
11:30 I have a doubt, Instead of creating another class, why can't we create a new constructor with that address parameter?
Good work
Thanks Nagaraj
Mam what is PoJo I can't understand what we meant by pojo
Pojo is plain old java objects, it's same as dto data transfer object,. As name suggests it's a simple java object nothing else 🙂👍
Why not class for EmployeeName in Single Responsibility?
Waiting for the rest three....
Sure Divanshu we will upload it next 👍👍
🙏🙏
🙂👍
👌🙏👍
🙂👍
HI Team,please make video on remaining things
Hi Venkat . Please check below link for part 2
th-cam.com/video/zn2Sn7lMnLM/w-d-xo.html
@@CodeDecode thanks lot
Interviewer asked me this today and I was unable to answer
It will very hard to create new class fir every field addition. Please help us to understand with service logic.
Part 2 please ?
th-cam.com/video/zn2Sn7lMnLM/w-d-xo.html
@@CodeDecode thanks
👍👍
Ur cursor is reminding something
the second log did not print the address 😄