lkchamara / sweet-stock

sweet-stock
0 stars 0 forks source link

Breaking SOLID principles #1

Open lkmadushan opened 4 years ago

lkmadushan commented 4 years ago

https://github.com/lkchamara/sweet-stock/blob/9f613da6b880f44ec62405b2474b4e20ef8b8466/src/SweetStock.php#L16

This class is still open for modification, Let's say your manager is asking you to add another item and that item quantity value never changing over the time. to add this feature you have to update this class again.

https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

lkchamara commented 4 years ago

@lkmadushan Removed Business logic from the construct & move it to Item Class.