Rails或Django? [英] Rails or Django?

查看:146
本文介绍了Rails或Django?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自PHP背景,并计划尝试一个新的框架。之前从来没有做过Ruby或Python。



了解PHP,什么语言会更容易学习?

解决方案

刚刚开始学习Django,在几个晚上阅读python教程后。我注意到的事情:




  • 在星期天下午,我设法创建了两个功能齐全的列表/添加页面。 >
  • 我的代码已经很短,甚至可以在一些修订中缩短更多的时间。

  • Views API,模板语言和ORM真的允许你加快

  • 感觉就像飞行!这里有一个事实: http://xkcd.com/353/ :D



根据我目前为止所读的内容,我对Django vs Rails的支持:




  • 在Python中,事情更加明确。只需使用记事本,您仍然可以知道从哪里导入功能。

  • 当您尝试调用它们时,Rails会根据需要神奇地创建方法(例如find_by _...方法)。避免无用的方法编程,同时需要更多的知识。







  • Django通过提供通用视图来增加生产力(认为它们是基类)。

  • Rails通过提供脚手架(生成代码)来提高生产率。







  • Django需要指定您的模型显示。

  • Rails可以在运行时从数据库模式中提取模型。







  • Django从第一天开始就表现出色。

  • 在Rails中,程序员的生产率被认为更重要。






这是Rails和Django之间的区别imho真的归结为:Rails根据惯例做事情。 Django需要你更加明确一些,这样可以让框架执行得更好。你会喜欢哪一个,这在很大程度上取决于你是什么样的程序员。我显然是一个Python / Django的人;)






两者都可以直接启动开发服务器对于.NET)。两者都允许FastCGI托管(如IIS应用程序池),可以在JVM(JRuby,Jython)上运行,并且都有一个运行应用程序池的专用解决方案(在Django中使用mod_wsgi,在Rails的情况下为mod_rails)。 p>

其他值得充分阅读的内容有: -



http://www.ctctlabs.com/index.php/blog/detail/rails_vs_django/



http://mackstar.com/ blog / 2010/04/23 / django-vs-rails



http://superjared.com/entry/rails-versus-django/



http://docs.google.com/view?docid=dcn8282p_1hg4sr9



http://www.magpiebrain.com/2005/08/14/a-comparison-of-django-with-rails/


I come from a PHP background and was planning to try out a new framework. I have never done Ruby or Python before.

Knowing PHP, what language would be easier to learn?

解决方案

I've just started learning Django, after reading the python tutorial in a few evenings. Things I've noticed:

  • In a sunday afternoon, I've managed to create two fully functional list/add pages.
  • My code was already pretty short, and could even get more shorter in a few revisions.
  • The views API, template language and ORM really allows you to speed up.
  • It felt like flying! There is a truth in this one: http://xkcd.com/353/ :D

My take on Django vs Rails, based on what I've read so far:

  • In Python, things are more explicit. Using just notepad, you can still tell where a function is imported from.
  • Rails will magically create methods on demand when you try to invoke them (e.g. find_by_... methods). Avoiding useless method programming, while requiring some more knowledge.

  • Django additionally increases productivity by offering generic views (think them as base classes).
  • Rails additionally increases productivity by offering scaffolding (generating code).

  • Django requires to you specify your model explicity.
  • Rails can extract your model at runtime from your database schema.

  • Django had performance in mind from day 1.
  • In Rails programmer productivity is seen as more important.

This is where IMHO the difference between Rails and Django imho really boils down to: Rails does things "by convention". Django requires you be a little more explicit, which in return allows the framework to perform better. Which one you'll like, depends pretty much on what kind of programmer you are. I'm obviously a Python/Django guy ;)


Both allow you to start a development server directly (like VS offers for .NET). Both allow FastCGI for hosting (like IIS app pools), can be run on the JVM (JRuby, Jython) and both have a specialized solutions for running an app pool (mod_wsgi in case of Django, mod_rails in case of Rails).

Some other worth full readings are:-

http://www.ctctlabs.com/index.php/blog/detail/rails_vs_django/

http://mackstar.com/blog/2010/04/23/django-vs-rails

http://superjared.com/entry/rails-versus-django/

http://docs.google.com/View?docid=dcn8282p_1hg4sr9

http://www.magpiebrain.com/2005/08/14/a-comparison-of-django-with-rails/

这篇关于Rails或Django?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆