Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why are so many PHP 5.3 frameworks like this ignoring namespaces.

    class Admin_Controller extends Base_Controller
Seriously, someone thinks this is OK?


Laravel makes extensive use of namespaces.

The omission of namepaces in the case of controllers was a calculated decision. PHP's implementation of namespaces is... inadequate, and would have required annoying workarounds, so prefixing controllers was the better evil.


How is PHP's namespace implementation inadequate? Use-as statements are the staple of every PHP library that uses namespaces, and this seems like a half-measure to placate less-experienced programmers.


Sounds more like the skills of the dev involved are inadequate quite frankly.


Base_Controller is an optional controller in Laravel placed between the main Controller and the controllers you create. Normally you'll just extend the main Controller which is namespaced;

<code>class Admin_Controller extends Controller</code>


Why would you need a class name like "admin_controller" if you are using namespaces?


Laravel looks nice but I agree the internal/default naming conventions and structures are a bit odd for 2012. Hopefully this will be changed in an upcoming version.


What naming conventions specifically don't you like?


I guess it is mainly the fact that it's not using CamelCase for directories, all lower-case filenames, underscores in methods and class names (_Task).

I am re-building a project in Laravel right now that I started with Slim, using a couple of Symfony components and own code and it's a bit of a turn-off for me that I ended up with quite mixed naming conventions now.

With so many PSR-0 compliant PHP libraries and Composer on the rise, I just think it's the way to go. This doesn't stop me from trying Laravel though and so far this is the only thing that kind of bugs me. But don't get me wrong, basically I really like it so far.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: