Thursday 26 May 2011 9:09:02 am - 17 replies

Introduction

In our continuous effort to open eZ Publish to both our community and professional partners, we have worked on establishing coding standards that will help uniformize how our software is written and organized.

Since you, community members, are contributing more and more to eZ Publish, by means of pull requests or extensions, it only makes sense to ask for your feedback before we publish a first version of these standards.

» Read full blog post

Author Message

Matthieu Sévère

Thursday 26 May 2011 11:46:07 am

Hello Bertrand,

Thank for this, that's VERY useful !

I'm a bit confused about conding standard on class name. You say that class name are Upper Camel Case with a prefix "ezp". But ezp doesn't begin with a capital so it's not Upper Camel Case ? 

Also you give an exemple "FooProvider::factory()" and it's not prefixed with ezp and is Upper Camel Case. So, is prefixed class with ezp only for internal used in eZSystems ? What should we use in extension ? Is a prefix needed ?

Cheers !

--
eZ certified developer: http://ez.no/certification/verify/346216

Yannick Komotir

Thursday 26 May 2011 12:08:26 pm

Hello,

Thank you for this big work ! What about //autogentag// in extensions ?

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

Bertrand Dunogier

Friday 27 May 2011 2:53:49 am

"

Hello,

Thank you for this big work ! What about //autogentag// in extensions ?

"

It is valid for extensions built by our build server, but won't be applied to community ones, as they're not built this way. This would require a completely different project I'm afraid :(

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Bertrand Dunogier

Friday 27 May 2011 2:58:18 am

"

I'm a bit confused about conding standard on class name. You say that class name are Upper Camel Case with a prefix "ezp". But ezp doesn't begin with a capital so it's not Upper Camel Case ? 

Also you give an exemple "FooProvider::factory()" and it's not prefixed with ezp and is Upper Camel Case. So, is prefixed class with ezp only for internal used in eZSystems ? What should we use in extension ? Is a prefix needed ?

"

About Camel Case, the standard is actually LowerCamelCase due to the prefix. It isn't an easy question, actually, but I would propose the following:

  • The class name, prefix ignored, uses UpperCamelCase
  • The prefixes for ezpublish are ezp (for ezpublish) and ezx (for ez extensions)
  • Community / Market extensions must use their own prefix, either based on the extension name or the provider name

So yes, ezp / ezx are to be reserved to eZ Systems, and a prefix is required for extensions. We will update this when we start using namespaces ourselves (soon !).

I'll update the document accordingly, thanks !

Oh, and the FooProvider class is of course a mistake, it will be fixed to ezpFooProvider :-)

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Bruce Morrison

Friday 27 May 2011 4:07:21 am

Looks good.

"Torough documentation"  should be "Thorough documentation"

No mention of line length?

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Bertrand Dunogier

Friday 27 May 2011 5:19:01 am

"

Looks good.

"Torough documentation"  should be "Thorough documentation"

No mention of line length?

"

Thank you for highlighting my english mistakes in huge black letters, Bruce, I'll fix this soon :-)

Did I really forget line length ? My god, thanks, todo list as well !

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Bruce Morrison

Friday 27 May 2011 5:57:08 am

Hey Bertrand

Opps. Sorry about the big back letters - cut n paste from the google doc.  Had assumed that they would be stripped on publishing since headings are not available in the OE toolbar. What else can be pasted into these???

Are there plans to create/release a php CodeSniffer rule set based on the standard?  

Cheers
Bruce 

Bertrand B

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Bertrand Dunogier

Friday 27 May 2011 6:05:54 am

"

Opps. Sorry about the big back letters - cut n paste from the google doc.  Had assumed that they would be stripped on publishing since headings are not available in the OE toolbar.

"

Hmmm headings ARE available in the OE toolbar, but not when replying in comments... maybe they're just removed from the UI but not from the supported XHTML? This wouldn't be surprising...

No offense taken anyway, it was kinda funny ;-)

"

Are there plans to create/release a php CodeSniffer rule set based on the standard? 

"

It is part of the plan, yes !

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Björn Dieding@xrow.de

Monday 30 May 2011 8:37:47 am

I don`t wanna use xdebug.... I am stuck with Zend Debugger :-)

So the doc should say should use a debugger.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Carlos Revillo

Monday 30 May 2011 12:16:50 pm

Hi there. Really great work!. 

A question. Are there any plans to apply this standards specially those related with phpdoc things to the actual code? or at least, do you think that contributions related to this (changing doxygen to phpdoc) will be helpful or do you prefer community member take care of other things? :)

thanks!

Damien Pobel

Monday 30 May 2011 1:32:56 pm

Hi Carlos,

The current approach is to change the comments format by small steps when working on a specific file/class/method (see this commit for instance) but as always, you are free (and welcome ;-)) to open some pull requests on this topic (and/or any other ;-))

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Bertrand Dunogier

Tuesday 31 May 2011 12:57:18 am

"

I don`t wanna use xdebug.... I am stuck with Zend Debugger :-)

So the doc should say should use a debugger.

"

Hehe, okay, I will make the title more generic, but Xdebug will still be recommended, as quite a lof of developers don't use a debugger at all, and we recommend Xdebug. Thanks ;-)

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Felix Woldt

Thursday 16 June 2011 2:55:19 am

Thank's for the standard.

I have a question about the the following convention:

"

>>

Files

Naming

Files MUST be named in lower-case, and MUST NOT use any separators (dashes, spaces,
underscores). PHP files MUST use the .php extension Template files MUST use the .tpl
extension.

>>

If i understood it right the following naming of a template is not allow anymore

because of "MUST NOT use any separator"

design/standard/override/templates/node/view/full/jac_folder_gallery.tpl

An other example you can see in github of our cjw_newsletter extension:

https://github.com/cjw-network/cjw_newsletter/tree/master/design/admin2/override/templates/node/view/full

or

https://github.com/cjw-network/cjw_newsletter/tree/master/design/admin2/templates

I don't think that this is a good idea. We heavily use underscores in tpl files to have a better overview / structure over the templates. The templates often have the same name as the related ez content class name s where you can use "underscores". The underscore is also used by ez in some php filenames e.g.

kernel/content/function_definition.php

or in a lot of tpl files

design/standard/templates/popup_pagelayout.tpl

 

My proposal is to change the text to:

"Files

Naming

Files MUST be named in lower-case, and MUST NOT use any separators (dashes, spaces) except
underscores. PHP files MUST use the .php extension Template files MUST use the .tpl
extension."

What do you think?

"

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Felix Woldt

Thursday 16 June 2011 5:34:06 am

Hi Bertrand,

what is about the coding standard for ez templates?

I think this should be included in the document, too.

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Donat Fritschy

Monday 20 June 2011 7:29:18 am

Hi Betrand

it seems to me that the heredoc exmple is misleading, as it WILL expand variables and such.

http://www.webmanufaktur.ch - Developers united in eZ Publish: http://www.cjw-network.com

Bertrand Dunogier

Wednesday 29 June 2011 6:59:45 am

"

I don`t wanna use xdebug.... I am stuck with Zend Debugger :-)

So the doc should say should use a debugger.

"

Made the paragraph more generic, thanks !

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Damien Pobel (eZ)

Thursday 28 July 2011 6:14:30 am

Those coding standard are on PHP code only, we should probably add some coding standards for HTML, CSS and above all JavaScript.

Cheers

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 17 2025 23:43:31
Script start
Timing: Jan 17 2025 23:43:31
Module start 'layout'
Timing: Jan 17 2025 23:43:31
Module start 'content'
Timing: Jan 17 2025 23:43:31
Module end 'content'
Timing: Jan 17 2025 23:43:31
Script end

Main resources:

Total runtime0.2976 sec
Peak memory usage6,144.0000 KB
Database Queries145

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 587.9219152.6250
Module start 'layout' 0.00480.0023 740.546939.4688
Module start 'content' 0.00710.2891 780.01561,209.1719
Module end 'content' 0.29620.0013 1,989.187550.3984
Script end 0.2975  2,039.5859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00311.0556160.0002
Check MTime0.00140.4742160.0001
Mysql Total
Database connection0.00080.261410.0008
Mysqli_queries0.157953.05551450.0011
Looping result0.00120.40571430.0000
Template Total0.274592.220.1372
Template load0.00220.727520.0011
Template processing0.272391.501320.1361
Template load and register function0.00010.041310.0001
states
state_id_array0.00100.325720.0005
state_identifier_array0.00100.348230.0003
Override
Cache load0.00230.78191510.0000
Sytem overhead
Fetch class attribute name0.00190.6470270.0001
Fetch class attribute can translate value0.00050.1625100.0000
class_abstraction
Instantiating content class attribute0.00010.0220340.0000
XML
Image XML parsing0.00471.5806100.0005
General
dbfile0.00210.6935640.0000
String conversion0.00000.002340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplforum_topic/full.tplextension/community_design/design/suncana/override/templates/forum_topic/full.tplEdit templateOverride template
18content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
40content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
16content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
8content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/header.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/header.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
6content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 110
 Number of unique templates used: 13

Time used to render debug report: 0.0001 secs