On Mar 8, 2007, at 4:12 PM, Arjen van Schie wrote:
- Is rails a true DSL?
I think it is, by fowlers definition i think it applies as embedded
DSL in ruby, where the domain is web-applications with database
backends (ie. suitable for MVC). Tough i can understand that this
might be to general to apply as a real DSL
I don’t have a strong opinion either way, but I think you’d be better
off thinking about whether each component in rails provides a DSL.
eg. does ActiveRecord provide a DSL for describing database tables
and their relationships? does the routing system provide a DSL for
describing how URLs map to code?
You may well come up with different answers for different parts of
- How well is RoR suited when it comes to maintenance?
I mean sure scaffolding makes it easy to quickly build a new project,
but what about changing models regenerating after modifications of the
generated/scaffolded code ? Am i missing something or is it really
just ‘scaffold once’, but then you’re on your own ?
First disclaimer – most rails developers don’t use scaffolding, or
end up replacing most scaffolded code very quickly. It’s a useful
tool for learning rails or for quickly putting together a prototype,
but aside from that it’s not really useful for anything but the most
ActiveRecord Models get their list of column names from the database
and so don’t need to be re-generated when the schema changes (but you
might need to restart your app), but you may need to change some of
the code you’ve added to your models depending on the change you make
to your schema.
Controllers and views can largely be shielded from changes to the
schema based on how you set up your models, but there’s a good chance
that you would need to change, say, a form if you add an extra field
to a table in your database and the form represents the data in that
Rails isn’t dynamic in the sense that a change in one place will
necessarily update all dependencies, and that is a good thing. If it
were trying to provide that level of integration it would become a
much more restrictive environment. Instead it provides you with
enough tools and enough initial structure to keep your code clean,
and appropriately separated. It’s up to you to make sure that it’s
then easy to make additions and changes.