Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

Conventions

Ivan Kleshnin edited this page Sep 9, 2015 · 17 revisions

Motivations for some words

  • add: "create user" sounds controversial)
  • detail: "read" is a confusing name
  • remove: "delete" sounds irreversible which the action shouldn't be

REST API

  • index: GET /api/robots/
  • add: POST /api/robots/
  • add-or-edit: PUT /api/robots/:id
  • update: PATCH /api/robots/:id
  • detail: GET /api/robots/:id
  • remove: DELETE /api/robots/:id

Frontend actions

Index

  • fetchIndex: fetch data for index page
  • loadIndex: fetch or load cached data for index page
  • establishIndex: accept current URL as index page (makes sense for URL bound components only)

Item

  • fetchItem: fetch data for item page (edit, detail...)
  • loadItem: fetch or load cached data for item page (edit, detail...)
  • establishItem: accept current URL as item page (makes sense for URL bound components only)
  • addItem: add item
  • editItem: edit item
  • removeItem: submit removal form or click remove link

Imports

Use extended module names:

Wrong: import Router from "react-router", let less = require("gulp-less");
Right: import ReactRouter from "react-router", let gulpLess = require("gulp-less");

It's tempting to use short names but very soon they begin to conflict with common variable names (all that gulp plugins zoo) and modules of your own application (e.g. app-router vs react-router). Trust me, you'll get this. Be wise and consistent: use extended module names throughout all your code.

Clone this wiki locally