pimf-framework icon indicating copy to clipboard operation
pimf-framework copied to clipboard

Increase OOP, reduce hard coupling, improve internal APIs, etc.

Open garrettw opened this issue 7 years ago • 4 comments

This issue is mainly to track development on these topics. I'll be tagging this issue in my commit messages.

Classes to be converted from static to OO:

  • [ ] Pimf\Application
  • [x] Pimf\Config
  • [x] Pimf\Param
  • [ ] Pimf\Util\Header\ResponseStatus
  • [ ] Pimf\Util\Header
  • [x] Pimf\Logger

Classes that need hard class references to be replaced with dependency injection:

  • [ ] Pimf\Application
  • [x] Pimf\Environment

Internal APIs that need improvement:

  • [ ] Pimf\Cache::factory() and Pimf\Session::factory() -- would like to get rid of the switch statements by unifying the signatures of each storage type constructor as much as possible

Methods with too many params:

  • [ ] Pimf\Error::native()
  • [ ] Pimf\Controller\Base::__construct()
  • [ ] Pimf\Cookie::put()
  • [ ] Pimf\Cookie::forever()
  • [ ] Pimf\Request::__construct()
  • [ ] Pimf\Util\Uploaded::__construct()

Reduce complexity:

  • [ ] Pimf\Application::run()
  • [x] Pimf\Logger
  • [ ] Pimf\Util\Validator
    • [x] has duplicate code in lengthBetween() and valueBetween()
  • ~~Pimf\Controller\Core::initCliAction()~~

Remove usage of exit/die:

  • [x] Pimf\Application lines 102 and 261
  • [x] Pimf\Error line 38
  • [ ] Pimf\Response line 144
  • [ ] Pimf\Util\Header lines 69, 83, 97, 103, 134, 233

Consider better names for functions:

  • [x] Pimf\Session\Storages\Storage::id() -> newId()
  • [x] Pimf\Uri::is() -> matches()
  • [x] Pimf\Url::to() -> make()
  • [x] Pimf\Url::toAsset() -> makeForAsset()
  • [x] Pimf\Util\Character::is() -> matches()
  • [x] Pimf\Logger::init() -> checkInit()
  • ~~Pimf\Util\Validator::ip()~~

Improve adherence to ADR pattern in:

  • [ ] Pimf\View
  • [ ] Pimf\Controller\Base

garrettw avatar Jun 11 '17 20:06 garrettw

@garrettw is the checklist above up to date?

gjerokrsteski avatar Jun 24 '17 08:06 gjerokrsteski

Yes, I've been making those changes in my master branch, and adding new checklist items as I come across other things that need doing.

garrettw avatar Jun 24 '17 17:06 garrettw

I am looking forward to it and am very excited :-)

gjerokrsteski avatar Jun 26 '17 13:06 gjerokrsteski

Me too. I originally wanted to build my own framework, and I still do, but I think it will be easier to start with this existing project which is already similar to what I would want.

garrettw avatar Jun 26 '17 14:06 garrettw