Tags: #solidprinciple #solid #software #softdev #softwaredevelopment
Last Reviewed: 29/08/2024
PlaceOrder
class that handles stock verification, payment processing, and shipment violates SRP.StockAvailability
, ProductPayment
, and ProductShipment
.Logger
class that has if-else logic to handle different logging forms (console, file).ConsoleLogger
and FileLogger
that can be injected into the main EventTracker
class.Square
class inherits from Rectangle
but changes the behavior of inherited methods like set_width
and set_height
.Car
interface with methods like open
, start_engine
, and change_engine
that forces classes like Drive
and Mechanic
to implement methods they don’t need.EventTracker
class directly instantiating a ConsoleLogger
, creating high coupling.ConsoleLogger
) into the EventTracker
class.