SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict
    Join Date
    May 2004
    Location
    USA
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Scaffolding.... whats the purpose?

    In other libraries i've used that generated scaffolds it warned that you shouldn't leave the scaffolds up for the public. In the sitepoint rails book they pretty much says the same thing.

    What purpose do they serve then? Just to give the programmer a way to add and edit data during development?

    Do any of you use the generated scaffolds and turn them into a admin area or something?

  2. #2
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes the purpose is that but anyway i don't understand why you can't use its code in production application...is that code insecure? If you will write the CRUD code yourself isn't it pretty much the same as the scalfodding one?

  3. #3
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The interface is rarely what you want. If you need a CMS you use a CMS and not a scaffold generator ;-). But it's good enough for administration sometimes.

  4. #4
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2 View Post
    The interface is rarely what you want. If you need a CMS you use a CMS and not a scaffold generator ;-). But it's good enough for administration sometimes.
    the interface in terms of graphic ok....but it is so easy to work with html e css but the code is ok no?

  5. #5
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, it's not very good code. ./script/generate scaffold_resource generates better code I believe (but I rarely use scaffold generators though). You could also write a macro that works like scaffold( :model ) (or use that one) to have cleaner controllers and less duplication.

  6. #6
    SitePoint Addict
    Join Date
    May 2004
    Location
    USA
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess what I'm saying is what's the point of the scaffolds anyway. If they aren't secure, etc... why use them? Why are they there?

    I think it was cakephp that generated scaffolds as well although they said to not use them.

    Why are they there then

  7. #7
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use scaffolds because they mean you can get a working application up and running very quickly. I then modify the application and remove the scaffold elements as I develop the application. If I use scaffold, a lot of elements are present right at the start of the development process. I don't have to create them to see how elements I have created, work with them.

    Take this example: I start building a new application. I decide to start on the list view. Part of this list view is a link to an edit view. If I want to play with this link or demonstrate it to someone, I also have to build an edit view .... unless I've used scaffold.

    If I scaffold first, standard links navigate to a working page. If I build everything from scratch the links only go to a working page after I've also build that page.

    So as I start on the list page, when I finish that view all the links work. I can then move to the next view and work on that.

    This is particularly useful when creating an application for someone who doesn't really know what they want. I can build a scaffold example very quickly and use it to demonstrate how the application will work. I don't waste time building application components and then ripping them out again because once the user see them, they realise that's not what they want.

  8. #8
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReggieB View Post
    I use scaffolds because they mean you can get a working application up and running very quickly. I then modify the application and remove the scaffold elements as I develop the application. If I use scaffold, a lot of elements are present right at the start of the development process. I don't have to create them to see how elements I have created, work with them.

    Take this example: I start building a new application. I decide to start on the list view. Part of this list view is a link to an edit view. If I want to play with this link or demonstrate it to someone, I also have to build an edit view .... unless I've used scaffold.

    If I scaffold first, standard links navigate to a working page. If I build everything from scratch the links only go to a working page after I've also build that page.

    So as I start on the list page, when I finish that view all the links work. I can then move to the next view and work on that.

    This is particularly useful when creating an application for someone who doesn't really know what they want. I can build a scaffold example very quickly and use it to demonstrate how the application will work. I don't waste time building application components and then ripping them out again because once the user see them, they realise that's not what they want.
    ok but the point is if i can use the same (or similar) code of a scaffolding generated code or not 'cause it is not well written or insecure

  9. #9
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't say that it is "insecure", you would just not leave the scaffolding code "as is" to the public. You would want to put some form of user authentication around it. The code itself isn't functioning insecurely - you just need to protect who can enter data into it.
    Last edited by slavenski; Apr 7, 2007 at 12:30.

  10. #10
    SitePoint Addict
    Join Date
    May 2004
    Location
    USA
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks - that actually does help a bit and makes some sense.

  11. #11
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Scaffolding is merely a way to speed up development, and generally helps by giving you some starting point code that works out of the box, so it encourages increamental development, instead of writing tonnes of code, hoping it works (which it never does) and then going round in circles forever debugging it and cutting out code during the process of isolating bugs.

    Like many said, the scaffold code is not of good enough quality for production, but it makes a good starting point which makes it easy to *evolve* into production code.
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  12. #12
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyway now that i am more "expert" of rails and i studied the rails scaffolding controller code i know that there is nothing complex to reproduce. The controller code is very poor, the only "big" part is the code for the layout and views.....code that you will always customize or change it all.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •