{"id":4960,"date":"2012-01-18T18:52:07","date_gmt":"2012-01-18T13:22:07","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=4960"},"modified":"2012-01-18T18:52:07","modified_gmt":"2012-01-18T13:22:07","slug":"my-top-9-features-from-grails-2-0","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/my-top-9-features-from-grails-2-0\/","title":{"rendered":"My Top 9 Features from Grails 2.0"},"content":{"rendered":"<p>The  groovy world is abuzz about the latest release from the Grails Stable, Grails 2.0, which packs a lot more punch than its predecessors, which by  themselves were productivity enhancers and wonderful to develop our web  applications with. The new version brings with itself a lot of changes  compared to the previous releases and deserves to be truly called 2.0 instead of 1.4 or 1.5.<\/p>\n<p>I  would like to walk you through some of the coolest features from grails 2.0 that I have discovered in the limited time I have spent with the  new version and fell in love with.<\/p>\n<ol>\n<li> <strong>The Improved Interactive Mode<\/strong>:  I love working on the command line and the new interactive mode is a  joy to work with. The auto-completions, combined with the quick response  times(as a result of not having to load JVM for each command) is a sure  shot productivity booster. That I can run normal commands from the  grails shell by just prefixing them with a \u201c!\u201d is an added advantage.<\/li>\n<li><strong>Dynamic Domain Class Reloading<\/strong>:  One activity that consumed a lot of time with earlier versions of  Grails was waiting for the servlet container to restart, once we made  even a line\u2019s change in the domain class or src\/groovy file. Now, the  reloading is dynamic which means that the changes take effect very  quickly, this letting us focus on the development without the flow being  interrupted by the restart process.<\/li>\n<li><strong>HTML5 scaffolded screens<\/strong>:  One of the complaints I had with earlier versions of grails was the  not-so-good looking screens that were generated by scaffolding. For most  of the admin screens, the scaffolded screens are sufficient and the new  HTML5 compatible scaffolded screens are very easy on the eye and  provide an excellent user experience. With the new screens however, I  can simply change the logo and they make for sufficiently pleasing CRUD  screens.<\/li>\n<li><strong>Business Class Citizenship for Testing<\/strong>:  Testing has been a first class citizen of the framework right from day  1, but the new testing framework has made life easy for people like me,  for whom testing doesn\u2019t come naturally. With scaffolded tests being  generated, newbies will find it easier to learn aspects of testing the  application. In addition to that, the capability to unit-test criteria  queries adds an element which was missing from earlier versions.<\/li>\n<li><strong>Link Generation\/Page Renderer APIs<\/strong>:  Earlier, generating html from gsp files from non-request bound threads  was a pain, especially with mocking the web request. Now, with the  PageRenderer API, generating a view in a job or a service is as simple  as injecting a groovyPageRenderer bean and calling  groovyPageRenderer.render() method just like from within a controller.<\/li>\n<li><strong>GORM Finders with Groovy Collection find\/findAll like syntax<\/strong>:  If there was one feature I could keep from all the enhancements in 2.0,  it would be this. This is also the feature which, I think would go a  long way in making GORM queries easier. There couldn\u2019t be a more  expressive syntax!<\/li>\n<li><strong>Public methods in controllers as actions which can take arguments<\/strong>:  Earlier, it used to be a pain to type-cast the parameters into their  respective types(when one felt that command objects are an overhead  while working with at most 2-3 params). The new method like syntax lets  us define actions as public methods in controllers, which automatically  bind data to the method arguments, based on the params. If I have a  command object as argument, it works just the way it worked earlier. We  talk about thin controllers a lot. This also means that we\u2019ll be more  diligent while creating methods in controllers and even if we really  must, they have to be private. This just made the controllers thinner!<\/li>\n<li><strong>The New Improved Test Reports<\/strong>:  The new test reports are very easy on the eye and even more easier  while finding test failures. Though we don\u2019t recommend having println statements in our test cases, the fact that I can see the system outputs  on the same page as my test case is a winner.<\/li>\n<li><strong>DB Console<\/strong>: Viewing the contents of the in-memory DB was a pain in the earlier versions. The new dbconsole, which can be accessed only in development mode is a clear winner.<\/li>\n<\/ol>\n<p>Grails 2.0 comes with its set of wonderful features which makes development with it, a much better experience.<\/p>\n<p><script src=\"https:\/\/www.surveymonkey.com\/jsEmbed.aspx?sm=G7LJIMEJCZsd6zwvkl7fJA_3d_3d\"> <\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The groovy world is abuzz about the latest release from the Grails Stable, Grails 2.0, which packs a lot more punch than its predecessors, which by themselves were productivity enhancers and wonderful to develop our web applications with. The new version brings with itself a lot of changes compared to the previous releases and deserves [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1},"categories":[7],"tags":[29,4840,746,298,747],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4960"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=4960"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4960\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=4960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=4960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=4960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}