Forums / General / eZ coding standards - some questions

eZ coding standards - some questions

Author Message

Piotrek Karaƛ

Wednesday 28 May 2008 9:08:37 pm

Hello everyone,

I would like to ask you about your opinions and experiences regarding coding standards that are used in the context of eZ Publish, and also a few questions to give an idea of what I am wondering about. I mostly thinking of PHP, template language and MySQL, but if something is missed out - probably as well.

1) Do you follow the coding standards introduced in eZ Publish? If yes, to what extent and for which parts/layers?
2) Which standards exactly do you follow? eZ Network, old documentation, or maybe just what you see and learn from the sources?
3) Do you see any advantages/disadvantages of following the standards that have been set (provided that they have)?
4) What do you like/dislike about those, or refuse to use?
5) Do you think anything will have to change when eZ Components make it into eZ Publish? Will the standards alter/get adjusted as we have more and more components incorporated?
6) How much of your overall code is actually eZ Publish related? If eZ Publish is not your only/major platform, do you have different standards for different applications, or maybe a general company standard guide?

The reason I am asking those questions is that as we grow and new developers join us, this debate on eZ coding standards pops-up again and again. It would be great to know how you've dealt it and of what importance you see it within your teams.

Thanks a lot!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bruce Morrison

Wednesday 28 May 2008 10:51:45 pm

Hi Piotrek

I've recently gone through the process of preparing an extension for eZ Network certification and one of the requirements is that the code matches the eZ coding standards.

It was difficult at first but you eventually get the hang of it (like most things). Most things are simple, but can be annoying if you used to something different. e.g. 4 spaces for indent, I usually use 2 and spaces around ( ) and after spaces after ',' in param lists.

I found that some of the examples and explanations, especially the template coding were not detailed enough and had to make a best guess in many situations.

I'm assuming that the eZ coding standards and the components ones are the same? Though I do note that the eZ ones want comments/inline docs in doxygen while I believe components use phpdoc.

if you are working with a framework that employs a particular coding standard then I think you have to use it even if it means you are using different coding standards with in your organisation.

I've advocated that the particular organisation I'm working for utilise the eZ coding standards for all new projects.

The guidelines I've been working to are found at
http://ez.no/services/eznetwork/development_guidelines

cheers
Bruce

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

Thomas Koch

Wednesday 28 May 2008 11:37:24 pm

You find the implementation guidelines for eZComponents here:

http://www.ezcomponents.org/contributing/coding_standards

They do not only constitute cosmetic rules like indentation and parenthesis style, but also gives a very good reading about best practices of naming and code organization.

I have recommended these guidelines to any programmer who wanted to improve his coding style.

---
Thomas Koch | http://koch.ro
YMC - eZ Publish in Switzerland | http://ymc.ch

eZ debug

Timing: Jan 19 2025 02:45:56
Script start
Timing: Jan 19 2025 02:45:56
Module start 'content'
Timing: Jan 19 2025 02:45:57
Module end 'content'
Timing: Jan 19 2025 02:45:57
Script end

Main resources:

Total runtime1.2203 sec
Peak memory usage4,096.0000 KB
Database Queries196

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.9531180.8359
Module start 'content' 0.00641.0973 769.7891591.7734
Module end 'content' 1.10370.1165 1,361.5625336.7500
Script end 1.2202  1,698.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3254210.0002
Check MTime0.00150.1229210.0001
Mysql Total
Database connection0.00080.069710.0008
Mysqli_queries1.151094.32751960.0059
Looping result0.00190.15541940.0000
Template Total1.190997.620.5954
Template load0.00170.137620.0008
Template processing1.189297.455020.5946
Template load and register function0.00010.007310.0001
states
state_id_array0.00120.095110.0012
state_identifier_array0.00060.052820.0003
Override
Cache load0.00140.1169320.0000
Sytem overhead
Fetch class attribute can translate value0.00130.103440.0003
Fetch class attribute name0.00110.086550.0002
XML
Image XML parsing0.00130.109140.0003
class_abstraction
Instantiating content class attribute0.00000.000550.0000
General
dbfile0.00250.2058340.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs