This blog is now iPhone-ready!
20. Dez
Today, I upgraded to Wordpress 2.9 and the WPtouch plugin. Now, the users of Apple’s iPhone and other mobile clients can browse this blog more easily. Have fun!
Welcome back, Uncle Bob! [OOP 2010]
09. Nov
At the OOP 2010 conference, Robert C. Martin will give a keynote about polyglot programming, called “The Polyglot Craftsman”.
Hey, Uncle Bob is back at OOP,! For me this is very special because it was him who brought me to object oriented design/programming and to my first OOP conference, ever. And this was back in 1992 when I was a enthusiastic software developer, coding in C. Java did not exist in those days, design patterns were not published, there was no TDD – well, it was just the old days of poorly maintainable code!
Bob, when I came into your workshop about object oriented design at OOP, you started with a very simple example in C++ (at least, I thought it was): a car with an engine. You said something like this:
Bob: “OK, guys, lets define an accelerate() method on the car – what would be inside the body of this method?”. And my head started thinking. Somebody else: “The car should tell the carburator to increase the fuel to air ratio. And it should also tell the automatic transmission to shift one gear up!”
Bob: “OK, so Car::accelerate() calls Carburator::increaseFuelToAirRatio(), followed by Transmission::shiftUp(). Question to all of you: Is this a good design or a bad design?”
And poor me, inexperienced in OOD, could say neither yes nor no: “In fact, I don’t know!”.
Bob, you suddenly shouted “Of course, it is a BAD design, very bad design!”
Me: “Oh, why this?”
Bob: “What if you have a Diesel engine, without carburator? And: What if your car has an electric engine, without transmission?”
Me: “Hmmm… well, I guess, I would have to change the design significantly. Something like Thyristor::increaseElectricCurrent().”
Bob: “Exactly! So, how about introducing a neutral abstraction above all this? How about Engine::increasePower()? And with an intelligent Engine class that knows how to increase the power purely by itself? With nobody telling it how to do that?”
Me: “Aha!”
And so 1992 was the year when I became enthusiastic about object oriented design. Thanks a lot, Bob – I am really looking forward to see you again at this OOP. I guess, you won’t remember me but this is not a problem.
Grails support for the Semantic Web
04. Okt
The Semantic Web is gaining attention these days. No wonder that the Grails web framework will offer support for the resource description format RDF, or RDFa to be more precise. A new plugin can generate this format for you. A quote from the developers:
The RDFa plug-in allows you to expose relevant parts of the structure of your application as RDFa annotations in your views. Both domain model (non-information resources) and controller actions (information resources) can be described.
The plugin is still in its early stages, check out its interesting features which are described on the plugin page.
Scrum-Jobs wachsen stark
26. Sep
Job-Portale verfolgen Job Trends, also den Anstieg der Anfragen in bestimmten Aufgabengebieten, z.B. Projektmanagement mit Scrum, Agile und PMI. In den letzten drei Jahren zeigt sich ein eindeutiger Trend zu Scrum und anderen Agilen Methoden.
Ein Beispiel des Portals Indeed.com:
Taxonomies for Grails domain classes
25. Sep
Did you ever want to put the instances of your domain classes into user-defined categories? Something like tags but more structured and maybe hierarchical?
Good news today: Grails has a plug-in for this purpose – it is called the taxonomy plug-in. The developers of this plug-in say that it allows you to apply arbitrary hierarchical categorisation (Taxons) to domain objects. Here is an example of the basic usage:
def book = Book.get(1) // Add the book to the Non-fiction > Autobiography category book.addToTaxonomy(['Non-fiction', 'Autobiography']) def autobiographies = Book.findAllByTaxonomyFamily( ['Non-fiction', 'Autobiography'] )
There is support for arbitrary nesting of Taxons (categories) within unlimited taxonomies, and taxonomies are domain class independent.
So the category “Local” on Author can also be used on Book.
However, you can have different taxonomy graphs aside from the default one, so you might have a taxonomy graph “Location” storing the names of states and cities, and another taxonomy graph “Company type” – and objects having categories in both graphs.
Release 0.1 of the taxonomy plug-in is “alpha” grade. It does not support polymorphism. So querying objects by taxonomy requires you to query the specific class type. This will be resolved in the next release. Also, it does not do caching so it isn’t going to be blazingly fast. Developers say that this will come soon.
Have fun and visit the plug-in page on grails.org.
Test data for Grails integration tests
22. Sep
When you write an integration test for a Grails app, you will likely want to have a clean situation with reproducible test data in your database before the test actually starts. Enter the Fixtures Plugin for Grails.
This plugin helps you to define a fixture, that is a defined set of data used for testing. The plugin defines a DSL in which you can express your need for data. Example:
fixture { guillaume(Author) { name = "Guillaume Laforge" } dierk(Author) { name = "Dierk Koenig" } gina(Book) { title = "Groovy In Action" authors = [guillaume, dierk] } }
Or a little shorter:
fixture { guillaume(Author, name: "Guillaume Laforge") dierk(Author, name: "Dierk Koenig") gina(Book, title: "Groovy In Action", authors: [guillaume, dierk]) }
Then, in your test case, you will want to load that fixture, like this:
class GinaTests extends GroovyTestCase { def fixtureLoader void testFinderMethod() { fixtureLoader.load("gina") def gina = Book.findByTitle("Groovy In Action") assertNotNull(gina) assertEquals(2, gina.authors.size()) } }
Pretty simple, isn’t it? Find out more about how to install and use the Fixtures plugin on its plugin page at grails.org.
Monsters in Grails?
19. Sep
The monsters enter the Grails web framework! Jonas Nordstrand has written a plugin that opens the door to them. This is what he says about it:
A grails implementation of MonsterID: a method to generate a unique monster image based upon a certain identifier (user id, email address, whatever). It can be used to automatically provide personal avatar images in blog comments or other community services.
You can find this plugin (as usual) on grails.org.
Bean Fields for Grails renders form fields easily
18. Sep
Bean Fields, a new plugin for Grails, provides a suite of tags for rendering form fields for domain and command objects. As the developers claim, it takes the pain, boredom and scope for error away.
Out of the box it:
- renders a field using a UI element appropriate for the property type. Constraints are used to set maximum lengths etc.
- automatically renders
- renders “required” indicators if the field is nullable:false and/or blank:false
- renders errors adjacent to the field that had the error
- renders the current value as appropriate
Here’s an example of how you can render all this for a bunch of bean properties:
<bean:withBean beanName="form"> <bean:field property="firstName"> <bean:field property="lastName"> <bean:field property="company"> <bean:field property="email"> </bean:withBean>
You can find more elaborate examples as well as instructions for use on the plugin page.
Paypal plugin 0.5 for Grails released today
13. Sep
David Russell notified me about a bug in the Paypal plugin. Thank you, David!
Bug description: When a user makes a payment, Paypal notifies the site with a so-called instant payment notification. The code in PaypalController.notify() was wrong so that an error code 404 was returned to Paypal. Paypal retried the notification several times and finally gave up. The plugin processed the notification properly, though.
I fixed this bug today and released the corrected Paypal plugin as version 0.5.
You can find more info about the plugin on the plugin page at grails.org.
Understanding social media
13. Sep
At the moment, there is a lot of buzz around social media like Twitter. Keyword is “democratizing information”. Social media users are forming new communities with their own rules and “social speak”. There are even web sites like Klout that calculate how much influence you have in social media (when I test my Twitter user account, it says that it has not indexed my tweets, yet).
This is an interesting phenomenon that I am trying to study and understand. Maybe, it is possible to generate something entirely new.



