Intro to MVC preso -- code and slides available for download

FYI -- The slides and source code from my "Intro to MVC" presentation are now available for download in the "Presentations" section on my site. Note I've moved that pod to the left side of the screen. It's also now available on both the "main" site and the "blog" pages (before it was only on the "main" site).

Let me know if there are any questions.

And of course, the source code is "AS IS" and I make no guarantees about it. :)

Enjoy. nolan

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Henry Ho's Gravatar Today I just re-read the article "Beans and DAOs and Gateways, Oh My!" by Sean Corfield in FAQU Vol2 Issue 4. I'm looking forward to read your reply to the following questions:

What's the reason behind separating into DAO and Gateway? What's your thought on the possibility of combining the two? Do you think 4:1 syndrome is better than 5:1?

Do you think one can model apps with MVC pattern without objects/cfc's? e.g. Does traditional use of Fusebox (w/o CFC) qualifies as MVC?

What's your thought on the argument that of what you're promoting as being an Anemic Domain Model anti-pattern?

Thanks!
# Posted By Henry Ho | 11/15/08 12:55 AM
Nolan Erck's Gravatar @Henry

"What's the reason behind separating into DAO and Gateway? What's your thought on the possibility of combining the two?"

For the presentation in question, there were two reasons.
1. We're teaching some basic OO/CFC techniques to the user group. We have several members that are very new to CFCs (and OO in general), so using simple, smaller CFCs that "do one job and only one job" helps them see the light. DAOs and Gateways are good examples of this.

2. As I noted in the presentation slides, DAOs and Gateways are easily generated by tools such as Illudium PU36, which saves development time. PU36 could of course be modified to generated one object that does both DAO and Gateway style work, but out of this box, they're created as separate files.

Personally I have no issue with combining the two into one object (I've done so on a few projects in the past).

"Do you think 4:1 syndrome is better than 5:1?"

This may sound like a cop out to you but I honestly don't have a hard opinion one way or the other on this (the same is true for most other OO techniques as well). I'm of the "pick the right tool for the right job" mindset. If I have a need for 4:1, I'd use that; if 5:1 would make my life easier in some way, then I'd go that direction.

"Do you think one can model apps with MVC pattern without objects/cfc's? e.g. Does traditional use of Fusebox (w/o CFC) qualifies as MVC?"

Absolutely. A "view" could be a simple CFM page (as it is in my presentation example). The "controller" could be a second CFM file that the view posts it's form variables to. Then you could build a set of UDFs (or custom tags or CF modules if you prefer) that handle the database logic as your "model" code. That would still provide a lot of the "separation" benefits that an OO MVC design provides, though you lose a little the area of encapsulation (not to mention, if you did go with Custom Tags, they'd run slower than the equivalent CFC methods).

"What's your thought on the argument that of what you're promoting as being an Anemic Domain Model anti-pattern?"

I have the same answer as before: "pick the right tool for the right job". If I felt like an app wasn't going to benefit from this pattern, I wouldn't use it. I'm by no means an "everything must be OO" kind of guy, nor am I of the mindset that every app needs to live in a framework. If the codebase in question isn't helping me in some way, I probably won't use it.

Hope that answers your questions. Thanks for writing.

-Nolan
# Posted By Nolan Erck | 11/15/08 9:59 AM
John Gag's Gravatar @Nolan - I really appreciate the slides and code!
# Posted By John Gag | 11/17/08 3:55 PM
 
BlogCFC was created by Raymond Camden. This blog is running version 5.9.003. Contact Blog Owner