Wednesday, December 8, 2010

Groovyness - the agile paragraphs

Back on track. After releasing Magnolia CMS 4.4 my mindset moves back to Magnolia 5.0. While playing around with groovy to merge the changes from the 4.4 branch back to the trunk I came up with a idea which I would like to share and get some feedback from you.

Using a groovy builder (DSL) we could make the paragraph definition very concise
  • include the dialog definition in the paragraph definition
  • add a closure for rendering the content

example: text and image paragraph

What we get:
  • no configuration (update, ...)
  • a single concise definition (all in one place)
  • agile

Note: this will not replace any other ways of defining paragraphs or dialogs its just a groovy alternative. But since we allow pragmatic registration of dialogs, paragraph, ... in Magnolia 5.0 such an implementation should be rather trivial.

4 comments:

Felix Rabe said...

Interesting idea. I would also consider JSON. What do you mean by "pragmatic registration of dialogs, paragraph, ..."?

Unknown said...

Philipp,

I like it! Very nice. I'd love to do this for Twigs.

What do you think about a common way of importing groovy packages/classes into the scripts workspace? Sort of like the templating kit does with freemarker scripts for inline templating.

Thanks,
Matt

Chrigel said...

Hi Philip

Your blog post has been discussed @ the latest hackergarten. I personally think your idea is great and feasible, but why "only" on paragraphs? I don't know Magnolia enough (yet), but I can imagine that a whole website (pages, paragraphs, dialogs, commands) beeing defined in a DSL. And Groovy is a great language to do so.

Oh and btw: Vaadin is a perfect builder candidate too....

Philipp Bärfuss said...

Yes the example shows a paragraph combined with its dialog definition. Doing the same for pages would not differ at all. I just picket the most obvious and simples example.

"pragmatic registration" indeed interesting ;-) please read programatic registration