• Ruby Rails的设计哲学


    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(7)
    抽象工厂模式4(6)
    工厂方法模式3(5)
    jxl导出excel(2)
    jxl导入excel(1)
    java8新特性字符串转LocalDateTime转Date(6)
    极光推送java服务端-通知(2)
    极光推送java服务端-通知(1)
    SpringCloud微服务之Ribbon负载均衡(一)
    cenos7搭建gitlab
  • 原文地址:https://www.cnblogs.com/chenge/p/176403.html
Copyright © 2020-2023  润新知