Text of my 90 minutes lecture in Shimane Univ, learning web application through developing lucky-fortune application with Ruby on Rails. Most parts are written in Japanese.
The document discusses using Ruby to create domain-specific languages (DSLs). It provides examples of internal DSLs in Ruby, like Rails routes and migrations, which take declarative, natural language forms. The document encourages writing code in a DSL-like style by using declarative programming, blocks, and methods that represent special concepts. It also discusses how to structure code to express the "nature" or "essence" of a class through modules in a declarative way.
Pragmatic Patterns of Ruby on Rails - Ruby Kaigi2009Yasuko Ohba
This document discusses coding patterns for developing large and complicated Ruby on Rails applications. It recommends expressing business logic in models using object-oriented principles, following DRY, CoC and RESTful principles, and writing code in models' standard flows like find, new/save, find/update, and find/destroy. Filter methods are suggested to avoid duplicating code and improve readability. Moving branching logic based on parameters and other model processing code from controllers to models improves testability and reusability. Choosing natural coding styles for Rails that follow its core principles helps keep code maintainable for other developers. Sharing such pragmatic patterns is important for developing large codebases.
114. 関西Ruby会議02
よくあるアクションの
URL メソッド アクション
/groups GET index
/groups POST create
/groups/3 GET show
/groups/3 PUT update
/groups/3 DELETE destroy
/groups/new GET new
/groups/3/edit GET edit
株式会社万葉
2009年11月7日土曜日
122. 関西Ruby会議02
そこで
URL URL名 メソッド アクション
/groups GET index
groups
/groups POST create
/groups/3 GET show
/groups/3 group PUT update
/groups/3 DELETE destroy
/groups/new new_group GET new
/groups/3/edit edit_group GET edit
株式会社万葉
2009年11月7日土曜日
128. 関西Ruby会議02
名詞に注目
URL URL名 メソッド アクション
/groups GET index
groups
/groups POST create
/groups/3 GET show
/groups/3 group PUT update
/groups/3 DELETE destroy
/groups/new new_group GET new
/groups/3/edit edit_group GET edit
株式会社万葉
2009年11月7日土曜日
129. 関西Ruby会議02
動詞
種類 意味 特徴
GET 取得 リソースの状態を変更しない
PUT 更新/作成 URLの示すリソースが
DELETE 削除 処理後も同じリソース
POST なんか変更 上記以外
株式会社万葉
2009年11月7日土曜日
130. 関西Ruby会議02
動詞に注目
URL URL名 メソッド アクション
/groups GET index
groups
/groups POST create
/groups/3 GET show
/groups/3 group PUT update
/groups/3 DELETE destroy
/groups/new new_group GET new
/groups/3/edit edit_group GET edit
株式会社万葉
2009年11月7日土曜日