亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        等級考試四級計算機專業(yè)時文選讀:RubyonRails

        字號:

        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是一種軟件開發(fā)環(huán)境,它是利用面向?qū)ο缶幊陶Z言Ruby構(gòu)建起來的,其總的目標就是要使程序員的工作比較有趣、生產(chǎn)率也較高。
            編程語言Ruby自1993年起就已存在。最初,它在日本很流行,其應用在擴大。在2004年,隨著一個叫Rails、圍繞Ruby構(gòu)建起來的新穎編程環(huán)境的問世,Ruby獲得了一次大發(fā)展。在討論Rails之前,先讓我們看看Ruby,它是如何使其有別于其他的語言。
            Ruby是一種純粹的面向?qū)ο蟮拈_放源碼的編程語言,它有非常清晰的語法,有位作者稱,它將Smalltalk的精致、Python的易用和Perl的實用結(jié)合一身。作為一種解釋型的腳本語言,Ruby對生成短小的特定腳本與編寫完整的應用程序一樣有用。利用直接執(zhí)行模型和動態(tài)鍵入,Ruby讓你用逐步增加的方式開發(fā)程序,在多數(shù)情況下,你能增加一個功能,并能馬上進行試驗。Ruby程序通常比同類的Perl、Python、或C++程序都要短。
            Ruby的發(fā)明人Yukihiro Matsumoto說過,他需要一種既能使他有較高的生產(chǎn)率,同時又能樂意使用的語言。事實上,讓編程好玩的想法可能是Ruby與其他任何一種語言的不同之處。當一個人首次閱讀Ruby文獻時,很容易就認為它是一種熱門的語言,有著一群近乎狂熱的用戶崇拜它追隨它。但請記住,Perl、PGP和Python開始時也有類似的情況。
            每一種語言都是為特定目的設計的:易于編程、程序緊湊、可讀性、執(zhí)行速度、面向特定情形(如文本處理)、數(shù)據(jù)庫處理或數(shù)值計算。即便這樣,對于大多數(shù)具有完整圖靈原理的語言來說,你能用它們做你需要做的任何事,它們之間實際上的差異在于形式、風格、大小、易用性和可管理性。例如,Python和Ruby給程序員提供了幾乎是相同的功能。
            Ruby的語法就是這樣的:一旦你熟悉它的詞匯和風格,你就能像讀自然語言那樣一目幾行,使得程序更容易理解和維護。Ruby不需要在開始每個程序時先寫很長的注釋語句,說明結(jié)構(gòu)和變量。
            Ruby像Perl那樣具有不少功能,使之很容易適應處理文本文件和系統(tǒng)管理等任務。你能給類增加方法,甚至在運行中給實例增加方法,從而你就能擁有不同于同一類的其他實例的類行為實例。Ruby還能像Perl那樣、但不同于Python,讓你用多種方法對事情編程,因而它能以不同的風格和個性吸引程序員。
            Rails是用Ruby實現(xiàn)的全堆棧、開放源碼的編程架構(gòu),旨在快速、簡易地編寫面向數(shù)據(jù)庫的、真實世界的Web應用程序。它是由一名丹麥的大學生David Heinemeier Hansson發(fā)明的,它基于一個由他編寫的稱作Basecampde的項目管理工具。Ruby on Rails是在2004年7月公開的。
            所謂全堆棧架構(gòu),Hansson是要構(gòu)建所有層面,以便一起工作,從而你不必重復你自己的工作(DRY),從頂?shù)降锥寄苡猛徽Z言。Rails中所有東西都是用Ruby寫的。為了獲得DRY,Rail有兩條指導原則。
            第一條是較小的軟件,這意味著你編寫較少的程序行。程序小就能加速開發(fā),錯誤也較少,使得程序較容易理解、維護和增強。對編寫較小程序做出貢獻的Ruby的一個特性就是它假設該架構(gòu)本身能夠并應該處理元數(shù)據(jù)。
            第二條是對配置的協(xié)定原理,這意味著Rails不用配置文件,而是依靠一些簡單的編程協(xié)定,讓它通過利用應用程序已有的信息和在運行的數(shù)據(jù)庫,解決它需要知道什么這個問題。