Ruby on Rails
DEFINITION: Ruby on Rails is a software development environment that is built with and uses the object-oriented programming language Ruby, with the overall aim of making programmers’ jobs both more fun and more productive.
The programming language Ruby has been around since 1993. Initially popular in Japan, its use has been growing and widening. Ruby got a big boost in 2004 with the release of a new programming environment called Rails that was built around Ruby. Before discussing Rails, let’s first examine Ruby and see what makes it different from other languages.
Ruby is a pure object-oriented, open-source programming language with a very clean syntax that one writer has said “combines Smalltalk’s elegance, Python’s ease of use and Perl’s pragmatism.” An interpreted scripting language, Ruby is as useful for creating small ad hoc scripts as it is for full-scale applications. Using a direct-execution model and dynamic typing, Ruby lets you develop code incrementally; in most cases, you can add a feature and then try it immediately. Ruby programs are usually shorter than their Perl, Python or C++ counterparts.
Ruby’s creator, Yukihiro Matsumoto, has said he wanted a language that would make him more productive and at the same time be fun to use. In fact, this desire for fun in programming is probably Ruby’s biggest single point of differentiation from any other language. When one first starts reading the Ruby literature, it’s easy to think that it’s a boutique language with a cultlike following of near-fanatic users. But remember that Perl, PGP and Python started out in much the same way.
Every language is designed with specific purposes: ease of coding; compactness of code; readability; speed of execution; orientation for specialized situations such as text processing, database handling or numerical computation. Even so, with most languages that are Turing-complete, you can pretty much do anything you need; the practical differences from one to another will be in the areas of form, style, size, ease of use or maintainability. For example, Python and Ruby provide almost the same power to the programmer.
Ruby’s syntax is such that once you’re familiar with its vocabulary and style, you can read many lines of code in something like natural language, making programs much easier to understand and maintain. Ruby eliminates the need to start out each program with long statements declaring structures and variables.
Like Perl, Ruby has features that make it easily adaptable to processing text files and to systems management tasks. You can add methods to a class, or even to an instance during runtime, so that you can have an instance of one class behave differently from other instances of the same class. Also like Perl, but quite different from Python, Ruby lets you code things in many ways, thus it can appeal to programmers with very different styles and personalities.
Rails is a full-stack, open-source programming framework implemented in Ruby and designed for writing database-oriented real-world Web applications quickly and easily. It was created by David Heinemeier Hansson, a Danish college student, based on a project management tool he’d written called Basecamp. Ruby on Rails was released to the public in July 2004.
By full-stack framework, Hansson means that all layers are built to work together so that you don’t repeat yourself (DRY) and you can use a single language from top to bottom. Everything in Rails is written in Ruby. To achieve DRY, Rails relies on a couple of guiding principles.
The first is less software, meaning you write fewer lines of code. Keeping code small speeds development and makes for fewer bugs, and it makes code easier to understand, maintain and enhance. One feature of Ruby that contributes to writing less code is that it assumes that the framework itself can and should handle metadata.
The second is the principle of convention over configuration, meaning that Rails doesn’t use configuration files, relying instead on some simple programming conventions that let it figure out what it needs to know by using information already contained in the application code and the database that’s running.
Ruby on Rails
定义：Ruby on Rails是一种软件开发环境，它是利用面向对象编程语言Ruby构建起来的，其总的目标就是要使程序员的工作比较有趣、生产率也较高。
Rails是用Ruby实现的全堆栈、开放源码的编程架构，旨在快速、简易地编写面向数据库的、真实世界的Web应用程序。它是由一名丹麦的大学生David Heinemeier Hansson发明的，它基于一个由他编写的称作Basecampde的项目管理工具。Ruby on Rails是在2004年7月公开的。