I've zipped up the code and the PowerPoint presentation for the talk I gave at the Frameworks Conference last week. The talk was called "Designing Framework-Agnostic Models with CFCs". The zip file is available in the Links pod on the right sidebar. I hope you find it useful! This basically supplants all previous versions of the bookstore application.

There is a nice little discussion of my presentation over at Ray Camden's blog. Here is one of the comments that I posted in response to a question from another commenter:

Just to be clear, I'm assuming when you say the service would "call those check functions", you actually mean "call methods on underlying objects in the domain model". The service layer does not replace a domain model. It acts as an abstraction layer on top of the domain model.

On the same level, don't put so much logic into the service layer that you start to veer back towards a simple procedural system. Keep logic that belongs in the domain model (the "business objects") in those objects. The service layer is more for code that orchestrates things when several business objects need to be called together in some sequence to fill an overall need.

To use your example, student registration. An external system wants to register a student, so it calls studentService.registerStudent(someStudentData). Your service layer is providing this service to allow the external system to register a student. Internally, this might be a very complex process as you say, with checks for prerequisites, availability of the class, etc. It might involve several objects within your domain model. But the external system doesn't (and shouldn't have to) care how you're doing this within the model. It just wants to register the student.

And again, note that the "external system" can be anything that can pass the required data into your service layer: A local Fusebox controller, a Flex app using Flash remoting, or an ASP.NET app using a web service.

The full comment thread is availabe at Ray's Blog.

del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 3351 Views

Related Blog Entries

Comments

Comments are not allowed for this entry.