Prev | Current Page 79 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

In either case, the golden rule to follow is be
consistent in the way you code. Commenting your code is another good practice that improves the long-term
maintainability of your code.
Naming conventions refer to many elements within a project, simply because almost all
of a project??™s elements have names: the project itself, files, classes, variables, methods, method
parameters, database tables, database columns, and so on. Without some discipline when naming
all those elements, after a week of coding, you won??™t understand a single line of what you??™ve
written.
When developing TShirtShop, we followed a set of naming conventions that are popular
among PHP developers. Some of the most important rules are summarized here and in the
piece of code that follows:
??? Class names and method names should be written using Pascal casing (uppercase letters
for the first letter in every word), such as WarZone.
??? Public class attribute names follow the same rules as class names but should be prepended
with the character ???m???. So, valid public attribute names look like this: $mSomeSoldier.
??? Private class attribute names follow the same rules as public class attribute names,
except they??™re also prepended with an underscore, such as in $_mSomeOtherSoldier.
??? Method argument names should use camel casing (uppercase letters for the first letter
in every word except the first one), such as $someEnemy, $someOtherEnemy.


Pages:
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
mimre.benton.pl Biuro księgowe Lublin Fundusze Emerytalne petrozawodzkich.waw.pl zakłady bukmacherskie