Live data from Hacker News

Thoughts about Rails from a Django guy

lenni.info

11–20 of 42 posts

Re: Thoughts about Rails from a Django guy

#12
post #9

I subscribe to the view that the template language is for designers and should only allow safe constructs. As someone who does both design and programming, I hate template systems that do this with a passion. I don't want to have to learn another language just so I can write templates. Especially when that language makes me jump through hoops to do various simple tasks the designers didn't anticipate--which is the ca…

This is one of the reasons I'm fond of Perl's Template::Declare. It's a declarative syntax for generating HTML that's still just plain Perl.

http://search.cpan.org/~sartak/Template-Declare-0.43/lib/Tem...

I certainly understand the use case of more-limited and embedded template languages, for working with designers or people less-comfortable with actual programming, or whatever, but when I'm just working on my own, or only with other programmers, Template::Declare works so much more nicely for me.

Re: Thoughts about Rails from a Django guy

#13

The difference between ActiveRecord and Django models, is ActiveRecord reads the schema. When you're developing, having an ORM create tables and add colums willy nilly is fine. DataMapper took this approach initially, and was basically unusable in production because all it could do was create and drop tables. They've since added a handy upgrade method, and even ActiveRecord style migrations. Personally, I like keepin…

Just clarifying, Django models only create the initial tables/columns of a model after running the `syncdb` command. If you add fields later on, you'll need to write the SQL to add the columns yourself (http://code.djangoproject.com/wiki/SchemaEvolution). It won't try to be smart and automatically migrate your db for you.

I haven't used DataMapper in a few years, but I remember their initial approach was to be smart and automagically add/remove any required columns/tables willy nilly.

Re: Thoughts about Rails from a Django guy

#14

About two years ago I tried a lot of different frameworks and languages to find which one would suit me best. After having tried various PHP frameworks, J2EE, Perl I arrived at Django/Python. The plan was to continue on to Rails after Django, but I loved Django so much that I couldn't imagine that Rails could be any better. Seems like I was right ;) Like the author, I too think Django's default directory structure do…

For useful, non-trivial directory structure examples for Django projects, be sure to see the Pinax project:

http://pinaxproject.com/

Pinax comes with quite a few example projects using a common directory structure, which is very well thought-out, separating media, reusable apps, common templates, etc.

Re: Thoughts about Rails from a Django guy

#15
post #12
post #9

I subscribe to the view that the template language is for designers and should only allow safe constructs. As someone who does both design and programming, I hate template systems that do this with a passion. I don't want to have to learn another language just so I can write templates. Especially when that language makes me jump through hoops to do various simple tasks the designers didn't anticipate--which is the ca…

This is one of the reasons I'm fond of Perl's Template::Declare. It's a declarative syntax for generating HTML that's still just plain Perl. http://search.cpan.org/~sartak/Template-Declare-0.43/lib/Tem... I certainly understand the use case of more-limited and embedded template languages, for working with designers or people less-comfortable with actual programming, or whatever, but when I'm just working on my own, o…

There's a ruby equivalent that's pretty nice called Erector: http://erector.rubyforge.org/ http://pivotallabs.com/users/alex/blog/articles/1029-why-wou...

Re: Thoughts about Rails from a Django guy

#16
post #13

The difference between ActiveRecord and Django models, is ActiveRecord reads the schema. When you're developing, having an ORM create tables and add colums willy nilly is fine. DataMapper took this approach initially, and was basically unusable in production because all it could do was create and drop tables. They've since added a handy upgrade method, and even ActiveRecord style migrations. Personally, I like keepin…

Just clarifying, Django models only create the initial tables/columns of a model after running the `syncdb` command. If you add fields later on, you'll need to write the SQL to add the columns yourself ( http://code.djangoproject.com/wiki/SchemaEvolution ). It won't try to be smart and automatically migrate your db for you. I haven't used DataMapper in a few years, but I remember their initial approach was to be smar…

Just to clarify even more, you should be using South (http://south.aeracode.org/), the first thing on that list, and you usually don't have to write the SQL yourself.

Re: Thoughts about Rails from a Django guy

#17
post #9

I subscribe to the view that the template language is for designers and should only allow safe constructs. As someone who does both design and programming, I hate template systems that do this with a passion. I don't want to have to learn another language just so I can write templates. Especially when that language makes me jump through hoops to do various simple tasks the designers didn't anticipate--which is the ca…

It's funny the author put templating as one of the things he dislikes about rails, especially when the Django templating system is probably one of the worst (of all templating systems out there). They invented their own pseudo language for templating so anything more complicated requires you to write your own special helper functions. I remember back in Django 0.9 (which is still fairly recent), I had to write template library code to do a nested loop over a data structure.

Why couldn't they just write it in python instead of inventing strange keywords like "ifequal"? Every time I use django templates, I have to look up documentation on how to do something as simple as string/number comparison. When I write Myghty templates, I'm writing python on top of html and it just feels so much nicer this way.

Re: Thoughts about Rails from a Django guy

#18

About two years ago I tried a lot of different frameworks and languages to find which one would suit me best. After having tried various PHP frameworks, J2EE, Perl I arrived at Django/Python. The plan was to continue on to Rails after Django, but I loved Django so much that I couldn't imagine that Rails could be any better. Seems like I was right ;) Like the author, I too think Django's default directory structure do…

See http://ericholscher.com/projects/django-conventions/ also.

Re: Thoughts about Rails from a Django guy

#19

there are drop in admin options for rails similar to what django provides as well as a i massive number of templating engines including ones like liquid which address the concerns in the article. as a general rule, i think you should probably do more than 1 simple project before evaluating any framework or language.

I use both django and rails frequently, and I've been looking for a rails version of django's admin forever. Do you have any links?

All I've seen are things like activescaffold, but that's not even anywhere near being comparable.

Re: Thoughts about Rails from a Django guy

#20
As a full-time Rails developer I think some of these gripes are valid.

I have tried to get away from AR for a long time, with other ORMs such as DataMapper or Sequel, and more recently Mongoid. The AR in Rails 3 has adopted some of the good bits from both DM and Sequel, so that might make it more pleasant to work with.

In terms of templates, HAML/SASS are popular alternatives to ERB. For the admin backend; there are plugins for it.

Post reply on HN