Coding Conventions

0 views
Skip to first unread message

dipesh

unread,
Jun 4, 2008, 2:20:22 AM6/4/08
to Nepal PHP Users Group
How important do you guys think the coding conventions are??
For me its the basic thing that every programmer should have in their
blood.. I cannot think of getting a programmer in my team who doesn't
follow any proper conventions...

I would like to hear what you guys think of it...

n' for those who are wondering what i'm talking about... can download
and have a look at the Conventions.pdf file (from Files section)...
its a basic conventions that we follow for php stuffs...

sarose

unread,
Jun 4, 2008, 3:23:39 AM6/4/08
to Nepal PHP Users Group
1. Underscore looks ugly. We need better approach to represent class
attributes.

2. The variable name with type info sounds like hungarian notation[1]
to me. It may lead to inconsistency when code is changed. Its good if
you know the type of variable, but
what if a programmer does not know the purpose of such variable ?
For at least interface class, we can use such convention.

3. I disagree allowing _ in filename. The filename should be same as
classname or common functionality name without _. lke

Class ZendLogAdapterInterface

As you know Zend is following exact underscore convention [2] but I
still prefer using Java style.

4. How constant should be declared. Its missing from the convention.

5. Coding Style is very important. I recommend using the Zend Coding
Style: http://framework.zend.com/manual/en/coding-standard.coding-style.html

PHP has became a kitchen sink of features grabbed from Java,
especially in OOP paradigm. We need to look in the Java coding
conventions and follow
the same if necessary. Guys, share you opinion.

--
Sarose

[1] About Hungarian Notation [ http://en.wikipedia.org/wiki/Hungarian_notation
]
[2] Zend Coding Convention [ http://framework.zend.com/manual/en/coding-standard.naming-conventions.html
]
Reply all
Reply to author
Forward
0 new messages