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

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.

Similar Messages

  • CFC Return Message Best Practice

    Hi,
    I have a CFC file with all of my SQL queries. Some return
    results and some have queries which insert new records.
    My question is, if I submit a form on say index.cfm which
    calls a CFC function to insert a new record, how can I then send a
    message back to the index.cfm to say what has happened? I use
    cftransaction and cftry blocks around most queries so a useful
    message depending on what happens regardless is almost essential.
    One way I saw would simply be to do a cflocation with the
    message append to the URL but for other reasons I don't want to do
    it this way. e.g. <cflocation
    url="index.cfm?message=#urlEncodedFormat("Record inserted")#"
    But that method above looks dirty. Is there another way?
    Hopefully a standard way of doing it that will work accross the
    board.
    Many thanks for your advice - anything is much appreciated!
    Mikey.

    Hi BKBK,
    Firstly thanks again for your help.
    The form does indeed post to itself on the index.cfm page
    which also displays the results from another query CFC that simply
    gets the items.
    The problem is, within my logic (much like you have show
    above) the message is returned from the CFC as a structure to the
    page but does not refresh to show the latest results on the right.
    The results as mentioned before is from the invokation of
    another CFC that simply selects all records from the same table I
    am using the form to insert data into.
    If I refresh my page after submitting the form, I will then
    see my item in a table row...but only after I refresh it. I need it
    to refresh the page at the same time it's sending the message back.
    Is this making any sense?
    In essence there are two CFC functions here. One that
    displays all items in table "A" and the one that is called to
    insert data into table "A".
    Perhaps there could be some way of invoking the other CFC at
    the same time as the message gets sent back? But then again, this
    in theory wouldn't make a difference as the display CFC is already
    called at the top of the page.
    I hope you understand what I'm saying - it's like one of
    those things I could explain to someone very quickly in person but
    it's a bit tricky with text, ha.
    Many thanks again, you've already been a great help.
    Mikey.

  • Best Practice for calling CFC

    Hi,
    In a web application, if I need to call a CFC method from a different CFC, what would be considered as the best way of doing it?
    For example, let's say I have two components: Customer and Product.  From a method functionA in Customer, I would like to call functionB in Product.  I can do one of the following, but which way is best practice and why?
    1.  Create a Product object in functionA, and use it to call functionB
    <cfcomponent name="Customer">
         <cffunction name="functionA">
              <cfset productObj = createObject('component', 'Product')>
              <cfset productObj.functionB()>
         </cffunction>
    </cfcomponent>
    2.  Pass a Product object when we initialize a Customer object, and use that to call functionB
    <cfcomponent name="Customer">
         <cffunction name="init">
              <cfargument name="productObj">
              <cfset variables.productObj = arguments.productObj>
         </cffunction>
         <cffunction name="functionA">
              <cfset variables.productObj.functionB()>
         </cffunction>
    </cfcomponent>
    3.  Assume that Customer object has access to the Product object in the application scope
    <cfcomponent name="Customer">
         <cffunction name="functionA">
              <cfset application.productObj.functionB()>
         </cffunction>
    </cfcomponent>
    Thank you very much.

    The first two are fine.  If the CFC being called is always gonna be the exact same one, then there's no prob directly referencing it in the calling CFC.  If the CFC could vary, then pass it in.
    If you're only using the CFC transiently, then you could use <cfinvoke> as well in this case.
    Directly accessing an application-scoped CFC within a method is poor practice.
    Adam

  • Best Practice for storing PDF docs

    My client has a number of PDF documents for handouts that go
    with his consulting business. He wants logged in users to be able
    to download the PDF docs for handouts at training. The question is,
    what is the 'Best Practice' for storing/accessing these PDF files?
    I'm using CF/MySQL to put everything else together and my
    thought was to store the PDF files in the db. Except! there seems
    to be a great deal of talk about BLOBs and storing files this way
    being inefficient.
    How do I make it so my client can use the admin tool to
    upload the information about the files and the files themselves,
    not store them in the db but still be able to find them when the
    user want's to download them?

    Storing documents outside the web root and using
    <cfcontent> to push their contents to the users is the most
    secure method.
    Putting the documents in a subdirectory of the web root and
    securing that directory with an Application.cfm will only protect
    .cfm and .cfc files (as that's the only time that CF is involved in
    the request). That is, unless you configure CF to handle every
    request.
    The virtual directory is no safer than putting the documents
    in a subdirectory. The links to your documents are still going to
    look like:
    http://www.mysite.com/virtualdirectory/myfile.pdf
    Users won't need to log in to access these documents.
    <cfcontent> or configuring CF to handle every request
    is the only way to ensure users have to log in before accessing
    non-CF files. Unless you want to use web-server
    authentication.

  • Best practice for select access to users

    Not sure if this is the correct forum to post, if not then let me know where should I post.
    From my understanding this is the best forum to ask this questions.
    Are you aware of any "Best Practice Document" to grant select accesses to users on databases. These users are developers which select data out of database for the investigation and application bug fix.
    From time to time user want more and more access to different tables so that they can do investigation properly.
    Let me know if there exists a best practice document around this space.
    Asked in this forum as this is related to PL/SQL access.

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version.
    >
    Are you aware of any "Best Practice Document" to grant select accesses to users on databases. These users are developers which select data out of database for the investigation and application bug fix.
    From time to time user want more and more access to different tables so that they can do investigation properly.
    Let me know if there exists a best practice document around this space.
    >
    There are many best practices documents about various aspects of security for Oracle DBs but none are specific to developers doing invenstigation.
    Here is the main page for Oracles' OPAC white papers about security.
    http://www.oracletechnetwork-ap.com/topics/201207-Security/resources_whitepaper.cfm
    Take a look at the ones on 'Oracle Identity Management' and on 'Developers and Identity Services'.
    http://www.dbspecialists.com/files/presentations/implementing_oracle_11g_enterprise_user_security.pdf
    This paper by Database Specialists shows how to use Oracle Identity Management to limit access to users such as developers through the use of roles. It shows some examples of users using their own account but having limited privileges based on the role they are given.
    http://www.dbspecialists.com/files/presentations/implementing_oracle_11g_enterprise_user_security.pdf
    And this Oracle White Paper, 'Oracle Database Security Checklist', is a more basic security doc that discusses the entire range of security issues that should be considered for an Oracle Database.
    http://www.oracle.com/technetwork/database/security/twp-security-checklist-database-1-132870.pdf
    You don't mention what environment (PROD/QA/TEST/DEV) you are even talking about or whether the access is to deal with emergency issues or general reproduction and fixing of bugs.
    Many sites create special READONLY roles, eg. READ_ONLY_APP1, and then grant privileges to those roles for tables/objects that application uses. Then that role can be granted to users that need privileges for that application and can be revoked when they no longer need it.
    Some sites prefer creating special READONLY users that have those read only roles. If a user needs access the DBA changes the password and provides the account info to the user. When the user has completed their duties the DBA resets the password to something no one else knows.
    Those special users have auditing on them and the user using them is responsible for all activity recorded in the logs during the time the user has access to that account.
    In general you grant the minimum privileges needed and revoke them when they are no longer needed; generally through the use of roles.
    >
    Asked in this forum as this is related to PL/SQL access.
    >
    Please explain that. Your question was about 'access to different tables'. How does PL/SQL access fit into that?
    The important reason for the difference is that access is easily controlled thru the use of roles but in named PL/SQL blocks roles are disabled. So those special roles and accounts mentioned above are well-suited to allowing developers to query data but are not well-suited if the user needs to execute PL/SQL code belonging to another schema (the app schema).

  • Best Practice guide for purchasing - payment card processing

    Hello All,
    \Is there any Best Practice guide for “Payments by credit card”/ “Payment card Processing”.
    The biz process is:
    The purchasing department users purchase goods/services using their corporate credit cards. They obtain a credit card voucher/receipt for the purchase made. The credit card co. turns in the credit card statements/files once in a month  the Accounts Payable  matches the receipts with the statements/files & makes the payments.
    Will reward points.
    Thanks & Regards,
    Arpita

    Hi Arpita,
    You might want to check this link
    http://web.mit.edu/sapr3/docs/webdocs/purchpay/ppCC.html
    http://www.bitpipe.com/tlist/Payment-Processing.html
    http://whitepapers.sapinsideronline.com/view.cfm?session=&white_paper=4
    Thanks,
    Jenny
    award points if helpful

  • Best Practice Suggestions?

    Hey CF World,
    I have to revamp an online order process. The process is broken into 4 steps.
    The app as it exists today was built by a different developer and for the life of me, I have wasted about 5 hours trying to figure out exactly what the person is doing in the code just so I can make some basic tweaks to the process.
    Could anyone offer what might be considered today's best practice for a step by step order process?
    The thought is, if the user could complete step 1, upon clicking next the data elements of the form would be validated and then they would be taken to step 2, etc, etc... until the end where upon submission, the order would then be written to the database and next process triggered internally.
    Should I have one page that upon submit of step 1 cycles back to itself, processes the data and then loads a separate div of info for step 2 or...?
    Any suggestions would be great.  Thank you so much in advance for your help, I sincerely appreciate it.
    Ciao'
    D.

    I'm not going to attempt to answer the user interface side, that's not my area of expertise.
    In terms of validation, ideally this should occur at three levels
    1) Client-side - immediate response. Traditionally this is Javascript. For instance, if the user tries to enter a letter into a numeric field, they get feedback as soon as they press the button.
    1a) Client side - on submit. Any extra validation (blank mandatory fields, comparison of fields) that doesn't require a trip to the server. Also traditionally Javascript.
    2) Application level. Assume that the user had Javascript disabled, and none of your previous validation had happened. Also, there are tools such as Firebug that let them edit your HTML before running it: adding extra items to a SELECT, for instance. Redo all previous validation!
    This is also where you check things against your database - and parameterise any database interface. SQL injection is a Bad Thing. Do as much as you can via stored procedures called by CFCs, and if your code only needs read access, use a datasource that only has read access.
    3) Database level. Assume they've somehow got in via a route other than your application: maybe a malicious or careless employee using command-line SQL. Enforce all business rules and all data integrity constraints at database level: constraints, triggers, whatever your database provides.
    Sounds horribly paranoid, doesn't it? But that trick of editing the SELECT is done by 13-year-olds hacking games, so if you're dealing with real money and adults, it's the sort of thing you have to allow for.

  • Loader Best Practice Question

    The documentation is not very clear on what to do with
    regards to releasing memory etc.
    Typically, I'm loading an image and assigning the image to an
    <mx:image>. Do I then need to dispose/unload the loader? If
    someone would be kind enough to either explain this or provide a
    good code example (that implement best practice) I'd appreciate it.
    Thanks.

    There has been some consternation about this. Check this
    thread for instance:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=587&threadid =1179158

  • Best practices for submitting CF data to an AJAX page?

    Hi everyone,
    I've got a project I'm working on for work and have hit a
    little problem.
    I am extracting data from my database and then after each
    piece of data (just numbers, usually 10 chunks of numbers), I tack
    a "|" onto the end of each number. Then, I output the data to the
    page. Back on my AJAX enabled page, I get the "responseText" from
    that page, and then split it up using javascript and the
    pre-inserted "|".
    This seems to work fine, but it is quite a bit more messy.
    Also, It would really, really be nice to be able to do sorting and
    various other operations on the data with javascript instead of
    having to rely on CF's icky code logic.
    Can someone please enlighten me as to best practices for this
    type of thing? I get the suspicion that I'll probably be using XML
    somehow, but I'd your opinion.
    Thanks!

    Check out the Samples and Documentation portions of Adobe's
    Spry website for client side use of JSON with Spry.
    http://labs.adobe.com/technologies/spry/home.html
    Here is link to Adobe's Spry Forums:
    http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=602
    If you are using CF8 you can use the SerializeJSON function
    to convert a variable to JSON. You might also be interested in the
    cfsprydataset tag. CF 8 documentation:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/
    If you are using a previous version of CF there is 3rd party
    JSON support. You can find links at
    http://json.org.

  • Business Package for SAP Best Practices for Enterprise Portal

    Hi,
    We are implementing EP for ECC 5.0 and we have to web enable some FI transactions like FB50/fb60 etc. We want to use standard business package for this. The only business package that caters this requirement is "Business Package for SAP Best Practices for Enterprise Portal 60.1". When i checked the data source for this business package, the specification is for "SAP R/3 4.6B and above". Does this work for ECC 5.0 as well? In general does the R/3 specific business packages work for ECC versions? Please let me know. Thanks for the help.  I promise rewards.
    Regards
    Hari

    Hari,
    When you download the BPO via Portal Content Portfolio,
    each bpo has additional information on the release.
    For example for the one you are inquiring about - Business Package for SAP Best Practices for Enterprise Portal, the additional release information is provided on the following links;
    https://www2.iviewstudio.com/sdn/info/index.cfm?action=faqs&part=#QSR03
    https://www2.iviewstudio.com/sdn/detail_view/index.cfm?action=package_information&CatalogSet=SAP%20Content&ItemID=17212&CFID=7544845&CFTOKEN=99283970
    Regards,
    James

  • Best Practices Web Services - Complex Data Types

    Can someone provide some best practices documentation or info that for customers using CR against web services? Speciffically any information on complex data types such as  String[] or Address.
    Thanks
    Ian S

    And That's what I did.
    name.cfc is the component that has complex data types
    created.

  • Best Practices - Transports

    Hi there
    In my brief Portal experience, I have only ever transported stuff (iviews, roles etc.) using the manual approach provided in the portal under System Admin >> Transports.
    Now, one of the other portal implementations that our company has done has been scrutinized, and one of the suggestions that has come out of that investigation (outside contractors) was to implement a "Portal Transport System" as documented in the Best Practices document, which is then supposed to automate the content migration process.
    So:
    1. Can anybody tell me where documentation is available on this transport approach?
    2. Can anybody confirm / deny that this is the best approach to use for transports.
    Any information would be greatly appreciated.
    Cheers,
    Andrew

    Hi,
    You can find a best practice document in SDN.
    Please check the below links.
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/EP%206.0%20SP2.0/Best%20Practice%20for%20Transporting%20SAP%20NetWeaver%20Portal%20Content.pdf#search=%22How%20to%20transport%20portal%20packages%3F%20netweaver%22">Best Practice – Transporting SAP NetWeaver Portal Content</a>
    Also check..
    http://www.sapportalseminar.com/agenda/index.cfm?usergroup=regular&confCode=POR6-PHI
    Hope this helps you.
    Thanks,
    Ramakrishna

  • Coldfusion Error catching (cftry cfcatch) best practice question...

    Hey all -
    I wanted to get a couple of opinions about this.  Obviously I want to catch any and all errors that hit my server and avoid exposures to my end users, but I didnt know what the most efficient way of doing such was.  Does it make sense to put a cftry cfcatch around the entirety of my code on every page?  (I use a lot of embeds...cfinclude)  Or is that too broad?  How does that effect performance?  Is there another way to auto catch and email all errors and then show the user a custom error page?  I searched around, but I got bits and pieces based on specific requests...not really any "best practice" tips.  Any suggestions would be fantastic.
    Thanks much!

    There are no real best practices as such, as it's largely down to your application. The only real "standard" is the onError() method in Application.cfc, which will handle any Exceptions which make their way to it - i.e. any that are not caught by an explicit try/catch block.
    When considering what you are now, I consider this: where do I want to display an error? How far down the line does it matter? There's no right or wrong answer, it's down to you.
    Say you're displaying a page, which is made up of ten includes. If there's an error in one, do you want the other nine displayed, or do you want the whole page to error? If it's the former, wrap each one in its own try/catch. If it's nonsensical to do so, just let the page throw an Exception to get picked up by your Application.onError() method.
    It also depends largely on whether or not an error is "recoverable" - is it of any use telling someone that a small but important part of the page failed becuase of a database issue? Probably not. There's nothing they can do about it, so just throw an error and let your error template sort it out.
    It also depends on the context in which the page is being called - if it's an Application with users, you can display an error page with as much or as little information as you want. If it's a remote CFC call, however, it's extremely annoying for the remote developer to just get useless ColdFusion exceptions. Therefore I would always wrap every remote CFC method in its own try/catch, so if something goes wrong you can still return them something useful - even a "false" is better sometimes than an exception. You can then do what you like within the catch block - send you an email, log to disk, whatever.
    Just a few thoughts, haven't proof read them though so expect massive, glaring mistakes and poor advice.

  • Does anyone know the best practices to use Captivates on an Elearning course, please...

    I need to know the best practices to use captivates on an eLearning course, as how much information should it has, etc..

    Hello There,
    Adobe Captivate has multiple workflows which can help you to create eLearning courses. It can create various types of learning content and I suggest you to visit the following links.
    Product Info: www.adobe.com/products/captivate/
    OnDemand Seminars to get more info on what captivate can do: http://www.adobe.com/cfusion/event/index.cfm?event=list&type=ondemand_seminar&loc=en_us
    Register for Trainings and Webinars: http://www.adobe.com/cfusion/event/index.cfm?event=list&loc=en_us&type=&product=Captivate& interest=&audience=&monthyear=
    If you have specific scenarios to discuss, you can mail me at [email protected] or tweet me at @vish_adobe
    Thanks,
    Vish
    @vish_adobe

  • Best Practices: collaborate between Mac and PC

    My nonprofit organization's Web development department is
    expanding -- from just me on a PC using Dreamweaver and ColdFusion,
    to me/PC plus a fellow working in Dreamweaver on a Mac.
    I am looking for advice from anyone who has done development
    with a Mac and PC. Basically, I'm looking for some "best practices"
    on how we should collaborate, without messing up each other's work.
    He will focus primarily on the design aspects of projects: CSS, for
    example. I will work primarily on the ColdFusion coding that allows
    us to pull information into the .cfm pages from our databases.
    I just greatly fear getting into a situation where he's
    making changes to one version of a file and I'm making changes to
    another--disaster! Alternatively, I worry (since he's a new guy ...
    I've known him for about two weeks!) that his work could "mess up"
    pages that were working fine until he got his hands on them.
    Advice would be really appreciated. Because he and I have
    such complementary skills, this could be a great collaboration.
    Just want to make sure we do it as right as we can from the get-go.
    --diane

    Diane,
    You had said lot of issues at all once. I certainly
    understand the issues you are saying.
    As for new guy the non-profit agency recently hired, the
    interviewer should have ask the candidates for their showcase or
    portfolio of their past work in web design. It is very important
    that interviewers to understand this to see showcase or portfolio
    when it comes to creative work involved.
    As for collaboration between PC and Mac, really, you
    shouldn't be overly concerned about this. Most importantly of all,
    it is important to know what is under the hood of HTML and CSS,
    hands-on experience, understanding on how HTML works and what's
    not. Then there is some comfort zone with HTML/CSS, then there is
    lot of intitution or natural feeling comes along with Dreamweaver.
    If this new person you are talking about, that if he doesn't
    have any experience in working with data-driven application, then
    don't let him do it. Only you do this part.
    Clearly, it is obvious. Part of collaboration is having a
    good teamwork -- to work together as a team is important. That
    applies to two-way communication, that is part of collaboration.
    To clarify the version of Dreamweaver and Cold Fusion, which
    version are you referring it to?
    Hope that helps. Good luck with your collaboration project.
    Cheers,
    Brian

Maybe you are looking for

  • Error while running the diagnositc system setup wizard

    Hello All, When I am running the diagnstics setup wizard,I am getting the following warning for SSO.SMD is the SID for my solution manager system and it is ABAP+JAVA system: SSO Setup : both Java and Abap stacks are using a ticket certificate with id

  • Web.xml and security constraints

    Hi, I have several web services deployed. I only want to protect one of these web services. If I use "/services/*" in <security-constraint> of my web.xml file, all my deployed web services are protected. If I use "/services/aaaWebService" in <securit

  • How to make or create rule matrix?

    HI, How to create rule matrix...do we first consider the business process.I mean do we have to craete rule matrix as per the different SAP Modules(BASIS,HR,PAYROLL etc.). Also if somebody have any document or link for role simulation demonstration pl

  • Language Change in Word

    Using Mac Office 2011, when I change the language it doesn't actually change. I need to switch back and forth between French and English a lot.Crazy annoying. Ideas?

  • OS 10.0.10.90 one day in

    As the topic header states downloaded 10,0.10.90 today, (UK) all lot of issues seem to have been addressed. It appears battery life has been improved, not sure how but after a heavy day Im stll 50% full or is that , empty? Rotation in keyboard mode a