This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Development Guidelines
FABIANO Serge edited this page Dec 7, 2020
·
34 revisions
This Developer Guide is dedicated to developers working on the e-Mobility project It’ll help you to understand how to implement new features, the coding styles to follow, the design choices we’ve made so far.
Development environment is setup correctly.
Find below the golden rules that you have to go through for each PR:
- Do not stack several big PR in parallel on the same topic (eg. Car, Smart Charging...)
- Schedule a short technical meeting with me before you start a task
- Check the logs in production after each deployment and report to me before opening an issue
- Translate texts and maintain all i18n files + provide english translation for unknown languages (check same number of lines in all files too)
- Full translation in all languages occurs once a week and is handled by the responsible people (native speakers)
- Pick up a Small task, fix an Issue, enhance the Unit Tests or perform a QA test in the case you have finished your main task
- Do not copy/paste the code blindly, understand the purpose of every line of code you use
- Test each line of your code in the debugger!
- Code provided in Pull Request must be tested up by a Unit Test (create a new issue)
- Provide a short test case in your issue when moved to QA pipeline so anyone can test your feature
- Learn from your mistakes, be proud of them and do not make them again
- Do not mix implementation of different issues in one PR: 1 PR -> 1 Issue
- Comment your code if necessary to explain choices that are not self-explanatory
- Avoid tree of i18n in json doc (chargers.popup.error.title -> chargers.popup_error_title)
- Each front-end screen should trigger 1 or 2 calls max in the backend to retrieve and display the data
- Always think big, your code must scale: millions users, charging stations...
- Develop with production in mind: multiple instances of the same server, limited Memory/CPU, use of Locks...
- Keep the code readable, simple, self-explanatory (naming of classes/methods/vars) and try to avoid lengthy methods
- A Class/Method should be done for one and only one purpose (deleteUser() should not create a user, a Car class should contain only ca related method)
- Follow the logic in place, don't reinvent the weel (Hanlding of HTTP calls, DB access...)
- The code must be more appealing than the UI which should give the 'wow' moment to the users!
- Request only the necessary fields from the database (use of MongoDB $project)
- Maintain the REST endpoint documentation in the open-api-standard.json file when you create/change a REST endpoint
- Keep both Response Time and Data Volume low in the REST/OCPP/DB endpoints
- MongoDB requests should be returned by REST service without further data processing (use MongoDB $project)
- Check your MongoDB requests with the explain() method -> Should use an index
- Don't forget to move your task to the right pipeline when you have finished your work / requested changes
- Check authorisation and use canChange...(), canDelete...() to check authorizations instead of isAdmin(), isBasic()
- Follow the case standard when you create interface, constants... (e.g. interface is Pascal Case: MyInterface, variable in Camel Case: myVar...)
- Keep your branch or pull request up to date with master-qa on daily basis + retest the merged parts
- Don't break Angular module dependencies: transactions depends on shared module but never on charging-stations
- Use only relative path imports in TypeScript
- Test your implementation with different user's profiles (Basic, Admin, Demo, Site Admin)
- Check Tenant's component to enable/disable features in the front-end and the backend
- Maintain your absence in the shared calendar when you plan to be OOO (Charge-Angels holidays)
- Test the front-end with the debug console opened and check and fix any logged errors
- When you have finished your implementation run throught the golden rules before creating a PR