strike one against cakePHP
So I’m looking into the cakePHP framework, because, well why not. (for those not in the know cake is to php as rails is to ruby) Install is quite painless, but I’m still in the documentation, and I have already bumped into something that makes me cringe. The naming conventions require some classes to be singular, and some to be plural, and there is automatic translation between the the two. (I.E. you don’t declare where the singular class should look for the plural one, it just appends an s and goes to look for it) I’m sure some of you know that English is just not that regular a language.
This of course means there has to be a way to add exceptions
Cake’s naming conventions can be really nice – you can name your database table big_boxes, your model BigBox, your controller BigBoxesController, and everything just works together automatically. The way CakePHP knows how to tie things together is by inflecting the words between their singular and plural forms.
There are occasions (especially for our non-English speaking friends) where you may run into situations where CakePHP’s inflector (the class that pluralizes, singularizes, camelCases, and under_scores) might not work as you’d like. If CakePHP won’t recognize your Foci or Fish, editing the custom inflections configuration file is where you can tell CakePHP about your special cases. This file is found in /app/config/inflections.php.
In this file, you will find six variables. Each allows you to fine-tune CakePHP inflection behavior.
Ugg!! I can just imagine getting caught by this one as part of a learning curve and walking away from the whole damn framework because of it. But I guess this is one open manhole cover that I managed not to fall into.
3 Comments to strike one against cakePHP
Leave a comment
Pages
Archives
- April 2012
- March 2012
- January 2012
- December 2011
- November 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- March 2011
- February 2011
- January 2011
- November 2010
- May 2010
- March 2010
- January 2010
- December 2009
- October 2009
- September 2009
- August 2009
- July 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
Hey there. Actually, the “quirks” with naming conventions is really way less of a big deal than you’d think. Learning what goes where is pretty quick, and after that you don’t really think about it.
Cake also provides pretty easy ways to explicitly override the standard naming conventions when that becomes necessary, so you can always resort to that if all else fails.
I am currently creating my own Framework which will be suitable for ALL known programming languages. Obviously, this complicates matters. I have adopted the singular/plural concept in cakePHP to help me minimise the complexity of my Framework. The Framework also has methods that have gender specific prefixes and a built in debugger that automatically resolves all errors using the Future Perfect Tense.
Programmers can learn so much from natural languages.
I don’t have a name for the Framework yet. I’m hoping it will eventually name itself.
Wow Max,
That sounds like quite a project? Is it far enough along that there is some code you could float to me? I would be interested in hearing more about what your doing. with it.