Document, document, document...
It can not be overstated, you need to document your code. The first level of documentation should happen in your Wiki, newsletter, rss feed, or what have you.
It needs to be some sort of public form of communication that is official and most of your clients will see and take note of it. In this publication you should:
It needs to be some sort of public form of communication that is official and most of your clients will see and take note of it. In this publication you should:
- State clearly what is being deprecated
- State why it is being deprecated
- If there will be a replacement method, you should link to the documentation of that method
- Give a time frame for the deprecation process
Example:
Our Notify component will be deprecated. It is being replaced with our Alert component. Please see our Alert docs for how to implement. The Notify component will be removed upon the next major release 2.0.0, we are currently in 1.4.6 release. Release 2.0 is scheduled be live during the 3rd quarter this year. We will keep you updated if anything changes on this channel.The next place to document the changes is in the projects readme markdown file in your repository. Call out that the component will be deprecated during the next major release. Again, we will want to provide a link to any replacement components.
Finally we want to document this change in the component's code. We should place a very noticeable comment at the top of the file restating when and how this component will be deprecated.
Use Logs to notify the Developers
Having the console spit out a log in production code is generally frowned upon, but this is one of the cases that it is highly advised to use it, well sort of, you want to have some code to detect the environment and only log to the console if the application is in development and not production. With a Node environment we can do that using webpack. see the example below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
if (process.env.NODE_ENV === 'development') { | |
// eslint-disable-next-line no-console | |
console.warn( | |
`The "Notice" component has been deprecated. Please considering updating to the "Alert" component. See: https://repo.url.com/jacob/alert.md` | |
); | |
} | |
} |
No comments:
Post a Comment