| Re: Coding Standards |
| by zyspec on 2009/3/21 23:32:01 what about things like MymoduleMyClassAllTopics This is a legitimate CamelCaps class name according to the documentation but wouldn't work. More practically "real life" examples would include virtually any 'handler' class and a class like MymoduleMediaUploader. It looks like most module developers have not used CamelCaps except as you indicate ucfirst... Just trying to understand if we should use MymoduleMyClassName or MymoduleMyclassname as the 'preferred' class naming nomenclature. |
| Re: Coding Standards |
| by trabis on 2009/3/21 22:02:52 ucfirst($dirname) . ucfirst($name) Like MymoduleMyclass. Looks fine to me. |
| Re: Coding Standards |
| by zyspec on 2009/3/21 21:56:38 Not sure I should post this here, but it is related - please feel free to move it if it should be somewhere else. Looks to me like there's a bug in the XoopsLoad class if CamelCaps is the recommended naming nomenclature (Xoops 2.3.2 and beyond, as of 3062 revision). XoopsLoad->load($name,$type) converts $name to lowercase and then re-capitalizes the first name of the class so it would incorrectly change a CamelCaps class name to just a ucfirst classname. For example it would change 'MymoduleMyClass' to 'Mymodulemyclass'. It should find the ./class/myclass.php file correctly but it won't find the actual class. Unless I'm missing something - which IS likely
|
| Re: Coding Standards |
| by Mamba on 2009/3/9 20:47:48 Trabis, good catch. I simply printed it from the Web to PDF, but obviously the alignment didn't work. I corrected it manually in this attached document. |
| Re: Coding Standards |
| by trabis on 2009/3/9 18:48:35 Pdf has some alignment bugs, you should check the correct way of align arrays there. I do think that coding standards are very important, and must be respected by those who are committing to core. There are some old areas that are not clean yet, but the recent core changes are as good to read as poetry. Got to love XOOPS (and phppp)! |