From the course: Java Refactoring Best Practices

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

SOLID principles

SOLID principles

- [Instructor] It's time to look at the SOLID principles of object-oriented design and how to apply them in Java code. SOLID is an acronym for five guidelines for designing maintainable and scalable object-oriented software. They provide a framework for designing software that's flexible, extensible, and easy to maintain. I'm going to explain them briefly first and then I'll show you some code examples with and without the best practices applied. The S is for single responsibility principle. This means a class should only have one reason to change because it only has one responsibility. The O is for the open/closed principle. This entails that software entity should be open for extension but closed for modification. The third letter, L, stands for the Liskov substitution principle. This means that subtypes should be substitutable for their base types. The I is for interface segregation principle. This comes down to…

Contents