1.0.4 の命名規約がキモい件
If you are using dynamic scaffolding, be aware that the model passed to the views by a scaffolded controller has changed. On single object views (create,edit,show) the model now contains
Instance instead of just . The list action now passes InstanceList instead of List. e.g. for domain class Foo, change references to variable foo in your views to fooInstance and references to fooList to fooInstanceList
Grails - 1.0.4 Release Notes
今までは Hoge というドメインクラスからコントローラやビューをgenerateすると、ベースとなる変数名として"hoge"が使われてたんですが、1.0.4から"hogeInstance"に変更されたらしいです。
・・・すごく・・・キモいです。
なんでこんなことになってしまったんでしょうか。
"hoge"で、何か問題がある?
なんか、いい感じであるアプリを作ってたんだけど、かなり萎えた。
2/13 10:00 追記
"Instance"なんてのがつくのは以下の観点で問題だと思う。
- 動的言語における目的というかポリシーというか美学の1つとして、"記述の簡潔性"があるはず
- 全箇所で"hogeInstance"なんて、冗長だし、見にくいし、書きづらいし、汚い。
- i18nプロパティも hogeInstance.create=ほげ新規作成 のように書かねばならなくなる。
- "Instance"は実装上の用語。GORMのようにDSLを重視してるはずのGrailsが、なぜDSLをInstanceで汚すのか。
明らかなメリットが提示できない限り、元に戻した方がいいと思う。マジで。