Last active
May 1, 2018 00:36
-
-
Save andrewmclagan/2578f887a3486e6b241b832631c007e2 to your computer and use it in GitHub Desktop.
Style of naming and namespacing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
|-------------------------------------------------------------------------- | |
| Class has function only | |
|-------------------------------------------------------------------------- | |
*/ | |
use App\Criteria; | |
$jobs = $repository | |
->addCriteria(Criteria\Jobs\Approved::class) | |
->addCriteria(Criteria\Jobs\Recent::class) | |
->where('deleted_at', '!=', null) | |
->find(); | |
/* | |
|-------------------------------------------------------------------------- | |
| Class has function and domain | |
|-------------------------------------------------------------------------- | |
*/ | |
use App\Criteria; | |
$jobs = $repository | |
->addCriteria(Criteria\ApprovedJobs::class) | |
->addCriteria(Criteria\RecentJobs::class) | |
->where('deleted_at', '!=', null) | |
->find(); | |
/* | |
|-------------------------------------------------------------------------- | |
| Class has function, domain and namespace | |
|-------------------------------------------------------------------------- | |
*/ | |
use App\Criteria\ApprovedJobsCriteria; | |
use App\Criteria\RecentJobsCriteria; | |
$jobs = $repository | |
->addCriteria(ApprovedJobsCriteria::class) | |
->addCriteria(RecentJobsCriteria::class) | |
->where('deleted_at', '!=', null) | |
->find(); | |
####################### | |
# Which one do you think is more fluent? | |
####################### |
I don't like the duplication in the last option
yeah i was option A as well
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think option A