Re: Capitalization

Bharat Mediratta <[email protected]> Sun, 17 Mar 2013 09:06:46 -0700
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_=P3yM4bXLgyVU00yvfD7dnXncDJYRQ_xSNF=jPY-sbcQ@mail.gmail.com>
(cc devel)

If we don't do this now we may very well have to do it later which will
result in another large non-backwards-compatible event so let's do it now.
For the most part its an easy change to make for contributors...

-Bharat
On Mar 17, 2013 2:32 AM, "Shad Laws" <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> wrote:

> Hey Bharat,
>
> So, I sat down this morning with a cup of coffee, ready to move
> forward on this convention and start moving things around and making
> the transparent extension files...
>
> ... and then read a bit more and started scratching my head again.
>
> Apparently, the reason why it isn't totally clear in the Kohana docs
> is because it's new to 3.3, and half of the Kohana community is still
> confused and/or conflicted about it.  There's one camp, for whom the
> idea of lowercasing all filenames makes sense (and still works with
> Kohana::auto_load_lowercase()), and there's the other, for whom the
> idea of standardizing with PSR-0 like Symfony and Zend seems like the
> way to go.  Note that because the "big boys" have decided upon PSR-0
> and its case-sensitive and capitalized standard, they're considering
> putting a PSR-0-compliant autoloader in the PHP core in the future.
>
> So, it seems we have three options:
> 1. Keep our lowercase filenames *and* class names.  This helps
> backward compatibility, but as you pointed out might be awkward given
> how the system directory is built.
> 2. Keep our lowercase filenames, but capitalize many of the class
> names and use auto_load_lowercase().  This helps backward
> compatibility, but doesn't seem to be a very clean approach.
> 3. Make everything case-sensitive and capitalized.  This is in sync
> with the Kohana system directory, the decisions of Zend and Symfony,
> the PSR-0 autoloader, and (maybe) the future of PHP.  It's also the
> decision that's the least backward compatible.
>
> After spending more time researching and thinking about this, I'm
> inclined to reverse my position... if we're upgrading to K3, we may as
> well finish the rip-off-the-bandaid-quickly task and do what seems the
> most future-proof.  Thoughts?
>
> Take care,
> Shad
>
>
> On 17 March 2013 02:20, Bharat Mediratta <[email protected]> wrote:
> >
> > Sounds good to me.
> >
> >
> > On Sat, Mar 16, 2013 at 9:39 AM, Shad Laws <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> wrote:
> >>
> >> ...and it looks like, at least in the controller docs, they go so far as
> >> to require lowercase filenames:
> >>
> >> http://kohanaframework.org/3.0/guide/kohana/mvc/controllers
> >>
> >> Sent from my Swiss Army Phone
> >>
> >> On Mar 16, 2013 3:54 PM, "Shad Laws" <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> wrote:
> >>>
> >>> Yep, it's Kohana:
> >>> http://kohanaframework.org/3.3/guide/kohana/tips
> >>>
> >>> Sent from my Swiss Army Phone
> >>>
> >>> On Mar 16, 2013 3:30 PM, "Shad Laws" <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> wrote:
> >>>>
> >>>> Hey Bharat,
> >>>>
> >>>> I haven't investigated further just yet, but I suspect your guess is
> >>>> right: it's the Kohana autoloader that cares, not PHP.
> >>>>
> >>>> My current thought is that it seems it's largely a case of
> >>>> six-or-half-a-dozen.  In that case, I'm inclined to give the tie
> breaker to
> >>>> backward compatibility: if modules can still call
> ORM::factory("item"), then
> >>>> that's one less thing we break with contrib projects.  I think
> renaming the
> >>>> classes to be consistently capitalized is good (and will need to
> happen with
> >>>> contrib stuff, too), but I'm personally happy to keep the filenames
> >>>> lowercase.
> >>>>
> >>>> Thoughts?
> >>>>
> >>>> Take care,
> >>>> Shad
> >>>>
> >>>> Sent from my Swiss Army Phone
> >>>>
> >>>> On Mar 16, 2013 4:51 AM, "Bharat Mediratta" <[email protected]>
> wrote:
> >>>>>
> >>>>>
> >>>>> So I experimented with this a bit - and it turns out that models are
> >>>>> case sensitive in the ORM code.
> >>>>>
> >>>>> modules/gallery/classes/Model/item.php contains:
> >>>>>   class Model_Item extends ORM { }
> >>>>>
> >>>>> and is accessible with ORM::factory("item") but not
> >>>>> ORM::factory("Item").  Doesn't matter if you call the class
> Model_Item or
> >>>>> Model_item.
> >>>>>
> >>>>> So if we're going to be consistent with capitalization, we may need
> to
> >>>>> rename that file to Item.php and then refer to the model as "Item"
> in the
> >>>>> code.  Or we can leave it lower case and refer to it as "item".  Not
> sure
> >>>>> yet, and we don't have to decide now - just pointing it out.
> >>>>>
> >>>>> My guess is that this is an issue with the autoloader, because I
> >>>>> *think* that PHP is case insensitive when it comes to class names
> but I'm
> >>>>> not 100% sure.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Mar 15, 2013 at 5:23 PM, Bharat Mediratta <
> [email protected]>
> >>>>> wrote:
> >>>>>>
> >>>>>>
> >>>>>> Ah, I didn't see that and was following what I saw in the system
> >>>>>> directory.. which seems at odds with their style guide.  I think we
> should
> >>>>>> follow their code (ie capitalize file names) as opposed to their
> style guide
> >>>>>> since it'll be more internally consistent with what's already there.
> >>>>>> Thoughts?
> >>>>>>
> >>>>>>
> >>>>>> On Fri, Mar 15, 2013 at 5:04 PM, Shad Laws <shad-xpYdmXCiSuZWk0Htik3J/[email protected]>
> wrote:
> >>>>>>>
> >>>>>>> Hey Bharat,
> >>>>>>>
> >>>>>>> Started taking a look:
> >>>>>>> http://kohanaframework.org/3.0/guide/kohana/conventions
> >>>>>>>
> >>>>>>> and noticed that they recommend lowercase directory and filenames.
>  I
> >>>>>>> noticed you started changing them to capitalized... thoughts?
> >>>>>>>
> >>>>>>> Shad
> >>>>>>>
> >>>>>>> Sent from my Swiss Army Phone
> >>>>>>
> >>>>>>
> >>>>>
> >
>
>

------------------------------------------------------------------------------
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 ]