I’m working on rearchitecture/refactoring of a couple projects right now, one which requires support for custom modules and provides for quick and easy modification by non-experts, and another which is a bit straightforward, with an emphasis on scaling.
In doing these redesigns, looking at existing frameworks and application designs obviously helps. I’m not vehemently against frameworks, but I have found most of them to myself generally reluctanct in their use because even the best designed impose conceptual and organizational constraints which oftentimes mitigate any potential productivity gains. So yes, I’m a ‘library’ guy in that sense. However, that doesn’t mean I’m against frameworks, just that I haven’t found one that is for me naturally maps into my conceptual model of web development.
As with most people, this model has been primarily dominated by page-driven REST-type interaction, but for the past few years, I’ve been trying to come to grips for a holistic approach to handle AJAX (née remote-scripting) and more recently SOAs and APIs. A couple rough notes, probably to be refined:
- I’m a big fan of the most straightforward controller mapping possible. One of the great things about how scripted application layers like PHP work is that you can start with an URL and figure out how it works from there. Of course, things can quickly get complicated. [this is bad] Minor modifications quickly become a PITA
- Separating the view is also a good thing, with the caveat that templating languages generally suck. Recently, a coworker of mine has been working on a simple XML-based view framelet called Phiz, which on a conceptual level is really appealing (implementation-wise, what it requires is a good caching system)
- OOP concepts are a must – inheritance and polymorphism being my top properties. As far as patterns, especially for modules, the Service Locator and Decorator are on my mind right now. Like most people, I’ve settled primarily on an overall MVC model, although I’ve been thinking a lot about IoC and how event streams might be processed.
- I’ll have to compare how other frameworks implement AJAX and API responses, but the design I’m working on should handle that interaction with pretty much no duplication or messiness.