Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jani Hartikainen's Blog:
You don’t need a service layer: Fat controllers are okay
May 23, 2011 @ 13:42:15

Jani Hartikainen has a new post to his blog today about why, in your framework-based applications, it's okay to have "fat controllers" instead of a service layer.

Here’s a counterpoint to the currently popular view of "fat controllers are bad", and the current fad of everyone and their cousin implementing service layers: You don’t need one. Fat controllers are okay too.

He starts by explaining the "why you don't need a service layer" part, mentioning that keeping it in the controller keeps things simple and keeps your code from having to go through extra hoops just to work correctly. He also points out that, just because he recommends "fat controllers" doesn't mean he's advocating code reuse. In fact, just the opposite:

It’s fine if you code your things in the controllers, but there comes a point when you should stop that. The moment you realize you’re duplicating your code, stop and refactor. This is one of the very basics of software engineering: Avoid duplication by creating functions and classes.
tagged: service layer fat controller opinion complexity kiss

Link:

Lukas Smith's Blog:
KISS my...
Jun 10, 2008 @ 17:53:58

Lukas Smith recently posted about issues he's been coming across with the "KISS" mentality (and code) that the Zend Framework implements, specifically for the Zend_Feed component.

Now that I am actually using the Zend Framework on my first project, hitting bugs/limitations in Zend_Feed and therefore looking at the code, I must say I am seeing feature duplication with internal PHP features that does not quite fit in with the KISS principle.

He points out a few things that illustrate his point - the use of Zend_Http_Client instead of a strea context, passing XML contents into loadXML instead of just load. As a replacement, he's considered a Feed component from the eZ components system, but it hasn't been released (officially) yet. So, as an alternative, he's come up with a patch to fix a few things in the Zend_Feed component to make it a bit more KISS-friendly.

tagged: kiss simple zendframework ezcomponents feed parse xml patch

Link:


Trending Topics: