Testimonials  >

We have addressed under the recommendation of company "Fotomir-Vigoros" to company "ControlStyle". We are very pleased with the choice. Employees of company "ControlStyle" are young creative and modern people. They are the true pros on the...

DASS-Ekaterinburg,
Khilay V.

Articles  >

Technologies  >  Ours stadards of coding

The programming part of any internet project is performed using the PHP (Version 4) programming language. Developing any project one should follow the next ideological rules:

  • Compliance. It is necessary to avoid applying new functions that appear in the late versions of PHP until these versions will be accepted by the most of hosting servers.
  • Transferability. It is also necessary to check if the language extensions (which are not used by default) are present before engaging any function referring to corresponding extension or do not use the given function at all.
  • Modularity. When developing a project using PHP programming the modularity should be kept, that means dividing the basic logic programs from additional functions and procedures; group final by its general function (for e.g. file module, database module, rendering form module and so on).
  • Genericity. Applied during the development modules and functions should be reusable (applicable for future projects). Thus the code repetition will be avoided.
  • Code readability and understandability. When code-writing the accepted company source code standard should be followed (look below), and difficult code parts should be commented in English or Russian.
  • The structure of project folders. When using a complex project folder structure the folder name and its assignment should be well-defined.
  • Separation content from presentation. In case of internet project developing there must be a strict separation between content and presentation (formatting).

The standards of source code formatting.

  1. The source programming code is formatted in any text editor supported by UTF-8 code. When entering the source code it is not allowed the tabulation emulation with space symbols. The company accepted border tabulation is 4 symbols.
  2. When developing programming modules it is essential to point the date and time of last editing and also it's copyright.
  3. The level of inputted program logical blocks can be demonstrated in the text of the program with the help of tabulation symbols. First level blocks shouldn't have any border. Logical separation between code blocks is allowed by entering one blank string between them.
  4. The comments explaining the work of complex code blocks should be made with the help of commenting symbol "#". It is not allowed to comment strings with the help of symbol "//" sequence.
  5. Symbols "{" and "}" which are used in classes, cycles and conditional operators should always be applied starting from the new string.
  6. The names of variables, classes and functions should be written with Latin letters in the low counter. Symbol "_" is allowed in the name.
  7. The constant names should be written only in Latin letters. Symbol "_" is allowed in the name.

Correct code sample:

define('THIS_SITE', 1);

# if type of element is text, file, password or combobox
if (in_array($this->type, array('text', 'file', 'password', 'combobox')))
{
    # if there is a symbol '#' we establish a flag of new line
    if (substr($lbl, strlen($lbl)-1, 1) == '#') $this->set_var('label_self_line', 1);
}
else
{
    # reset a flag of new line
    $this->set_var('label_self_line', 0);
}

← To technologies list

Last projects:  Contact lens, Ekaterinburg

Back to top© 2017 ControlStyle, web site development. All rights reserved.
Web site promotion and advertising.