CodepadME / laravel-tricks

The source code for the Laravel Tricks website
http://laravel-tricks.com
MIT License
966 stars 298 forks source link

Why is controllers not in Tricks? #19

Closed andheiberg closed 10 years ago

andheiberg commented 10 years ago

Why did you choose not to place controllers in the Tricks namespace?

stidges commented 10 years ago

This is a decision made for the architecture. Controllers are the glue between the request and the domain layer. As the Tricks namespace represents the domain, it didn't feel right placing the Controllers (which do not actually belong in the domain) under that same namespace

andheiberg commented 10 years ago

Yeah, that was also the only reason I could come up with.

I guess you are right that controllers are not domain specific, I just find i weird, as I usually would have controllers in Tricks. I guess you are right that a line needs to be drawn, otherwise why shouldn't routes, filters, config, etc. be in Tricks.

The main reason I go with a namespace for the project is that it makes autoloading services, repositories, serviceproviders etc. easier. So moving controllers to Tricks wouldn't really conflict with my goal.

I don't know :) just rambling here.

stidges commented 10 years ago

Seems fair enough, though remember that Composer accepts an unlimited amount of autoloading directives. Like the Controllers namespace in this project is also psr-0 autoloaded. Just saying that if you can seperate it and keep the architecture a little cleaner, why shouldn't you :)

andheiberg commented 10 years ago

Yeah I'm aware :)

Just never thought about it.