相比于 Django、Pylon 等 Python 框架,Ruby on Rails 是否有很
来源:网络整理 网络用户发布,如有版权联系网管删除 2018-08-13
个人感受
ruby在DSL上有很大的优势。用来测试的rspec非常好用。 自动化的测试非常重要,没有测试,很多东西根本就没办法做。
元编程。python的程序员似乎很排斥这个,ruby则觉得这东西很好。
django的源代码很长,越长就越不好读。老大要我在many to many表中加个method,我记得我至少改动了3,4个地方才把这个method改过来(不排除我的方法有问题)。觉得理想状态是只要更改一个地方就好。
Berkeley讲开发选择了rails,而且在berkeley此前的课程完全没有ruby。而且berkeley的cs61a,人工智能,都是学python的。
Berkeley在software as a service这门课程的书中说
Why Ruby and Rails? Why Not Java, C++, Python, or Scala?
We want students to understand that in the real world, programmers are rewarded not for the number of lines of code written or for how quickly they can “bash out” a feature, but for functionality delivered with high assurance of stability and while keeping the codebase beautiful andmaintainablefor continued growth. To many students, especially “hotshot” coders who come into a software engineering course with nontrivial programming experience, the methodologies and techniques we use to do thisdesign patterns, refactoring, test-first development, behavior-driven designseem a strange and a dubious use of time.
We have found that students are more likely to gradually embrace these practices if given the best possible tools to support the practices. The Rails community has created by far the most seamless, elegant, and comprehensive tool set to support Agile and XP, and the idea of constantly refining and inventing tools that support testing as well as helping produce beautiful application code is a distinguishing characteristic of the Ruby developer ecosystem. While learning Ruby and Rails will be new to most students, juniors and seniors seem to learn it without difficulty, and far superior tools outweigh the learning costs.
A common counterargument in academia is “Our curriculum already teaches language X, so upper-division courses should leverage that knowledge.” We believe this approach optimizes for the wrong thing. First, software professionals are routinely expected to learn new languages by applying concepts from languages they already know, so “learning how to learn” new languages is a good skill to cultivate in class. Second, a language that makes it difficult to write and test beautiful and concise code is a poor vehicle for teaching those techniques, so the only investment being “leveraged” is syntactic knowledge, a hurdle surmounted with relative ease. Thus, even if our students never use Ruby again, they will have learned how to reduce to practice such important ideas as metaprogramming, higher-order programming, functional programming, and use of closures in the service of higher productivity and more maintainable code. We believe these skills will transfer to new languages, framework, and programming systems. Our survey of alumni of the course that led to this book (see Chapter 13) suggests that our belief is well founded.
查看评论 回复