Six golden rules in php5.5


Six golden rules in php5.5

There are six golden rules in php to maintain large project.

  1. In a single  php  file, we never write more than one class at a time. Out of the scope of that class, we will not write any procedural code.

       2.      We will save any class with a proper naming convention. For example we
will save the file where we place the Emailer class introduced earlier in this
chapter as  class.emailer.php. What benefits can you achieve using this
naming convention? Well, without going inside that file, you are now at least
confirmed that this file contains a class named “Emailer”.
3.     Never mix the case in filenames. It creates ugly application structure.
Go ahead with all small letters.
4.     Like classes, we will save any interface as interface.name.php , Abstract  Abstract
class as  abstract.name.php, and Final class as  and Final class as final.name.php.
We will always use Camel case while naming our classes. And that means
the first letters of the major part is always a capital letter and the rest are
small letter. For example a class named “arrayobject” will be more readable if
we write ArrayObject.

5.     While writing the name of properties or class variables, we will follow the
same convention.

6.     While writing the name of a method, we will start with a small letter and
then the rest are camel case. For example, a method to send an email could be
named as sendEmail.

Advertisements
About

myself pramodh kumar yet another php developer from India and have worked on oops,procedural,yii framework,codeigniter,wordpress,joomla,api and more.

Tagged with: , , , , , , ,
Posted in Six golden rules in php5.5

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow php tutorial on WordPress.com
categories
Calendar
December 2013
M T W T F S S
« Nov   Jan »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
Follow me on Twitter
Blog Stats
  • 74,620 hits
%d bloggers like this: