Konstantin Narkhov
Pheix 0.8.96
@condemnedcell
konstantinnarkhov.pro

Notes about perl coding rules, pt.2

13 june, 2017

Requirements for names of functions

  1. Name should begin with lower case character;
  2. Name should consist of one or few significant words. These words should be describe the general purpose of function and order of arguments;
  3. First word is prefix. The prefix defines type of function  (see «Types of Pheix functions» below);
  4. Name should be in CamelCase style, i.e. every significant word in name starts with upper case letter;

Name prefixes should be defined by programmer, however for general-purpose functions programmer should use general-purpose prefixes (see «Types of Pheix functions» below).

Types of Pheix functions:

  • Render content (prefix show) – these functions contain print;
  • Create object in database (prefix creat) – these functions store data in database (module files);
  • Modify object in database (prefix modfy) – these functions modify data in database (edit/modify data in database tables);
  • Delete object from database (prefix del) – these functions delete data from database (from files, etc…);
  • Get data from database (prefix get) - these functions get (read) data from database (get data fields from tables, data rows from files, etc…);
  • Set data to database (prefix set) - these functions set (write) data to database;
  • Check value (prefix is) - these functions check data in database, files, etc… In general this prefix should be used for boolean functions.

Blog entries

Check out latest blog entries: most interesting stories about past events & activities.

Quick feedback

Letters and spaces only