wiki:Dev/DevPractices

Version 15 (modified by dmartinc, 3 years ago) (diff)

--

A. Development Process =

  1. Think before coding.
  2. Develop your module.
  3. Write tests using Indicop.
  4. Update the user documentation Dev/Doc.
  5. Write technical information in this wiki if needed.


B. Development Practices =

1. Basics =

  • Common Principles
    • First, learn Indico development style and workflow, then develop your module.
    • Follow and keep Indico layers: Main core, rh, pages, wcomponents, services.
    • As usual, no need to reinvent the wheel;
    • There's a library that does it? Use it (unless the cost of using it is higher than that of doing it yourself);
    • Use known design patterns as much as possible - patterns are a common language that allow us to better communicate ideas, and programming languages and libraries tend to follow them as well;
    • If it's not obvious, add a comment;
    • Use UTF-8 as encoding by default for every single file.
    • Please, don't commit any trailing white spaces (see Dev/GitWorkflow)! If using Eclipse, AnyEditTools can help to remove trailing white spaces in all kind of test files. See Tools for additional formatting help.
  • Python
    • Use always 4 white spaces instead of TABs!
    • Use consistent names for variables.
    • Comment always your classes and methods, even if they look trivial for you.
    • Use comments whenever you feel that people will not find out what a particular segment of code does just by reading it.
    • Try to follow the PEP08 when formatting your Python code.
      • Exception: historically variable names in Indico's Python are camelCase instead of using lower_case_with_underscores. The current development team still likes camelCase.
    • Speak Python language
    • Got new code? Pylint it before adding it to the repo.
    • There are several tools for Eclipse than can help you to properly format your code and use Pylint, see Tools for additional formatting help.
  • JavaScript
    • jslint your files as often as possible. It helps you prevent a lot of stupid mistakes. Emacs users have a nice jslint mode for that.

Version Control

Check the Git Workflow page.

  • Do not commit without writing any comment.
  • Comments should have the following format: [Commit type] message
  • Commit types:
    • [FIX] --> Bug FIXing...
    • [FTR] --> A new FeaTuRe?/functionality has been developed.
    • [IMP] --> Any kind of IMProvement: performance, usability, method, class, etc
    • [MIN] --> MINor modifications (nor features nor improvements) that are not needed to write on the release notes.
    • [REF] --> When there is some REFactoring in the code.
    • [DOC] --> any modification in the DOCumentation.
    • [ADD] --> when ADDing a new file (not code ones)
    • [DEL] --> when DELeting a file (not code ones)
    • [VER] --> Related with VERsion control/repository maintenance (branch creation, tags, rename, merge, etc)
  • If it is possible, use one type for each commit (not several types in one commit). So, it will be needed to commit each modification separately.
  • Do not remove the repository ;)

Security

75551 contains a presentation on the topic. Most of it is described by the Security Guidelines

HTML Specific Rules

  • Have Indico 100% HTML4.01 compliant (so far, this is an utopia for Indico...)