2. What is Ruby
● A dynamic, reflective, object-oriented,
general-purpose programming language.
● It was designed and developed in the mid-
1990s by Yukihiro "Matz" Matsumoto in
Japan.
3. Why Ruby
● 一個簡易且充滿生產力的開放原碼動態程式設計語言。
高雅的語法,得以自然的閱讀與易於撰寫。
o 萬物即物件
5.times { print "We *love* Ruby -- it's outrageous!" }
o 靈活性
class Numeric
def plus(x)
self.+(x)
endendy = 5.plus 6
o https://www.ruby-lang.org/zh_tw/about/
4. Try Ruby
● first 15 minutes
o http://tryruby.org/levels/1/challenges/0
● try others
o https://www.ruby-lang.org/zh_tw/documentation/
5. What is Rails
● Ruby on Rails(RoR), offen simply Rails, is
an open source web application framework
which runs via the Ruby programming
language.
● 非常有生產力、維護性高、容易佈署的Web
開發框架。
6. What is MVC (1)
● 非常多的Web框架都實踐一個叫做MVC的軟體架構設計
模式,將軟體分成三個部分
o Model: 物件包裝了資料與商業邏輯,例如操作資料庫
o View: 表示使用者介面,顯示及編輯表單,可內嵌Ruby程式的HTML
o Controller: 負責將資料送進送出Model,處理從外界(也就是瀏覽器)來
的HTTP Request請求,與Model互動後輸出View(也就是HTML)
8. Why Rails (1)
● Philosophy
o Don't Repeat Yourself(DRY)
By not writing the same information over and over again, our code
is more maintainable, more extensible, and less buggy.
o Convention Over Configuration(COC)
慣例勝於設定, Rails會預設各種好的設定跟慣例,而不是要求你設
定每一個細節到設定檔中。