Ruby Rails的設計哲學

來源:互聯網
上載者:User

Rails把java的方式戲稱為XML仰臥起坐(sit-ups)。

Rails是一個完整的,開源的web開發架構,更多的快樂和更少的代碼。

貫穿整個架構的是DRY(不要重複)原則,具體體現比如:定義好資料庫表後,類名字和對象屬性名稱字都自動確定了。用過hibernate的朋友知道我在說什麼(你也許會說xdoclet, 那不也得學嗎)。

學習成本低,不需要學習各種XML花式(學習過struts,spring,hiber,webwork,ant,maven的朋友知道我在說什麼),只需要學習Ruby語言就夠了。

編程的快樂又回來了,沒有編譯和部署,即改即得,所有的複雜都隱藏在架構內部了。

你感受到它的哲學了嗎?自己安裝試試看吧。

===========================================

作為對照,以下文字來自rails網站首頁:

Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups

Being a full-stack framework means that all layers are built to work seamlessly together. That way you Don’t Repeat Yourself (DRY) and you can use a single language from top to bottom. Everything from templates to control flow to business logic is written in Ruby—the language of love for industry heavy-weights.

In striving for DRY compliance, Rails shuns configuration files and annotations in favor of reflection and run-time extensions.

This means the end of XML files telling a story that has already been told in code. It means no compilation phase: Make a change, see it work. Meta-data is an implementation detail left for the framework to handle.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.