May 2018
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

What I'm reading
I am currently reading Railo 3 Beginner's Guide by Mark Drew, et. al

Thought for the day
Live as if you were living a second time, and as though you had acted wrongly the first time.
Viktor Frankl, author, neurologist and psychiatrist, Holocaust survivor (1905-1997)

Download the code
You can download the code for the Fuseblog here

Categories

Syndicate this Site - RSS 0.92
Syndicate this Site - RDF

May 2018

2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017

Review of Railo 3 Beginner's Guide
LoI - Dec. 17, 2009
LoI - Dec. 10, 2009
LoI - Dec. 03, 2009
LoI - Nov. 19, 2009
LoI - Nov. 12, 2009
LoI - Nov. 5, 2009
LoI - Oct. 29, 2009
LoI - Oct. 22, 2009
The Future of Fuseblog
LoI - Oct. 15, 2009
LoI - Oct. 1, 2009
LoI - Sep. 24, 2009
LoI - Sep. 17, 2009
LoI - Sep. 10, 2009
LoI - Sep. 03, 2009
LoI - Aug. 27, 2009
LoI - Aug. 20, 2009
LoI - Aug. 13, 2009
LoI - Aug. 06, 2009

Being Ben Nadel - Mach-II listeners and service layers

I've been recently delving into the mysteries that are the Mach-II framework. I'm also trying once again to get my head wrapped around a lot of Object Oriented Programming principles. This time things are making some more sense.

In Mach-II one of the main parts is listeners. They'listen' for events that are announced in the framework and then do something, like get variables, direct he flow of the application, or make calls to your model.

In modeling your business logic for your application, you want to have a service layer. The service layer passes information to the other objects in your model and acts as an application programming interface (API).

The part that I figured out on my own, with a little help from the Mach-II mailing list, was the relation between the two. They are the connecting bridge between the two parts of your application - the framework and the business model.

If your business model is written correctly it will be well encapsulated. It shouldn't know about anything outside of itself. Mach-II knows about itself and how it passes information around (through the event object). But your model shouldn't know anything about the way Mach-II does its thing. The model only cares about things like it needs to get an ID value to run some function.

Mach-II might need to pass a value to the model as something like event.getArg("ID"). It passes this to the service layer first, which then passes it along as just the ID value to the function in the model. This way the encapsulation is maintained and everybody is happy.

The Mach-II wiki just put up this page on the distinction between Mach-II listeners and the service layer which explains it better than I can. But it is nice to know that I came to an understanding of it on my own before finding the docs.

This must be how Ben Nadel feels all the time. ;-)

Posted by jhusum - 06:11 AM - General - Comments - Link to this entry

There are no comments for this article at this time.

Post your comment:
Fields marked with R are required.

Your name R:
Your e-mail:
Your webpage:
Your comments:

How much is 5 + 3?