Monday, August 17, 2009
Agile, TDD and upfront desing
From my point of view one of the misconceptions about TDD and agile is that you don't need any design and architecture upfront. TDD with refactoring will give me the right architecture in all cases.
Although I am big fun of agile software development I don't believe this is idea of the agile. Agile is here to help develop better software for better customer satisfaction. But it in no cases claims that you should forget about big picture, about documentation and about having at least basic understanding of your system design.
From my point of view you need to do basic design at least at the high level. Then for important parts you need to go to lower levels (if really necessary). And then agile together with TDD will help you to really get it right. To separate concerns, to make separation between domain objects in different tiers and so on.
So as conclusion, agile does not mean no more thinking. Agile means think about the problem, do basic planning and then use TDD and other agile tools to get it right.
Monday, August 10, 2009
g:form, g:actionSubmit and Internet Explorer 8
While working on my latest grails powered web site things to do with kids I have noticed that one form performs ok in Firefox and Chrome but not in Internet Explorer. If this would be case with grails tutorials I wouldn't care too much because majority of visitors have Firefox or Chrome. But my statistics for things to do with kids are showing that there is more visitors using IE than other browsers.
The problem was following. E.g. on the home page of things to do with kids you enter the city name and then press enter on your keyboard. In Firefox and Chrome you get the list of places to visit but in IE8 nothing happened.
But if you used tab to move focus on the Show Me button then everything worked also in IE.
The initial code looked like this:
<g:form controller="home" method="GET">
<input name="locationName" class="span-10 last" />
<g:actionSubmit value="Show me" action="placesAroundLocation" />
</g:form>
After some investigation I noticed that closure called from IE was actually index in the HomeController. So this means that in IE8 when enter is pressed while focus is in the input box default action of the controller is called while in Firefox and Chrome action of the button was called.
So to fix the problem with the IE I have slightly change the code. I added form default action so now it looks like this:
<g:form controller="home" action="placesAroundLocation" method="GET">
<input name="locationName" class="span-10 last" />
<g:actionSubmit value="Show me" action="placesAroundLocation" />
</g:form>
I didn't check behavior in other versions of IE but if you have similar problem this may help you.
Tuesday, July 28, 2009
You don't need session in Grails service
But before you start reusing session in your services or even domain classes be careful and think if you really want that. Service should be more or less simple Java class and when ever possible should not depend on special environment classes. And session is actually very special web application environment class.
So what to do if in the service you really need that value from the session? Well the answer is of course very simple. Send it as a method parameter. Or another way is Robert's approach to create service that will return that value from session and inject it into service that really needs that value.
This way your services will not depend on the web container context and you can easily port them to other environment.
Tuesday, July 21, 2009
UK included on spend day with kids
So please feel invited to visit spenddaywithkids.com and search for ideal places to have a day full of fun with your kids.
Friday, July 17, 2009
Groovy and Grails help build apps faster
Usually I am not posting links to other articles but my feeling is that this one deserves this. I didn't notice link to this articles on other grails/groovy related sites so I want to share it.
So navigate to "Groovy and Grails help build apps faster" to read the whole case.
Sunday, July 5, 2009
Spend day with kids Grails web app launched
Idea of the web site is to help you find interesting places where you can go with kids. There are places like zoos, water parks, theme parks....
Developing this application was interesting for me because this was for me the first time I used google maps in some of my application. Also new for me was geocoding but actually this turned out to be as easy as reuse formulas available online. Currently on USA is covered but Europe should come soon.
Currently I have three sites online: grails tutorials, software books reviews and spend day with kids.
For me it is just prove that development of web applications with Grails is easy and fun but know I will concentrate on extending my existing site and hope I will not get any fun idea soon :)
Let me know if you have some proposals for any of mentioned sites.
Tuesday, June 30, 2009
Book Review: Grails in Action
My feelings about the book are somehow mixed. Basically book is divided into four parts:
- Introducing Grails
- Core Grails
- Everyday Grails
- Advanced Grails
But even if you already have Grails experience don't just skip over the first two parts, because after having some Grails foundation the first two parts become very useful and very easy understandable. Even for me (and I have some experience with Grails) there were useful information and discoveries.
Very good approach in this two parts from the authors is that they have devoted lot of energy to explain how to test Grails application. This is something I should definitely start to do on my own projects :)
The real fun comes with the second two parts - Everyday Grails and Advanced Grails. I have really enjoyed reading chapters from those parts. They are very nice and are really covering lot of skills you will need during real Grails projects.
In the third part authors are explaining how not to reinvent wheel by using number of available plugins. They show you how to fast and reliably put together advance features by reusing already existing functionality. I liked this approach and using it myself a lot.
There are also chapters devoted to workflows, exposing interface to outside world and using messaging.
After finishing third part you have really solid foundation to do some serious Grails development.
The fourth part is really advanced although I would include basic transactional behavior into at least third part of the book as this is probably more everyday grails than advanced grails. The fourth part will explain advance GORM related features, advance usage of spring and something you will for sure meet in the corporate environment - build and deploy process.
Conclusion
At the end I was very happy that I got a chance to read this book. This book will lead you from the beggining to the really advanced features of the Grails. If you are developing with Grails I am very sure you will have this book near you.
If you are just starting with Grails I would recommend, first read something simplier and then come back to this book. I am sure you will enjoy reading it.
And if you want to buy the book you can do it here :)