-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add guidance for monkey patching #355
Conversation
This LGTM! |
index.bs
Outdated
A <dfn export>monkey patch</dfn> layers new functionality on top of an existing specification in a way that extends, overrides, or otherwise modifies the underlying specification's behavior. | ||
Monkey patching <strong>is considered bad practice and should be avoided</strong> for the reasons listed below. | ||
|
||
An example of monkey patching would be: specification A defines an algorithm to do something, then specification B overrides or modifies that algorithm with some new functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of monkey patching would be: specification A defines an algorithm to do something, then specification B overrides or modifies that algorithm with some new functionality. | |
An example of monkey patching would be: specification A defines an internal algorithm part of its capability, then specification B overrides or modifies said algorithm with functionality directly, not using publicly defined extension points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The abstract example is a bit confusing to the reader as it almost implies that no spec should extend another spec. My proposed change could be a good start to make the text a bit explicit. Ideally, we will have examples from the past to illustrate what a monkey patch is and why it is bad. We should also clarify the difference between monkey patching (bad) and modularization (good). Maybe also link to https://en.wikipedia.org/wiki/Monkey_patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. My main suggestion is to use the same words throughout for things so it's crystal clear they're about the same thing.
Co-authored-by: Anne van Kesteren <[email protected]> Co-authored-by: Rossen Atanassov <[email protected]>
@atanassov wrote:
I'll linked to the guidance.
I'd like to not call out any one spec, but even the example that was originally there is now broken for exactly the reasons we mention in this section: The Web Manifest spec doesn't no longer uses WebIDL, just for starters 🤦♀️
I added some preliminary text.
Linked.. |
Co-authored-by: Amy Guy <[email protected]>
Co-authored-by: Daniel Appelquist <[email protected]>
Co-authored-by: Lea Verou <[email protected]>
Co-authored-by: Lea Verou <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and @plinss with the changes
Co-authored-by: Anne van Kesteren <[email protected]> Co-authored-by: Rossen Atanassov <[email protected]> Co-authored-by: Amy Guy <[email protected]> Co-authored-by: Daniel Appelquist <[email protected]> Co-authored-by: Lea Verou <[email protected]> Co-authored-by: Peter Linss <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]> Co-authored-by: Rossen Atanassov <[email protected]> Co-authored-by: Amy Guy <[email protected]> Co-authored-by: Daniel Appelquist <[email protected]> Co-authored-by: Lea Verou <[email protected]> Co-authored-by: Peter Linss <[email protected]>
Closes #184
Preview | Diff