You are right to have your persistence layer in/behind the service layer. I
do that as well I just also make sure if I have any calculations or
business logic that place that in the service layer, or in some cases my
domain objects. A lot of apps I work on don't have much business logic,
they are just basic CRUD apps that have public and admin interfaces. I
often find that as they grow business logic gets added in and it usually
fits nicely in the service layer.

--Kurt

On Sat, Oct 6, 2012 at 2:43 AM, drfishflan <[email protected]> wrote:

> Thanks for you reply!!
>
> I think I have been doing things wrong... I have been using my service
> layer (myServiceObject.cfc) for Purely SQL...
>
> I have an order component/class that contains methods such as
>
> getGross
> getVat
> getOrderref
>
> etc
>
> However... the logic for building up my order object is quite complex
> (lots of coniditionals and getting various other sets of data)
>
> Since you would suggest that this business logic should go in the service
> layer... Where would I put my SQL methods.... would they also go in the
> service layer?
> If so would it be best to have them in seperate files (abstracted out form
> the other business logic)
>
> Just trying to get an idea on file structue
>
> eg
>
> OrderListener.cfc  - contains the getOrder method which takes in event
> varaibles then calls the service
> OrderService.cfc - Performs all the business logic and builds up the order
> object
> ??????.cfc - Contains the SQL methods for getting data related to an order
> from the database.
>
> Hope my questions make sense
>
> and thanks in again for your first response.
>
> Alex
>
> On Friday, 5 October 2012 15:50:19 UTC+1, drfishflan wrote:
>>
>> I have been developing on an older version of of machii (1.5) for a while
>> now.
>>
>> I am just reading up on the current documentation on the wiki.
>> I have not been keeping up with machii coding practices due to not having
>> enough time.
>>
>> Looking back at old documentation it was once suggested that the
>> Listeners should include business logic.
>>
>> Reference : http://www.mach-**ii.com/resources/how_to_**
>> develop_listeners_for_mach-ii.**pdf<http://www.mach-ii.com/resources/how_to_develop_listeners_for_mach-ii.pdf>
>>
>> But looking at the wiki this has changed.
>>
>> "Things that should not go in your listener:
>> Business logic (ie; calculating a tax rate, checking to see if a user
>> already has an account in your system, etc.)
>> "
>> Reference : 
>> http://trac.mach-ii.com/**machii/wiki/IntroToListeners<http://trac.mach-ii.com/machii/wiki/IntroToListeners>
>>
>> So if for example I needed to loop over some data from a database , parse
>> some form data and then do some calculations using both form and database
>> data.
>>
>> Where would be the best place to put this logic since I currently have it
>> within my listener.
>>
>> As far as I understand it .. all database SQL would go into the service
>> layer... so where would my business logic example above be placed?
>>
>> Thanks for your help!!
>>
>>
>>
>>
>>  --
> --
> To post to this group, send email to
> [email protected]
> For more options and to unsubscribe, visit this group at
> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>
> New (July 2012): We've moved to GitHub:
> https://github.com/Mach-II/Mach-II-Framework
>
>
>

-- 
-- 
To post to this group, send email to [email protected]
For more options and to unsubscribe, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

New (July 2012): We've moved to GitHub: 
https://github.com/Mach-II/Mach-II-Framework


Reply via email to