Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Liskov substituion (SOLID) example should accept constructor params #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DavidVujic opened this issue Jan 30, 2017 · 1 comment
Closed

Comments

@DavidVujic
Copy link
Contributor

The good example of the Liskov Substitution principle in the SOLID section is doing a switch case to set the width/height/length of the shapes. Perhaps they should accept parameters on instantiation (constructor)? The switch (or setters for width/height/length) would not be necessary if so.

Here's an example, also rewritten as functions (even less syntax):
https://github.com/DavidVujic/clean-code-javascript#liskov-substitution-principle-lsp

@DavidVujic
Copy link
Contributor Author

PR (with classes): #182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants