20090622 Bp Study#22
-
Upload
tomohito-ozaki -
Category
Documents
-
view
1.579 -
download
1
Transcript of 20090622 Bp Study#22
![Page 1: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/1.jpg)
scala/Lifton
GAE/J
BP Study #22
2009年6月28日日曜日
![Page 2: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/2.jpg)
自己紹介
• 尾崎 智仁( ゆろよろ)
• ID:yuroyoro(はてな、twitter、wassr)
• フリーエンジニア
• JavaとかScalaとかpythonとか
2009年6月28日日曜日
![Page 3: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/3.jpg)
コミュニティ
• java-ja (自重しません)
• wicket-ja (wicketイカス)
• django-ja (最近です)
• j iemamy project
• shibuya-trac (p lugin書いたり)
• scalaユーザー会2009年6月28日日曜日
![Page 4: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/4.jpg)
はじめに・・・
2009年6月28日日曜日
![Page 5: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/5.jpg)
遅刻しちゃってゴメンナサイ・・・
2009年6月28日日曜日
![Page 6: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/6.jpg)
今日の話は・・・
2009年6月28日日曜日
![Page 7: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/7.jpg)
GAE/Jってなに?みたいな話じゃありません
2009年6月28日日曜日
![Page 8: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/8.jpg)
今日の話は・・・
2009年6月28日日曜日
![Page 9: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/9.jpg)
スライドいっぱいあるけどさらっと流します。
ちょwwwおまwww
2009年6月28日日曜日
![Page 10: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/10.jpg)
今日の話は・・・
2009年6月28日日曜日
![Page 11: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/11.jpg)
好きなキャラに脳内で変換して
聞いてください・・・
2009年6月28日日曜日
![Page 12: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/12.jpg)
質問たーいむ!!
2009年6月28日日曜日
![Page 13: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/13.jpg)
お客様の中にどなたか
scalaのコードを書いたことが
ある方はいらっしゃいませんか?
2009年6月28日日曜日
![Page 14: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/14.jpg)
scalaはもっと普及
すべきである
2009年6月28日日曜日
![Page 15: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/15.jpg)
今日の内容
•GAE/JでのLift
•scalaの紹介!
•Liftの紹介っ!
•ざっくりアーキテクチャ!
•デモっ!
•まとめっ!2009年6月28日日曜日
![Page 16: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/16.jpg)
GAE/JでのLift
2009年6月28日日曜日
![Page 17: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/17.jpg)
war
GAE/J
JVM
scalaがGAE/Jで動く訳
scalaのソースをコンパイルするとclassファイルが生成される
deploy
コンパイル
.scala.scala
.scala.class
classファイルなのでそのまま動く!
scalaLibrary.jar
war
.scala.class
scalaLibrary.jar
2009年6月28日日曜日
![Page 18: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/18.jpg)
GAE/JでのLift
• mavenでproject作成
•JPAが使える(JDOも)
• SDK内のdatanucleus-
enhancerを1.1.3に差し替える
•Deployすればフツーに動く
2009年6月28日日曜日
![Page 19: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/19.jpg)
いまうごいてるやつ
• Liftで書いたTropyクローン
2009年6月28日日曜日
![Page 20: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/20.jpg)
GAE/Jの話は終わりです。
2009年6月28日日曜日
![Page 21: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/21.jpg)
scalaってどんな言語?
2009年6月28日日曜日
![Page 22: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/22.jpg)
scalaの特徴
• jvmで動きます!
•オブジェクト指向 + 関数型
•ファーストクラス関数
•静的型付け + 型推論
•Javaとの相互運用
2009年6月28日日曜日
![Page 23: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/23.jpg)
scalaの特徴
•作者:Martin Odersky
• caseクラス、パターンマッチ
• XMLリテラル
• Actorライブラリ
•DSLとしてのscala
2009年6月28日日曜日
![Page 24: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/24.jpg)
ちょっとしたscalaのDEMO
2009年6月28日日曜日
![Page 25: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/25.jpg)
インタプリタで動作を
確認してみよう!
2009年6月28日日曜日
![Page 26: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/26.jpg)
型推論
scala>vallist:List[Int]=List(1,2,3,4)
list:List[Int]=List(1,2,3,4)
scala>vallist=List(1,2,3,4)
list:List[Int]=List(1,2,3,4) 省略!
省略できる
2009年6月28日日曜日
![Page 27: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/27.jpg)
関数オブジェクト
scala>defisEven(i:Int):Boolean={return(i%2==0)}isEven:(Int)Boolean
scala>defisEven(i:Int)=i%2==0isEven:(Int)Boolean
scala>valfunc=isEven_func:(Int)=>Boolean=<function>
省略!
Javaっぽく書くとこんな感じ
関数をオブジェクトとして変数に
代入!
2009年6月28日日曜日
![Page 28: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/28.jpg)
高階関数とカリー化
scala>defadd(n:Int)(m:Int)=n+madd:(n:Int)(m:Int)Int
scala>valadd3=add(3)_add3:(Int)=>Int=<function>
scala>defcurryingAdd(n:Int)=add(n)_curryingAdd:(Int)(Int)=>Int
カリー化っ!!
カリー化された”関数”を返す関数
2009年6月28日日曜日
![Page 29: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/29.jpg)
Listの操作
scala>l.map({(n:Int)=>n*2})res1:List[Int]=List(2,4,6,8)
scala>list.filter(_%2==0)res2:List[Int]=List(2,4)
scala>list.filter(func)res3:List[Int]=List(2,4)
偶数の要素を抽出
map操作無名関数で各要素を2倍
関数オブジェクトを引数に渡す!
2009年6月28日日曜日
![Page 30: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/30.jpg)
パターンマッチ
deftest[T](list:List[T])=listmatch{case1::xs=>print("start1")case2::xs=>print("start2")case"Test"::xs=>print("startTest")casex::Nil=>print("oneelemnt")casex::xs=>print("start"+x)case_=>print("default")}
先頭が文字列で”Test”
Listの先頭が1の場合
要素が一つ
2009年6月28日日曜日
![Page 31: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/31.jpg)
クラスとオブジェクト
scala>classFoo(valn:Int,vals:String){defbar=print(n+s)}definedclassFoo
scala>objectFooObj{valn=3vals="Bar"defbar=print(n+s)}definedmoduleFooObj
Singletonオブジェクト
クラス名の後にコンストラクタ
2009年6月28日日曜日
![Page 32: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/32.jpg)
他にも変態的な言語仕様が盛りだくさん
trait
CompanionObject
ExtractorImplicit conversion
Structural typing
Lazy value
Partial Function
XMLリテラル
Implicitparameter
Existential type
Specialized annotation
2009年6月28日日曜日
![Page 33: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/33.jpg)
Liftの紹介っ!
2009年6月28日日曜日
![Page 34: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/34.jpg)
scala = 階段(イタリア語)
2009年6月28日日曜日
![Page 35: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/35.jpg)
Lift = エレベータ
2009年6月28日日曜日
![Page 36: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/36.jpg)
Functional Web Framework
Lift
2009年6月28日日曜日
![Page 37: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/37.jpg)
Liftの特徴
•Scalaです!
•フルスタックです!
•いいとこどりしてます!
2009年6月28日日曜日
![Page 38: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/38.jpg)
Liftの特徴
•現在のVersion 1.0
•scala 2.7.3
•Githubにソース
•チーフコミッタ David
Pollak
2009年6月28日日曜日
![Page 39: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/39.jpg)
Liftの特徴
•Scalaの関数型言語や
型推論に加え、既存の
java資産が利用できるん
です!
2009年6月28日日曜日
![Page 40: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/40.jpg)
Liftの特徴
•インストールやサーバ
の起動はrailsみたいに
Mavenコマンド一発。
•組み込みDB (Derby)
2009年6月28日日曜日
![Page 41: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/41.jpg)
Liftの特徴
•設定はCocとScala
コード。XMLなし!
•SiteMapやACL
•アプリのテンプレート
2009年6月28日日曜日
![Page 42: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/42.jpg)
Liftの特徴
•jQueryによるAjax!
•Cometを簡単に!
•各種Widgetがあるよ!
•GAE/Jでも動くよ!
2009年6月28日日曜日
![Page 43: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/43.jpg)
ざっくりアーキテクチャ!
2009年6月28日日曜日
![Page 44: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/44.jpg)
Liftのアーキテクチャ
Model
LiftFilter
LiftServlet
Boot
LiftRule
LiftSession
RequestState
Snippet
HTML Template
Requestを受けるfilter
URLのDispatchなどのルール
DBなどの動作環境の設定情報
Reqeustの種類(Commet,Ajax)による振り分け
Sessionを扱うRequestの処理。
RequestとResponseの情報。
XHTMLでのテンプレート
Viewへの出力やModelの操作など
KeyedMapper
KeyedMetaMapperORMでのtrait
CRUD関連処理を継承
フォームの入力値などを参照
Modelの操作
XHTMLタグでSnippetを埋め込む
URLなどからTemplateを検索
URLによる振り分け
2009年6月28日日曜日
![Page 45: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/45.jpg)
LiftのアーキテクチャLiftはscalaで実装されたフルスタックのWebアプリケーションフレームワーク
であり近年のフレームワークのエッセンスを取り入れている。Liftのアーキテ
クチャはView Firstでありリクエストに対しての (開発者が意識すべき) コント
ローラというものは存在しない。リクエストに対してはtemplateのレンダリン
グの過程でbindされたsnipetをliftが呼び出すことで出力が行われる。snipet
は、後述するmodelを利用した動的な出力の生成などを行う。また、snipetで
出力を生成する際に、特定のHTML上のコンポーネントに対してのイベントハ
ンドラを独自に用意したFunctionオブジェクトに割り当てる(Function
Mapping)ことが可能であり、さらに、snipet自体がstateを保持することが可
能になっているおかげで、snipet=コンポーネントという形での開発スタイル
が確立されている。このようなアーキテクチャを拡張する形で、近年のwebア
プリケーション開発では必須ともいえるajaxのサポートが提供されており、
簡便なAPIで出力上のHTMLエレメントに対してのajaxイベントを特定の
functionに割り当て、動的なjavascriptやjsonを簡単に出力できる。このajax
を利用したcometを実現するsnipetも提供されており、今はすでに無きLingrの
ようなインタラクティブなwebアプリケーションを少ない行数で実現すること
が出来るのである。さらに、LiftのORMライブラリはActiveRecordを意識した
2009年6月28日日曜日
![Page 46: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/46.jpg)
2009年6月28日日曜日
![Page 47: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/47.jpg)
開発者がつくるもの
LiftFilter
LiftServlet
LiftRule
LiftSession
RequestState
Requestを受けるfilter
URLのDispatchなどのルール
Reqeustの種類(Commet,Ajax)による振り分け
Sessionを扱うRequestの処理。
RequestとResponseの情報。
KeyedMapper
KeyedMetaMapperORMでのtrait
CRUD関連処理を継承
フォームの入力値などを参照
Modelの操作
XHTMLタグでSnippetを埋め込む
URLなどからTemplateを検索
URLによる振り分け Model
Boot
Snippet
HTML Template
DBなどの動作環境
の設定情報
XHTMLでのテンプ
レートViewへの出力
やModelの操作
2009年6月28日日曜日
![Page 48: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/48.jpg)
開発者がつくるもの
•設定 Boot (scala)
•テンプレート(XHTML)
• Snipet(scala)
• Model(scala)
2009年6月28日日曜日
![Page 49: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/49.jpg)
LiftのView
2009年6月28日日曜日
![Page 50: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/50.jpg)
LiftのView
•Snipetアプローチ
classHelloWorld{
defhowdy=<span>Welcometohelloworldat
{new_root_.java.util.Date}</span>
}
Snipet(scala)
<p><lift:helloWorld.howdy/></p>Template
2009年6月28日日曜日
![Page 51: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/51.jpg)
LiftのView
•コントローラが中心では
なく、Viewを中心とした
アーキテクチャ
Viewsnipet model
snipet model
2009年6月28日日曜日
![Page 52: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/52.jpg)
LiftのView
•テンプレートはXHTML。独
自の名前空間のXMLタグと
Snippetを結合!
snipetView XMLタグ
2009年6月28日日曜日
![Page 53: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/53.jpg)
LiftのView
• Function Mapping•イベントに”関数オブジェク
ト”を動的に割り当てる!
ブラウザ class snipet{def bar(xhtml:Group):NodeSeq ={ ....}
ボタンクリックで関数を実行
レンダリング時に動的に割り当て
2009年6月28日日曜日
![Page 54: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/54.jpg)
LiftのView
•テンプレートの例 (Form)
<lift:SampleSnipet.addform="POST">
<entry:description/>
<entry:amount/><br/>
<entry:submit/>
</lift:SampleSnipet.add>
snipetのクラス名 メソッド名
2009年6月28日日曜日
![Page 55: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/55.jpg)
LiftのView
• Snipetの例 (Form)classSampleSnipetdefadd(xhtml:NodeSeq):NodeSeq={vardesc=""varamount="0"defprocessEntryAdd(){...}bind("entry",xhtml,"description"->SHtml.text(desc,desc=_),"amount"->SHtml.text(amount,amount=_),"submit"->SHtml.submit(Add,processEntryAdd))}}
submitされたときにprocessEntryAddメソッドを呼び出す
snipetクラス
メソッド
2009年6月28日日曜日
![Page 56: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/56.jpg)
LiftのModel
2009年6月28日日曜日
![Page 57: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/57.jpg)
LiftのModel
•MappingはCoC
•schemifyによる同期
•動的SQL
•(s2jdbc的な…)
•CRUDify(trait)•JPAサポート
2009年6月28日日曜日
![Page 58: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/58.jpg)
LiftのModel
•Mapper (trait)‣ entityクラス
‣ カラムの定義
‣ crud操作 (save,update,delete)
•MetaMapper (trait)‣ sigleton、Maperのファクトリ
‣ findなどのメソッド
‣ ユーティリティ(order定義、form生成,validate…)
2009年6月28日日曜日
![Page 59: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/59.jpg)
Database
LiftのModel
Mapper
MetaMapper
aaa bbb 1ccc ddd 2eee fff 3
1レコードに対応
テーブル単位の操作
Schemify
CoCでmapping
Insert,Update,Delete
Select
migration インスタンス生成
2009年6月28日日曜日
![Page 60: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/60.jpg)
LiftのModel
•Mapperの例 classExpenseextendsLongKeyedMapper[Expense]withIdPK{
defgetSingleton=Expense
objectdateOfextendsMappedDateTime(this)
objectdescriptionextendsMappedString(this,100)
objectamountextendsMappedDecimal(this,
MathContext.DECIMAL64,2)
objectaccountextends
MappedLongForeignKey(this,Account)
}
KeyedMapperを継承
PK
カラムの定義(型、桁数…)
外部キーリレーション
2009年6月28日日曜日
![Page 61: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/61.jpg)
LiftのModel
•MetaMapperの例 objectExpenseextendsExpensewithLongKeyedMetaMapper[Expense]{
overridedeffieldOrder=
List(dateOf,description,amount)
}
Mapperを継承
KeyedMetamapper
並び順(form生成など)
2009年6月28日日曜日
![Page 62: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/62.jpg)
LiftのModel
•検索するときは…
valmyEntries1=Expense.findAll
valmyEntries2=Expense.findAll(By_>(Expense.amout,5))
valrecentEntries=Expense.findAll(
BySql("dateOf>(CURRENT_DATE-interval’30days’)",
IHaveValidatedThisSQL("dchenbecker","2008-12-03"))
全件検索
amount >5 で検索
SQLで検索
2009年6月28日日曜日
![Page 63: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/63.jpg)
LiftのModel
• entityの操作は…varmyEntr=Expense.create
myEntry.dateOf(newDate).description("Asampleentry")
myEntry.amount(BigDecimal("127.20"))
myEntry.save
myEntry.delete
2009年6月28日日曜日
![Page 64: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/64.jpg)
デモっ!
2009年6月28日日曜日
![Page 65: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/65.jpg)
demo その1
• Liftの真骨頂はcometにあり!
• scalaのactorを利用したsinpet
•TwitterのTimelineを流すデモ
•ソースはGithubhttp://github.com/yuroyoro/s2condemo/tree/master
2009年6月28日日曜日
![Page 66: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/66.jpg)
demo その2
• Lift Console!
•インタプリタで動作確認
• mvn scala:console• (new bootstrap.liftweb.Boot).boot
2009年6月28日日曜日
![Page 67: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/67.jpg)
demo その3
• Crudfy!•ModelからCRUD画面生成
•MetaMapperにtraitをwith
2009年6月28日日曜日
![Page 68: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/68.jpg)
まとめっ!
2009年6月28日日曜日
![Page 69: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/69.jpg)
まとめ
• Liftはフルスタック!
• scalaのパワーをwebアプリ
ケーションへ
• Snipetアプローチ!
• ajax/cometが強み!
2009年6月28日日曜日
![Page 70: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/70.jpg)
情報源
•公式サイトhttp://liftweb.net/
•Google Group Lifthttp://groups.google.com/group/liftweb
•The Lift bookhttp://groups.google.com/group/liftweb
2009年6月28日日曜日
![Page 71: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/71.jpg)
Liftで関数型Webアプリケーションの
世界へ!!
2009年6月28日日曜日
![Page 72: 20090622 Bp Study#22](https://reader031.fdocuments.in/reader031/viewer/2022020217/5555733eb4c9055f5f8b4a85/html5/thumbnails/72.jpg)
ご清聴ありがとうございました!
2009年6月28日日曜日