Where to put my logic

9 views
Skip to first unread message

Ronan Lucio

unread,
Sep 22, 2010, 2:58:36 PM9/22/10
to cfc...@googlegroups.com
Hi,

We have an application that talks to the model via service layer.
Service store its logic in a high level way and have access to Data Access Objects.
Record's logic resides on beans.

Its working fine as its supposed to.

Now I'm developing an export task.
This export task has many logics where in a well refactored code it will result in several methods.
So my doubt is where to put such a methods.

In one hand, these methods don't refers to Data Access, its a Information Processing.
In the other hand, I don't want to fulfill my Services with "internal" methods. It's supposed to contains just "services".

To complex things a little bit, I need to use inheritance for these methods.

Being more clear:

The user just need to export his/her real estates.
We have a standard layout for exporting.
Nonetheless, the user can export to other real estate portals.
Each real estate portal have its own layout standard.

So I will need methods like validadeRealEstateRecord(), convertRealEstateType() and so to adjust the records for each standard, before exporting the data to an XML file.

My first doubt is where to put this kind of method.

The second doubt is how to deal with inheritance in this case.
I would like to have an AbstractClass for export to the standard layout, and each portal we access exportation would have a specialization Class.
Each Class/specialization would have its polymorphic methods.
So what kind of Class would it be?

Thanks,
Ronan

Jason Durham

unread,
Sep 22, 2010, 3:08:32 PM9/22/10
to cfc...@googlegroups.com
Don't get too wrapped up with the terminology.  Create another component that does what you need.. RealEstateListingExporter... instantiate it in your Service and pass whatever info it needs.

Pseudo code from ListingService...
=====================
function getCSVListings() {
    
     var qListings = DAO.getListings();
     var oExporter = createObject("component","path.to.RealEstateListingExporter");    

     return oExporter.exportListings(qListings);

}
====================


Jason Durham


--
You received this message because you are subscribed to the Google Groups "CFCDev" group.
To post to this group, send email to cfc...@googlegroups.com.
To unsubscribe from this group, send email to cfcdev+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en.

Ronan Lucio

unread,
Sep 22, 2010, 4:29:15 PM9/22/10
to cfc...@googlegroups.com
Good point Jason!
Thank you

Ronan

2010/9/22 Jason Durham <jqdu...@gmail.com>
Reply all
Reply to author
Forward
0 new messages