-
Notifications
You must be signed in to change notification settings - Fork 12
General coding practices
General coding practices for TMW Umlimited by @mrmartineau
Working with 3rd party dependencies (from npm, Nuget etc) is common, but we need to ensure that all developers have a shared understanding about how and when they should be used in our projects. This includes choosing from a list of our recommended dependencies; if and when to modify 3rd party dependencies; and
Not all dependencies are equal. Some have bugs, some are insecure and some are untested. How are you to know when to safely use a particular dependency?
- If you're not sure, ask them.
- If they have worked on a similar problem, find out how they achieved it even use some of their code where necessary.
- If no one on the team has solved the problem before, we recommend searching the websites below use your best judgement but before you settle on your choice, double-check with another developer before you commit to the choice.
Your programming language will determine the best course of action.
For front-end dependencies, we use npm there are a number of ways to find dependencies on npm:
- Search npm itself: https://www.npmjs.com/
- Search npms.io - npms exposes a number of useful metrics beyond the standard npm search
- Search js.coach - js.coach curates all the packages on there, so you can be sure that whatever it is that you are looking for, you will get a good result.
- Search GitHub - hopefully dependency is on npm, although some dependencies are not. If you are definitely going to depend on GitHub, be absolutely sure that you are making the right choice.
- Search Nuget from within Visual Studio or the Nuget website
- If its an Umbraco project, search the Umbraco website
Each technology will have their own recommended dependencies. Please find them in the documentation for each technology, e.g. Javascript, React, CSS.
The general rule is to 🚫 NEVER 🚫 modify a 3rd party dependency without a VERY good reason for doing so. If you are modifying a dependency, you have to notify all other team members on the project and document it clearly in the codebase (where the module is used) and in the project documentation.
Rather than writing everything from scratch and always choosing a 3rd party dependency, it is often wise to publish your own module so that future projects can make use of your efforts.
To be completed by @JP