Ruby on Rails questions about maintenance and dsl's

Hi,

I’m trying to find answers to the following questions and maybe some
of you can give me a clue or direction. Especially pointers to
publications would be a pro!

  1. 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

  2. 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 ?

What do you guys think ?

Bye,
Arjen

  1. Is rails a true DSL?

Yes.

  1. 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 ?

My opinion is don’t use scaffold to learn RoR, learn the basics and
write your own code. Use scaffold only for prototype. In that case you
throw away the code so the question of maintenance is mute. The main
outcome of the prototype might be to clarify vague / conflicting
requirements and as a level of effort estimation tool.

I agree completely - I spent too much time thinking I could use
scaffolds and turn them into something production-ready, and the big
breakthrough came when I decided to just ditch them completely and do
it on my own.

Rails is so quick and easy to use, that relying on scaffolds is just
about pointless.

That said, they make for a hell of an impressive demo - when you can
knock up a trivial admin interface within a few seconds, it tends to
leave an impression.

Regards

Dave M.

On Mar 8, 2007, at 4:12 PM, Arjen van Schie wrote:

  1. 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
rails.

  1. 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
rudimentary apps.

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
table.

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.

James.


James S.
Play: http://james.anthropiccollective.org
Work: http://jystewart.net/process/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs