[Catalyst] Why scaffolding? Validation and Learning
Matt S Trout
dbix-class at trout.me.uk
Fri Aug 18 16:04:39 CEST 2006
Zbigniew Lukasiak wrote:
> Some more technical details.
>
> The main idea of how the scaffolding should work is that we generate
> only a skeleton of directories, nearly empty controllers and some config
> stuff. The generated controllers only contain their package
> declaration and a 'use base Catalyst::Example::Controller::InstantCRUD'
> line. So there is not that much of generated code here. After the
> controllers are generated users are expected to copy the methods that
> they want to modify from the Catalyst::Example::Controller::InstantCRUD
> superclass - doing that they are taking responsibility for the copied
> code. This way the main Instant controller, which is just a standard
> library and can be updated with standard means, is also an integral part
> of the example. The copying perhaps is not such a trivial step - but in
> fact should be pretty natural for people working with Object Oriented
> code - it's just overwriting of SUPER class methods. I am also planning
> to make it more intuitive by the way of documentation.
>
> This is the theory - in practice the config stuff required to have a
> working application is a bit big, but we are working on it.
>
> A separate thing are the templates for the views, in the current CPAN
> version they are treated in a similar way that the controllers - the
> users are expected to just copy the generic templates from the
> InstantCRUD directory and modify them to their liking. There were
> people on this list complaining about this and in the svn version now we
> create the basic templates in the generated application. This means
> problems with the templates when upgrading the library, but perhaps we
> need to treat the templates separately from the code and expect them to
> be really quickly rewritten by the programmers.
We have an approach that allows standard templates to effectively be
subclassed; once it goes to public announce I'd love to have your opinion on
them since templates are the hardest issue for scaffolding and it's clear
you've done a fair bit of thinking about it.
None of what I'm saying denigrates InstantCRUD - it's a very well-implemented
Scaffold and I recommend it to people regularly. I just think it's possible to
achieve the same things a better way.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list