2009/12/29

Grails 1.2初体验

根据Grails 1.2的README:


Grails is a web application framework based on the Groovy language that endorses the DRY (don't repeat yourself) and coding-by-convention philosophies. Grails runs on the Java Virtual Machine and thus has access to the entire Java Platform.


With Grails you can easily create web applications thanks to:


- a complete development and deployment environment. All dependencies and configuration that is required to the run Grails applications in a web server are provided by Grails. The only thing you have to worry about is your application code.


- inclusion of an embedded web server


- development mode that automatically reloads changes made to application code, without having to restart the web server.


- automatic persistence mapping of domain classes with automatic relationship management.


- scaffolding on data access classes for rapid development of CRUD (Create, Read, Update, Delete) operations.


- powerful view technology with dynamic tag libraries and support for Groovy Server Pages (GSP)


初步试用了Grails,随记如下:


1. 安装比较简单方便,(当然比rails稍稍复杂,这个主要归功于gem的包管理),上手也算比较快。


2. generator等命令的使用上没有rails的自然,需要一些时间适应,另外一个就是感觉每个命令执行都有点慢,可能要研究一下Grails是怎么运作的。


3. domain-class完全是无侵入的POJO,这个是非常的不错。


4. 默认已经包含了59个依赖库(Grails 1.2已经全面采用Spring 3.0了),配置方面还是稍嫌复杂,不过和一般的Java WEB项目比起来,还是简洁不少。


5. groovy语言语法不太习惯,相反ruby倒是比较容易适应。


6. 数据的持久化方面,新手可能会有些疑惑,还没搞明白怎么重启应用而保留数据。


7. 目录结构方面似乎不够Rails的清爽。


管中窥豹,这些就是Grails的初体验,之后再找时间更深入的了解一下Grails,毕竟是SpringSource在大力推动的,而且现在JVM上的脚本语言应该还是比较有意思的。



没有评论: