
Clean Code: SOLID - Beau teaches JavaScript
video description
Date: 2022-03-14
Related videos
Comments and reviews: 7
movax20h
There are few problems with this video.
First these are PRINCIPLES, not RULES. As such you can't label things as BAD and GOOD. More like BETTER and WORSE. Or RECOMMENDED and DISCOURAGED. There are always situations where you need to ignore some principles, or say stop, and know at which point to say stop to making everything to adhere to principles to every last details. The problem with following some of these principles, is that the code and setup on a caller side is bigger than in your -BAD- examples, as such it can be actually BAD. One of the examples would be cryptographic libraries. You often want to restrict extensibility or dependency injection abilities, because it makes it easier to mess things up leading to unsecure system. There are many other situations in general code.
Also, you can make Square be a child class of Rectangle, as long as you put only read only properties / actions into interface, and the modifiable ones into constructor. There are few other options that will still adhear to the L principle, without creation of Shape interface.
reply
There are few problems with this video.
First these are PRINCIPLES, not RULES. As such you can't label things as BAD and GOOD. More like BETTER and WORSE. Or RECOMMENDED and DISCOURAGED. There are always situations where you need to ignore some principles, or say stop, and know at which point to say stop to making everything to adhere to principles to every last details. The problem with following some of these principles, is that the code and setup on a caller side is bigger than in your -BAD- examples, as such it can be actually BAD. One of the examples would be cryptographic libraries. You often want to restrict extensibility or dependency injection abilities, because it makes it easier to mess things up leading to unsecure system. There are many other situations in general code.
Also, you can make Square be a child class of Rectangle, as long as you put only read only properties / actions into interface, and the modifiable ones into constructor. There are few other options that will still adhear to the L principle, without creation of Shape interface.
reply
crazylegs85
From what I understand, dependency injection is more about not having 'hidden' dependencies within the function that is being called, but rather explicitly state what dependencies are used. This helps with testability (mocking/stubbing). By injecting the dependency or class you can easily create an object that will give you the behavior or state that is being tested. In the example in the video, the function call is changed to determine the type of protocol used to perform the request. However, you still use different classes in the function that's being called without the ability to mock them and hence only test the actual logic behind your request. Another side benefit of injection is speed. Your tests will run faster if they have a 'canned' answer ready rather than use the actual service (implementation).
reply
From what I understand, dependency injection is more about not having 'hidden' dependencies within the function that is being called, but rather explicitly state what dependencies are used. This helps with testability (mocking/stubbing). By injecting the dependency or class you can easily create an object that will give you the behavior or state that is being tested. In the example in the video, the function call is changed to determine the type of protocol used to perform the request. However, you still use different classes in the function that's being called without the ability to mock them and hence only test the actual logic behind your request. Another side benefit of injection is speed. Your tests will run faster if they have a 'canned' answer ready rather than use the actual service (implementation).
reply
saharis
You gave a bad example for the Liskov Sibstitution principle, the goal is to sibstitute the Parent class with child class but it needs to work on the reverse direction also, and it is not going to work
reply
You gave a bad example for the Liskov Sibstitution principle, the goal is to sibstitute the Parent class with child class but it needs to work on the reverse direction also, and it is not going to work
reply
Forgoroe
I think I'd rather have the good way of doing things first, then the bad. I'm afraid my brain will somehow stick with the bad just cause it was explained first. Scumbag brain
reply
I think I'd rather have the good way of doing things first, then the bad. I'm afraid my brain will somehow stick with the bad just cause it was explained first. Scumbag brain
reply
Anthony
Sorry Beau, that's not a good example of Open/Closed. What if I want to add the ability to delete flavors? O/C is more about extending functionality, not data manipulation.
reply
Sorry Beau, that's not a good example of Open/Closed. What if I want to add the ability to delete flavors? O/C is more about extending functionality, not data manipulation.
reply
Bootstrapper
SOLID seems like an antipattern. Lol is this just super old fashioned? if you did this you would end up with thousands of classes.
reply
SOLID seems like an antipattern. Lol is this just super old fashioned? if you did this you would end up with thousands of classes.
reply
sdsdsdfsdf
At 6:30 you say that Im able to substitute squares and rectangles? How is it possible if square no longer extends rectangle?
reply
At 6:30 you say that Im able to substitute squares and rectangles? How is it possible if square no longer extends rectangle?
reply
Add a review, comment
Other channel videos















