2. What is Rails?
Rails is a web application development
framework written in the Ruby.
13年4月18日木曜日
3. The Rails philosophy includes
several guiding principles
•DRY (Don’t Repeat Yourself)
•CoC (Convention over Configuration)
•REST(REpresentational State Transfer)
Railsはソフトウェア開発上重要な、いくつかの設計実装
手法、考え方を元に作成されている。
13年4月18日木曜日
4. DRY
Every piece of knowledge must have a
single, unambiguous, authoritative
representation within a system.
すべての知識はシステム内において、単一、かつ明確な、そして
信頼できる表現になっていなければならない。
13年4月18日木曜日
6. CoC
Design paradigm to decrease the
number of decisions that developers
need to make, gaining simplicity, but not
necessarily losing flexibility.
設定より規約。規約に従った実装を行い、開発者に決
定させるべきことを少なくし、単純さを維持する。
13年4月18日木曜日
7. CoC
• Mapping File ( Class to DB Table )
• Class Name/ Method Name
• Folder Structure/ Namespace Design
• Template Method/ Class Design
13年4月18日木曜日
8. REST
REST is an architectural style and the
best pattern for web application.
RESTは、アーキテクチャスタイルの一つであり、良
いWEBアプリケーションのためのパターンである。
13年4月18日木曜日
9. REST
Resource Resource
Each request includes all of the
information.
HTTP
The set of operations supported
by the web service using HTTP
methods as known well-defined-
interface (e.g., GET, PUT, POST, or
DELETE).
Uniform Interface
Stateless
HTML,XML or JSON etc
HTML,XML or JSON etc
Response is cacheable to
improving scalability and
performance.
Cacheable
KEY GOALS of REST include:
•Scalability of component interactions
•Generality of interfaces
•Independent deployment of components
•Intermediary components to reduce latency, enforce security and encapsulate
legacy systems
13年4月18日木曜日
10. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
13年4月18日木曜日
11. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
Controller
View Model Storage
13年4月18日木曜日
12. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
①
Controller
View Model Storage
Request to controller from user interface
13年4月18日木曜日
13. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
①
②
Controller
View Model Storage
Request to controller from user interface
Controller calls Model and gets results
13年4月18日木曜日
14. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
①
②③
Controller
View Model Storage
Request to controller from user interface
Controller calls Model and gets results
Controller puts View the results
13年4月18日木曜日
15. MVC
Model-View-Controller
• Isolation of business Logic from the user interface
• Ease of keeping code DRY
• Making it clear where different types of code belong for
easier maintenance
①
②③④
Controller
View Model Storage
Request to controller from user interface
Controller calls Model and gets results
Controller puts View the results
View is rendered user interface
13年4月18日木曜日
20. MVC on Rails
①
Controller
View Model DB
Router discovers controller to execute and Rails executes the controller
Router
②
Browser posts request to Router
13年4月18日木曜日
21. MVC on Rails
①
③
Controller
View Model DB
Router discovers controller to execute and Rails executes the controller
Controller calls Model and gets results
Router
②
Browser posts request to Router
13年4月18日木曜日
22. MVC on Rails
①
③④
Controller
View Model DB
Router discovers controller to execute and Rails executes the controller
Controller calls Model and gets results
Controller puts View the results
Router
②
Browser posts request to Router
13年4月18日木曜日
23. MVC on Rails
①
③④⑤
Controller
View Model DB
Router discovers controller to execute and Rails executes the controller
Controller calls Model and gets results
Controller puts View the results
View is rendered user interface
Router
②
Browser posts request to Router
13年4月18日木曜日