Conversation
ArielleMurad
left a comment
There was a problem hiding this comment.
@Surohitt great job on this and thank you for taking the time to write this up! All of the explanations are very clear and to the point and your example with the animals is perfect for highlighting why Mixins and DIP are so important. I will definitely think about this design principle when writing code in the future!
| By dictating that both high-level and low-level objects must depend on the same abstraction, this design principle inverts the way some people may think about object-oriented programming. | ||
|
|
There was a problem hiding this comment.
I think it would be nice to have another example to illustrate this point. Your example below for Mixins already does a good job of this though so up to you! I personally learn most from reading through examples with code and seeing how these theories and principles can be implemented so in my opinion, the more examples the better 😉
There was a problem hiding this comment.
Great point! I might add a visual for this :)
Lee-Sutton
left a comment
There was a problem hiding this comment.
@Surohitt awesome work on this! Great use of examples in the mixins section! I only have one comment and a couple suggestions for typos but nothing major.
| Mixins are a special type of multiple inheritance. There are two typical situations that | ||
| require mixins: | ||
| 1. You want to add in a lot of features and/or methods for a class | ||
| 2. You want to use a particular feature and/or across many different classes |
There was a problem hiding this comment.
I think an important point to note is that a mixin should not hold internal state. It should only add functionality via methods or properties
There was a problem hiding this comment.
Great point, I might add a tiny section or list of points titled, what is a mixin?.
There was a problem hiding this comment.
Or maybe, what is not a mixin?
Co-authored-by: Lee Sutton <[email protected]>
Co-authored-by: Lee Sutton <[email protected]>
Co-authored-by: Lee Sutton <[email protected]>
Co-authored-by: Lee Sutton <[email protected]>
Co-authored-by: Lee Sutton <[email protected]>
I wrote up a little bit on the Dependancy Inversion Principle and how Mixins aid with the guidelines. Let me know your thoughts and if you think I got something wrong/missed something or would like to add in some notes!
@Surohitt please ignore this comment below I'm testing that we can link issues across the organization instead of just within the repo
Fixes: https://github.com/networks-for-change/product_scorecard/issues/1