Results: How Are You Structuring Your Apps? 

Voters
56 You may not vote on this poll

  • Ad-Hoc Page-Pased (adduser.cfm, listusers.cfm, etc.)
    33  58.93%
  • MVC/Framework (Fusebox, Model-Glue, Mach-II)
    15  26.79%
  • MVC + Tiered Model (service layer, business objects, data layer, etc.)
    10.71%
  • MVC + IOC Container / ORM (ColdSpring, Reactor, etc.)
    3.57%
Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968

    Arrow How Are You Structuring Your Apps?


    I'm curious as to how the average reader of these forums is architecting their ColdFusion applications. To expand on the poll options:

    1. Ad-Hoc Page-Based: each user action is its own page that is called directly in the URL, i.e. listusers.cfm, adduser.cfm, deleteuser.cfm, etc.
    2. Model-View-Controller / Framework: UI Controller framework such as Fusebox, Model-Glue, Mach-II, etc.
    3. Model-View-Controller + Tiered Model Layers: UI Controller framework plus a tiered model including service layer, business object layer, data layer, etc.
    4. Model-View-Controller + IOC Containers / ORM: UI Controller framework plus inversion of control containers like ColdSpring and/or object-relational mapping frameworks like Reactor


    Please respond to the poll and comment here with your thoughts or approach on structuring an applicaiton. I'm interested to see how most folks are doing this and why.
    Last edited by kiteless; March 24th, 2006 at 02:53 PM.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Posts
    3
    Rep Power
    0
    Ad-Hoc Page-Based is much simpler to follow when a developer wishes to take over or work upon my project when I am not in the office. Other methods seem far too complex for no real benefit.
  4. #3
  5. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968
    Originally Posted by parkerst
    Ad-Hoc Page-Based is much simpler to follow when a developer wishes to take over or work upon my project when I am not in the office. Other methods seem far too complex for no real benefit.
    Ad-Hoc Page-Based is less complex but does not scale well to large applications and does not result in very maintainable applications. This would be akin to developing a Java application where all the code is in the main() method. Less complex? Probably. Scalable and maintainable? No.
  6. #4
  7. Green-River-Media.com
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2004
    Posts
    858
    Rep Power
    62
    I think my method is ad-hoc also but I devide it all up i keep my main global vars in the application.cfm page, use my index.cfm page just for the template stuff (wrapper of the content) include my content (cfinclude statement with pageid variable being called from the url) menu is included also as is the footer, basically all info that is generated or that remains static is included in the index.cfm template file, that allows me to change one part of the site from one file and not have to change a million of them. here is an example of what i mean with my newest CMS, http://v2.getmanaging.com it has 3 different sites (home, fm, cm) but yet they all use the same source files (same menu, content etc) but different index.cfm files where i change the layout and 2 variables that controll the include path of files and what content is displayed on the sites.
    Web Developer
    Green-River-Media.com
  8. #5
  9. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968
    Yes, encapsulating the business logic from the display code is absolutely essential. When done properly, the same domain model can supply data to numerous views (not just separate sites, but web services, AJAX calls, Flash/Flex remoting calls, etc.).
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    19
    Rep Power
    0
    Originally Posted by kiteless
    I'm curious as to how the average reader of these forums is architecting their ColdFusion applications. To expand on the poll options:

    1. Ad-Hoc Page-Based: each user action is its own page that is called directly in the URL, i.e. listusers.cfm, adduser.cfm, deleteuser.cfm, etc.
    2. Model-View-Controller / Framework: UI Controller framework such as Fusebox, Model-Glue, Mach-II, etc.
    3. Model-View-Controller + Tiered Model Layers: UI Controller framework plus a tiered model including service layer, business object layer, data layer, etc.
    4. Model-View-Controller + IOC Containers / ORM: UI Controller framework plus inversion of control containers like ColdSpring and/or object-relational mapping frameworks like Reactor


    Please respond to the poll and comment here with your thoughts or approach on structuring an applicaiton. I'm interested to see how most folks are doing this and why.
    I just started on a project here in the north-east and the way I'll be structuring the app would I think fall under ad-hoc page based architecture. All the globals are defined in application.cfm and like a previous poster described, the index.cfm is used more or less as a wrapper.

    Is there a resource where I can read up on the pros and cons of all these architectures? thnx.
  12. #7
  13. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968
    If you have a specific question I'm happy to try to help, but if you're asking me to architect your application for you I'm afraid the answer will be no.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    9
    Rep Power
    0

    One thing I did in the begining


    In my early days of CF before I learned the oop approach to coding cf I would do something I found very useful. I would create my own version of a fusebox but very list. I would have a directory called queries, and a directory called modules. And using a switch case statement in the application file I would decided which queries and modules were needed for each page. For example I would create a page called index.cfm index.cfm would have the main design of the site then based on the switch case in the application file the content section of the page would be filled in. I would use url params for what page I was on like index.cfm?page=about this was a fairly easy way to start seperating logic from presentation and let you learn a little deep cf coding. Try adding things to your case statement to chage the page titles of each page, and track user viewing stats. It will give you a bit more of the fundementals of a structured development project. Now I personally use model-glue as I love the RAD i get from using it. But be creative and try to come up with your own way of seperating logic from presentation. It will help you learn in the long run. But trust me cfc's are the way to go. AD-HOC is not very developer friendly.
  16. #9
  17. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968
    Originally Posted by roger_v
    I just started on a project here in the north-east and the way I'll be structuring the app would I think fall under ad-hoc page based architecture. All the globals are defined in application.cfm and like a previous poster described, the index.cfm is used more or less as a wrapper.

    Is there a resource where I can read up on the pros and cons of all these architectures? thnx.
    There really is no central resource that I am aware of, but a simple search for any of these will provide numerous results. There are also mailing lists available for all of these (Fusebox, Mach-II, Model-Glue, Reactor, ColdSpring, and others). Hope that helps!
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Posts
    273
    Rep Power
    10
    Since picking up Fusebox I'll never go back to ad-hoc.

    The ability for anyone to look at my app, know exactly where everything is and how it is managed is by far the greatest positive.

    I will be beginning to pick up Mach-ii and I am very excited to start programing in OO.
  20. #11
  21. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2005
    Location
    Durban, South Africa
    Posts
    70
    Rep Power
    10

    Smile Im doing it Adhoc


    I have build site using Fusebox, and enjoyed it.. but now doing it adhoc as i cant remember the logic i plan (due to short term memory loss, after an accident). I did using Fusebox to build an online pharmacy, a banner management system and an online lottery, but it was quiet a few years ago..
    Will probably go back to fusebox if my memory allows it..
  22. #12
  23. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    31
    I use CF for all my database admin stuff. Not sure which method I'm using, though. Maybe ad-hoc? I have a folder for each database table and within each folder are do.cfm and form.cfm scripts. The "form" script renders the form to add or edit entries and the "do" script does all the database stuff.
    Matt
  24. #13
  25. No Profile Picture
    Duck herder
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    My crib
    Posts
    5
    Rep Power
    0

    It depends


    Ad-Hoc Page-Based is much simpler to follow when a developer wishes to take over or work upon my project when I am not in the office. Other methods seem far too complex for no real benefit.
    No wonder CF'ers get no respect.


    I use a MVC framwork like Mach II for the most stuff and depending on the scale of the project, I will use a service layer, business object layer and ORM. But even for quick and dirty "add hoc" stuff I will use cfcgenerator to generate my data layer (bean, gateway, DAO) just to not have to rewrite all my queries if I need to make changes to the database structure (Which I most likely will). That way if I add a field to the database I don't have to add it to and insert, updated and select queries. I just re-generate the CFC's. 9 times out of 10 all I need to do is add the new databse field to a form and/or a view page. I suppose I could use ORM but that would be over kill for simple stuff.

    I use cfcgenerator btw http://code.google.com/p/cfcgenerator/

    And all I need to do to snag data from the data base I just add 2 lines of code.

    Code:
    <cfscript>
    	GettblCPE_Method =  CreateObject("component" , "intranet.components.tblCPE_MethodGateway").init(Application.dsn); 
    	Get_tblCPE_Method = GettblCPE_Method.getByAttributesQuery(orderby= "Description");
    
    </cfscript>

    And then I can use a generic controller to handle my CRUD functions. With this all I need to do is swap out the name of the table I am using. For this I am using "hrlinks". To change it to "hrdocs" I do a simple search and replace for that string and I have a basic CRUD app with out writing a line of code.


    Code:
    <cfscript>
    	// Create the bean
       obj_hrlinks = CreateObject("component", "intranet.components.hrlinks").init(); 
       // Create the crud Object 
       crudObject = CreateObject("component", "intranet.components.hrlinksDAO").init(Application.dsn);
       // Put the url and form vars into structure to reduce code
       tmp_argumentCollection=StructNew();   
       
    	if (action EQ "links_deleted" ) {
    		tmp_argumentCollection=URL;
    		}
    	else{
    		 tmp_argumentCollection=form;
    		}
    	// Populated the bean 
    	varcontainer = obj_hrlinks.init(argumentCollection = tmp_argumentCollection);
    	// perfom the crud operation
    	 if (action EQ "links_added"  ) {
    			GET_links = crudObject.create(varcontainer);
    			}
    	else if(action EQ "links_edited") {
    			GET_links = crudObject.update(varcontainer);
    			}
    		else{ 
    			GET_links = crudObject.delete(varcontainer);
    		}
    </cfscript>
  26. #14
  27. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,280
    Rep Power
    968
    You might consider using ColdSpring. It makes dealing with the dependencies in your model much easier, and also gives you the ability to do AOP and remote proxy generation.
  28. #15
  29. No Profile Picture
    Duck herder
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    My crib
    Posts
    5
    Rep Power
    0

    I am not sure I follow


    Originally Posted by kiteless
    You might consider using ColdSpring. It makes dealing with the dependencies in your model much easier, and also gives you the ability to do AOP and remote proxy generation.

    Funny you should mention that. I have been looking at ColdSpring but I haven't gotten my head around how it works as of yet. I had a dim light bulb go off but I am not sure how I would go about using it.

    Given the example I posted, basically using the off the shelf CFC's that cfcgenerator generates, how would I use ColdSpring? Would I not have to instantiate the bean in order to populate it. Could I just instantiate the hrlinksDAO.cfc directly and use that object to populate the bean or vice versa (since the DAO is dependent on the bean)?

    Is this even close?

    And thank you in advance for taking the time to answer my question.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo