Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Third-Party Extension Certification Program
 
winans_fred
Sr. Member
 
Total Posts:  83
Joined:  2007-09-06
 

Well done, Roy, et al.  Magento Connect is a great idea!

This is a great step in the right direction to ensure a healthy support community for Magento.  I wanted to raise the question, however, of a certification program for third-party extensions.  Part of the ongoing challenge with open source (as we all understand) is maintaining a level of quality in third-party work.  Anyone who has worked with OSCommerce can attest to the helter-skelter nature of that package. 

Knowing this, I propose a criteria is set forth by which all third-party developers can pattern their extensions to ensure a higher level of quality in the final product.  It would certainly be a selling point for developers looking to make the switch to open source technologies.

Your thoughts?

Fred

 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

I agree 100%.

 
Magento Community Magento Community
Magento Community
Magento Community
 
RoyRubin
Enthusiast
 
Avatar
Total Posts:  968
Joined:  2007-08-07
Los Angeles, CA
 

Certification is something that will happen. We are still unsure of the format (for example; what modules will qualify for certification, how much time we can spend on it, compensation, etc.). I do expect this to be part of the process for a subset of the commercial contributions. Once the details are finalized we’ll post them up for feedback.

Great idea and thank you for posting this question.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ibn Saeed
Jr. Member
 
Total Posts:  25
Joined:  2007-09-01
UAE
 

Hello

I agree 100% with dsgnfred. Presently, im with oscommerce and I know the hassle working with contrib modules. THough i know php , its not a problem but for those who are not used to customising or developing through php, it is a problem.

It would be great to have Certification for 3rd party addons etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ross
Guru
 
Avatar
Total Posts:  336
Joined:  2007-08-31
Scarborough, North Yorkshire, UK
 

Having worked with the Drupal CMS for quite a while (for which there is a very large community of developers and users, and a very large amount of contributed ad-on modules and themes), I can attest to the importance of being able to filter out the good quality modules.  In fact I have just spent all morning trying to find good quality Drupal modules suitable for a current project, and it’s regrettable that there are no tools to aid me.

While I think certification is a good idea, and has it’s place, I also think it is important to be able to rate and sort the quality of contributed add-ons.  For example: popularity (number of downloads), ratings and reviews, development activity, or even a combined score from these elements (a quality rating, so to speak).

Also if you document coding standards, it may be possible to write a program to check that a contribution meets the coding standards

 
Magento Community Magento Community
Magento Community
Magento Community
 
winans_fred
Sr. Member
 
Total Posts:  83
Joined:  2007-09-06
 

Great thought, Ross.  I agree.  And I like the idea of validating code well-formedness based on a spec defined by Varien.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ibn Saeed
Jr. Member
 
Total Posts:  25
Joined:  2007-09-01
UAE
 

Hello

Roy you might want to take a look at how Moodle handles contributions.

It explains the coding style, database style etc.
Development Coding Guidlines

Interface Guidlines

Short snippet from there page on how they have laid it out

*General rules

All code files should use the .php extension.
All template files should use the .html extension.
All text files should use Unix-style text format (most text editors have this as an option).
All php tags must be ‘full’ tags like <?php ?> ... not ‘short’ tags like <? ?>.
All existing copyright notices must be retained. You can add your own if necessary.
Each file should include (require_once) the main config.php file.
...

*Coding style

1. Indenting should be consistently 4 spaces. Don’t use tabs AT ALL.

2. Variable names should always be easy-to-read, meaningful lowercase English words. If you really need more than one word then run them together, but keep them short as possible. Use plural names for arrays of objects.

GOOD: $quiz
GOOD: $errorstring
GOOD: $assignments (for an array of objects)
GOOD: $i (but only in little loops)

BAD: $Quiz
BAD: $aReallyLongVariableNameWithoutAGoodReason
BAD: $error_string

3. Constants should always be in upper case, and always start with the name of the module. They should have words separated by underscores.

define("FORUM_MODE_FLATOLDEST"1);

4. Function names should be simple English lowercase words, and start with the name of the module to avoid conflicts between modules. Words should be separated by underscores. Parameters should always have sensible defaults if possible. Note there is no space between the function name and the following (brackets).

function forum_set_display_mode($mode=0{
         
global $USER$CFG;
         
         if (
$mode{
             $USER
->mode $mode;
         
else if (empty($USER->mode)) {
             $USER
->mode $CFG->forum_displaymode;
         
}
     }

5. Blocks must always be enclosed in curly braces (even if there is only one line). Moodle uses this style:

if ($quiz->attempts{
         
if ($numattempts $quiz->attempts{
             error
($strtoomanyattempts"view.php?id=$cm->id");
         
}
     }

6. Strings should be defined using single quotes where possible, so that less memory is used.

$var 'some text without any variables';
     
$var 'with special characters like a new line '."\n";
     
$var 'a very, very long string with a '.$single.' variable in it';
     
$var 'some '.$text.' with '.$many.' variables '.$within.' it';

7. Comments should be added as much as is practical, to explain the code flow and the purpose of functions and variables.
**Every function (and class) should use the popular phpDoc format. This allows code documentation to be generated automatically.
**Inline comments should use the // style, laid out neatly so that it fits among the code and lines up with it.

/**
     * The description should be first, with asterisks laid out exactly
     * like this example. If you want to refer to a another function,
     * do it like this: {@link clean_param()}. Then, add descriptions
     * for each parameter as follows.
     *
     * @param int $postid The PHP type is followed by the variable name
     * @param array $scale The PHP type is followed by the variable name
     * @param array $ratings The PHP type is followed by the variable name
     * @return mixed
     */
     function forum_get_ratings_mean($postid$scale$ratings=NULL{
         
if (!$ratings{
             $ratings 
= array();     // Initialize the empty array
             
if ($rates get_records("forum_ratings""post"$postid)) {
                 
// Process each rating in turn
                 
foreach ($rates as $rate{
     
....etc

Database structures

1.Every table must have an auto-incrementing id field (INT10) as primary index. (see IdColumnReasons)
2.The main table containing instances of each module must have the same name as the module (eg widget) and contain the following minimum fields:
*id - as described above
*course - the id of the course that each instance belongs to
*name - the full name of each instance of the module
3.Other tables associated with a module that contain information about ‘things’ should be named widget_things (note the plural).
4.Table and column names should avoid using reserved words in any database. Please check them before creation.
5.Column names should be always lowercase, simple and short, following the same rules as for variable names.
6.Where possible, columns that contain a reference to the id field of another table (eg widget) should be called widgetid. (Note that this convention is newish and not followed in some older tables)
7.Boolean fields should be implemented as small integer fields (eg INT4) containing 0 or 1, to allow for later expansion of values if necessary.
Most tables should have a timemodified field (INT10) which is updated with a current timestamp obtained with the PHP time() function.
8.Always define a default value for each field (and make it sensible)

 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

@Ibn Saeed:  Something like that for Magento would be wonderful!  Although, I don’t agree with that particular style, but that’s just my opinion.  wink I’m not sure why anyone uses spaces for indentations instead of tabs.  Tabs are a million times faster when writing code.  Also, can some of the programmers here explain this style of code to me?

if ($quiz->attempts{
if ($numattempts $quiz->attempts{
error
($strtoomanyattempts“view.php?id=$cm->id");
}
}

I see it all the time (with and without indentations).  The part that boggles me is putting the first brace on the same line as the if/function/whatever.  It makes it nearly impossible to follow large nested code blocks and loops.  I would write it like this:

if ($quiz->attempts)
    
{
    
if ($numattempts $quiz->attempts)
        
{
        error
($strtoomanyattempts“view.php?id=$cm->id");
        }
    }

Million times easier to follow!  But just my opinion of course.  tongue laugh Whatever style Varien likes to use for Magento, that’s what I will use for any contributions I release.  Consistency is a big part of quality.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ibn Saeed
Jr. Member
 
Total Posts:  25
Joined:  2007-09-01
UAE
 

@i960

Actually, I used ”quote” instead of “code” tags when I posted. I did it becuase the “code” tag displays the content in a very small font, or maybe its just on my side.

I have reverted back the tags from ”quote” to “code” and now you can see what it really means.

 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

I figured the indentations were removed by using the quote tag.  I’m talking more about the locations of the braces.  I like them to line up, but yet I see most people write it the way you showed.  I’ve just never understood that style at all.  Unless you are working with an IDE that highlights code blocks, it makes it extremely difficult to keep track of.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ibn Saeed
Jr. Member
 
Total Posts:  25
Joined:  2007-09-01
UAE
 

@i960, sorry for the misunderstanding.

Since its an idea of how moodle works, maybe Varien can come up with their own coding guidlines as my post was just an example.

They can proceed from here as its easier to know where to start

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mik3e
Jr. Member
 
Avatar
Total Posts:  27
Joined:  2007-09-29
 

I also absolutely agree with the idea of a coding standard and something like quality ensurance…
I´m developing extensions for OS Systems for years now, and that´s really the biggest problem with OS Extension (also in Typo3 for example).

I think the following definitions would help all developers to keep on track:

- code definitions
- clear directory structure
- UML / ERD (if possible)

Another big challenge is the interaction between different third party modules… But I think this would be much easier with the MVC structure of magento.

Greetings from Vienna,
Ciao,
Mike

 
Magento Community Magento Community
Magento Community
Magento Community
 
YoavKutner
Guru
 
Avatar
Total Posts:  491
Joined:  2007-08-08
 

Aside form small differences like usage of short tags, space between concatenation operator and some other small differences, we pretty much follow the Zend Framework PHP Coding Standard. This can be found here: http://framework.zend.com/manual/en/coding-standard.html

Thanks

yoav

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

I am an advocate for following the Zend Coding Standard - and seeing as magento is based on zend framework it makes a lot of sense. I am not a fan of short tags however - have seen badly written code that has a mix of both, that if the server has not been setup to allow causes a lot of headaches. Glad to see that people are starting to think about a standard though smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
webdesign_zmb
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2007-11-04
Berlin
 
YoavKutner - 02 November 2007 08:05 AM

..., we pretty much follow the Zend Framework PHP Coding Standard. This can be found here: http://framework.zend.com/manual/en/coding-standard.html

Hey Hello,
that is really good that there is a fix definition of things ... otherwise coders like we and you can not focus on the mainpart we always have to get the grip of the thoughts and structure…

Good job !!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matti Ressler
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2007-09-05
Australia
 

Short tags should be nuked oh oh

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2