I can see a lot of programmers reading that article and scratching their heads and wondering if "separation of concerns" or MVC is really worth it. The first sample shows DB I/O, control logic, and HTML in just one file. Strait forward and easy to read.
As the code evolves to finally using the "twig" template engine, the code is split into several files, and grows substantially in size. Some must wonder if maintainability is actually improved.
You're still left with a mixture of DB I/O, control logic, and Browser I/O in multiple files. The "separation of concerns" is not pure, so to speak.
CGIDEV had an HTML template interface back in 1998. PHP seems to be struggling with separation of concerns in 2013.
-Nathan
________________________________
From: Eric Lehti <elehti@xxxxxxxxxxxxxxxxxx>
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxx>
Sent: Thursday, March 21, 2013 3:47 PM
Subject: [WEB400] PHP coding styles; Procedural versus Model-view-controller (MVC)
I received an email from iprodeveloper.com saying this link to paid
content is temporarily unlocked for all to read. I find it interesting
and want to share with you. Enjoy.
http://www.iprodeveloper.com/article/application-development-tools/jumps
tart-php-productivity-websmart-699592
Discusses PHP coding styles:
- Procedural Pros and Cons, with Comparison to procedural RPG. UI is
often intertwined with the coding logic-a poor design strategy.
- Advantage of separating UI from business logic. separates the UI
from the business logic.
<snip> SoC stands for separation of concerns, which is just a fancy way
of saying "keep your programming logic separate from your user
interface." The SoC philosophy is exemplified by Model-View-Controller
(MVC) development. One can make a case that RPG green-screen programs
were using MVC design long before it became popular in web application
development. The RPG code is the model (and parts of it are the
controller, too) and the Display file is the view
As an Amazon Associate we earn from qualifying purchases.