CFC vs. CFM (Best Practices) - Cold Fusion

This is a discussion on CFC vs. CFM (Best Practices) - Cold Fusion ; Hi, I am fairly new to the ColdFusion world and have a couple of questions related to best-practices and appropriate usage of various options First of all the CFM vs. CFC. Coming from the OO world it seems that the ...

+ Reply to Thread
Results 1 to 6 of 6

CFC vs. CFM (Best Practices)

  1. Default CFC vs. CFM (Best Practices)

    Hi,

    I am fairly new to the ColdFusion world and have a couple of questions related
    to best-practices and appropriate usage of various options

    First of all the CFM vs. CFC. Coming from the OO world it seems that the CFC
    are to be used for entity classes and controller classes and the CFM is
    basically the presentation class. Can someone confirm this is the appropriate
    usage and understanding. Also any other input around this would be very helpful.

    Secondly CFReports vs. FlashPaper. I am not sure here but would appreciate
    how/when these two should be used.

    Finally if anyone has 'general' CF8 Best Practices (in an distributed J2EE
    deployment model) that would be very helpful.

    Thanks,
    Daniel


  2. Default Re: CFC vs. CFM (Best Practices)

    ddks2 wrote:
    > First of all the CFM vs. CFC. Coming from the OO world it seems that the CFC
    > are to be used for entity classes and controller classes and the CFM is
    > basically the presentation class. Can someone confirm this is the appropriate
    > usage and understanding. Also any other input around this would be very helpful.


    This is a very common approach, but one is by no means constrained to do
    so. If this is of interest to you, you would be well advised to check
    out some of the OO|Frameworks initiatives in the ColdFusion world. Some
    of the biggest are 'Model Glue', 'Mach II' and 'FuseBox'. These are all
    MVC frameworks that make extensive use of components.

    One of the best|worst [Depends largely on one's view point] features of
    ColdFusion is that it does not advocate or force any particular
    development methodologies such as OO vs Procedural.

    >
    > Secondly CFReports vs. FlashPaper. I am not sure here but would appreciate
    > how/when these two should be used.


    This is not a 'versus' as I understand your statement. CFReports is an
    ability to deliver print friendly content to clients outside of the HTML
    standard. It consists of two parts, the server component that uses the
    <cfreport...> tag to access ColdFusion CFR files OR a small subset of
    Crystal Report RPT files. The server then uses this file and generates
    content to deliver to the client.

    The second part is the 'Report Builder' which is a first generation,
    graphical, banded report, windows application used to build CFR files
    that can be used with the above <cfreport...> tag.

    The ColdFusion report file has the capability to generate either PDF or
    FlashPaper output to be delivered to the client. Which one chooses
    depends on what you desire your clients to use to view the content.

  3. Default Re: CFC vs. CFM (Best Practices)

    Thanks for the reply.

    Regarding the CFReports vs. Flashpaper. Still some confusing here on my side.
    From my understanding I could use CFReport to create a report and then output
    this as a FlashPaper (or PDF). I thought one could also use CFQuery to create
    a report (more or less manually in HTML) and import this into FlashPaper?! Is
    this not possible? I tried looking at the Flashpaper documentation but couldn't
    find this specifically but again assume CF8 has the Flash integration to make
    this possible?!

    Thanks,
    Daniel


  4. Default Re: CFC vs. CFM (Best Practices)

    Best practices is a matter of opinion. My opinion is that simplicity is a
    virtue and that one should keep everything as simple as possible.

    cfm templates are simpler than cfc's so, unless there is a reason to use
    cfc's, don't. My reasons to use cfc's are:

    1. I consider the code to be re-useable. (by the way, cfc's are not the only
    way to re-use code)

    2. I want the code to be available from outside Cold Fusion (as in the cfc is
    being used as a webservice).


  5. Default Re: CFC vs. CFM (Best Practices)

    You probably want the cfdocument tag. It will create a document in pdf or
    flashpaper format.

    [q]Originally posted by: ddks2
    Thanks for the reply.

    Regarding the CFReports vs. Flashpaper. Still some confusing here on my side.
    From my understanding I could use CFReport to create a report and then output
    this as a FlashPaper (or PDF). I thought one could also use CFQuery to create
    a report (more or less manually in HTML) and import this into FlashPaper?! Is
    this not possible? I tried looking at the Flashpaper documentation but couldn't
    find this specifically but again assume CF8 has the Flash integration to make
    this possible?!

    Thanks,
    Daniel[/q]




  6. Default Re: CFC vs. CFM (Best Practices)

    ddks2 wrote:
    > Thanks for the reply.
    >
    > Regarding the CFReports vs. Flashpaper. Still some confusing here on my side.
    > From my understanding I could use CFReport to create a report and then output
    > this as a FlashPaper (or PDF). I thought one could also use CFQuery to create
    > a report (more or less manually in HTML) and import this into FlashPaper?! Is
    > this not possible? I tried looking at the Flashpaper documentation but couldn't
    > find this specifically but again assume CF8 has the Flash integration to make
    > this possible?!
    >
    > Thanks,
    > Daniel
    >


    Well the you could use the <cfquery...> tag to get data from a database
    and then use several tags such as <cfoutput query="recordset"> to output
    the file as HTML or other text formats.

    What you maybe thinking of is the <cfdocument...> tag which can be
    wrapped around basic HTML or other text. This content would then be
    delivered to the client as PDF or FlashPaper. This can be a nice way to
    make 'printer' friendly versions of a web page, but is by no means
    limited to just that purpose.

    The difference between <cfdocument...> and <cfreport...> is that report
    supports pagination features then document. The ability to have report,
    section and page headers and footers, sub-reports, and other nice to
    have report formating functionality. But it requires an seperate tool
    to build the report templates over the simple text editor required for a
    HTML document converted with the <cfdocument...> tag.

    Then, of course, there are the stand alone Flashpaper tools available to
    people who just want to create Flashpaper documents on their desktops
    and deliver these over the internet. The same as PDF people who use
    Adobe Acrobat to create PDF documents on their desktop that can be
    delivered over the internet if desired. But neither of these are
    particularly ColdFusion concepts.





+ Reply to Thread