
Explore the SOLID principles in Java to write code that is understandable by humans by using real-world examples, solving problems with code, and refactoring to improve readability and maintainability.
Apply the single responsibility principle (SRP) by ensuring a class has one responsibility and one reason to change, as shown by a hospital example with doctors, nurses, and receptionist.
this lecture demonstrates solid principles using Java by applying SRP, showing how an average calculator can delegate sorting to a separate sorter or to a dedicated sort class to keep one logic per class.
Explore applying the single responsibility principle in an e-commerce UI by separating product data from availability logic, using a dedicated service to decide buy or notify based on backend checks.
Explore the single responsibility principle by building a Java palindrome counter that counts palindrome words in a sentence, with a simple reverse-check method and a clear srp-focused design.
Examine how the palindrome counter applies the single responsibility principle by splitting the sentence into words, counting palindrome words, and detecting palindromes as separate concerns, with refactoring for change.
Refactor the palindrome counter by applying SRP, extracting sentence splitting into a sentence splitter class and a palindrome checker, and wiring dependencies to enable single responsibility.
Illustrate how the refactored palindrome counter enforces the single responsibility principle by separating sentence splitting, palindrome checking, and counting, and ensure changes affect only the relevant class.
Learn the open for extension and closed for modification principle (OCP) and how to extend functionality without modifying existing code. Explore a real-world Eclipse plugin example that shows seamless integration.
Learn how the open-closed principle guides designing a Java username validator that supports future requirements without modifying existing code. The video illustrates evolving validation rules, tests, and maintainability considerations.
Explore applying the open/closed principle to username validation by splitting logic into separate validator classes and orchestrating them via a shared interface in a single username validator.
In this OCP example, improve the username validator with early loop exit when a validator fails, and add null-safe checks before length and contains calls to prevent null errors.
Examine why the palindrome counter is not ocp compliant and how future requirements demand extending behavior without modifying the source, highlighting tight coupling with the palindrome checker and sentence splitter.
This lecture demonstrates making a palindrome counter OCP compliant by introducing a word checker interface with palindrome and pneumatic implementations, and a sentence splitter interface with a delimiter-driven basic splitter.
Explore how the open-closed principle applies via the strategy design pattern, with a big logic orchestrating small logic implementations using an execute method.
Identify where OCP applies and design a general, interface-based solution that extends functionality with new strategies without modifying existing code.
Explore the Liskov substitution principle (LSP) and proper subtyping in Java, showing how replacing a type with its subtypes must produce no side effects, illustrated by a glasses analogy.
Demonstrate how to follow lsp in java by ensuring proper behavioral subtyping, avoid breaking lsp and ocp, and illustrate with type d, type1, type2, and type3 and e methods.
Demonstrates how overriding a method to do nothing or throw an exception breaks the Liskov Substitution Principle, illustrated by country-specific employee management, including freelancers where promotion is not applicable.
Apply the Liskov Substitution Principle by structuring a clean inheritance hierarchy that separates permanent and non-permanent employee management, avoiding unrelated methods in a single class.
Explore LSP and subtyping guidelines through an airline discount example, contrasting guaranteed and itinerary-based discounts, and showing how proper method overriding avoids empty implementations or exceptions.
Set up a Java project for airline, include time and logging libraries, and implement passenger and itinerary pojos with fields name, passport id, travel date, price, and flight number.
Compute the guaranteed discount for a booking by extracting the month from the booking date and retrieving the monthly discount from a map or database.
Develop a default discount calculator in Java for an airline scenario, computing total, guaranteed, and itinerary discounts using the current date, while illustrating integration with external APIs via placeholders.
Apply preconditions to validate itinerary and future travel date before discount logic executes. Enforce postconditions to guarantee non-zero, sensible discounts and provide a guaranteed discount retrieval method.
Explore the LSP airline example by implementing an invoice generator that computes the net amount payable using the default discount calculator, logs all amounts, and enforces preconditions and postconditions.
Apply lsp by introducing a children discount calculator that extends the default discount calculator, selects the appropriate discount formula for itineraries with children, and enforces preconditions and postconditions.
Understand how strengthening preconditions in a subtype breaches LSP, as shown by the airline discount calculator example, and how weakening may align behavior with business rules.
Analyze how weakening post conditions in a subtype breaks the Liskov Substitution Principle, via the AirLand example with discount calculator and invoice generator, and note that strengthening is allowed.
Explore the invariant guideline under LSP and learn what invariants are, i.e., constraints that must not change, illustrated by not modifying a list and by BST insertion properties.
Explains the Liskov Substitution Principle through an invariant guideline with a discount calculator example, showing how a subtype must preserve the supertype invariants to avoid side effects.
Explore how guideline four of the LSP history constraint bars subtypes from state changes that the supertype forbids, illustrated by the default discount calculator and a violating child calculator.
Explore how the LSP history constraint prevents state changes to the guaranteed discount and guides safe subclassing by preserving supertype behavior and using private fields.
Explore how invariance and history constraint relate in LSP, showing history constraint as a subset of invariant and guiding state changes for supertypes and subtypes.
Master LSP by ensuring behavioral subtyping: a subtype must replace its supertype without changing behavior. Follow guidelines to prevent side effects and note possible OCP interactions.
Explore the interface segregation principle and thin interfaces in Java, showing how concrete classes implement interfaces and runtime binding uses a DB interface with Oracle DB.
Adopt interface segregation by providing separate interfaces for different interaction needs across devices. Ensure implementations depend only on the relevant methods to avoid ISP violations and related LSP issues.
Explore how interface segregation improves a payroll system by clearly separating salary, reimbursements, incentives, and bonus logic for permanent and temporary employees, engineers and managers, including contractual and freelancer cases.
Explore the dependency inversion principle, differentiate high level and low level modules via abstractions, and examine source code dependency trees and their downsides like propagation, deployment impact, and tight coupling.
Apply dependency inversion to decouple high and low level modules through abstractions and interfaces, reducing coupling, deployment, and cascading dependency issues in large Java applications.
Learn why the dependency inversion principle inverts source code and runtime dependencies, using abstractions and interfaces to align dependency directions and improve architecture.
Explore how the dependency inversion principle guides a palindrome counter by using interfaces for sentence splitting and word checking, ensuring high-level modules depend on abstractions rather than details.
Compare how interface-driven designs can comply with OCP while violating DIP. Use Java examples like sorters and calculators to highlight dependency inversion in practice.
Overview :
This course explains everything on SOLID principles starting from scratch & shows how one can follow these principles in JAVA. The course starts from basic examples, and then moves to more advanced examples. In this journey, the course also shows how developers tend to violate these principles unintentionally -- this knowledge is important because when you know the mistakes of other developers, you will not do it. The course also shows how violating one principle can lead to the violation of another principle.
SOLID stands for -
Single Responsibility Principle (SRP)
Open Closed Principle (OCP)
Liskov Substitution Principle (LSP)
Interface Segregation Principle (ISP)
Dependency Inversion Principle (DIP)
Prerequisite :
Core JAVA
Eclipse
Course features :
Course assumes no prior knowledge on SOLID principles
Course covers all the principles in detail starting from zero
Course also relates these principles to our daily lives to show how these are being followed around us
Course walks through a variety of different code examples
Course has lots and lots of discussions and reasoning around these principles
Course shows the instances where developers unintentionally violate these principles
Course also talks about how violation of one principle can lead to violation of another principle
Course explains the concepts with appropriate diagrams and figures making it easy and fun to understand
Why should you buy this course ?
This course would simply change the way you write code. You will start feeling the difference yourself after completing the course.