Re: Gallery's K3 class name/dir/file conventions (was "Capitalization")
Bharat Mediratta <[email protected]> Thu, 21 Mar 2013 20:40:15 -0700
| Newsgroups | gmane.comp.web.gallery.devel |
|---|---|
| Message-ID | <CAESa+_nDXprx1BS2BN8T8R0-Yck5G4ZVSE0Fc7mN9P1t76FVcA@mail.gmail.com> |
Thanks for the detailed analysis. I love the creativity - this is not a direction I would have come up with, but it makes a lot of sense. I'm not sold on it, though because it adds some inconsistencies: 1) Having a new/separate location for PHP classes doesn't make a lot of sense unless you understand the internals of Kohana::find_file, etc. 2) The standard approach isn't O(n^2) unless I'm severely misunderstanding - if you try to load a class like Controller_Admin_Tags it'd expand to modules/*/classes/Controller/Admin/Tags.php so it'd do N file_exists calls, not N^2. It should be the same for TagEvent, etc. 3) Capitalization is now different for the files under modules/*/gallery (we could change that of course) 4) Files under modules/*/gallery/rest have underscores in them, which has a significant meaning now in K3 so that'd be confusing I think your approach is creative, but I think it breaks too many of the existing conventions. You convinced me with your original argument - let's be consistent and have simple rules. Regarding the case sensitivity, I agree with you that it'd be nicer to have lowercase module names. Mapping those to filenames is pretty straightforward and we don't have to employ any fallbacks - remember, in an opinionated system you're supposed to have opinions! With creative use of ucfirst and split we can do simple transforms on module names into expected filenames. Some examples: foo -> Foo -> modules/foo/classes/FooEvent.class foo-bar -> FooBar -> modules/foo-bar/classes/FooBarEvent.class That doesn't seem too complicated. I propose that we *try* to do it the K3 way first. If we hit too many problems, I'm open to adding a new convention, but I'd rather do that as a last resort to keep things simple and consistent. What do you think? -Bharat ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar __[ g a l l e r y - d e v e l ]_________________________ [ list info/archive --> http://gallery.sf.net/lists.php ] [ gallery info/FAQ/download --> http://gallery.sf.net ]