[Grok-dev] Re: is automatic context detection harmful?

Martijn Faassen faassen at startifact.com
Wed Aug 29 09:12:01 EDT 2007


Hey,

On 8/28/07, Brandon Craig Rhodes <brandon at rhodesmill.org> wrote:
> Martijn Faassen <faassen at startifact.com> writes:
>
> > I don't think the grok.context() rule is so hard to understand.
> > Almost all the grok directives have a default. If you leave it out,
> > the default behavior will kick in.
>
> Ah!  I begin to understand!  If we followed to its logical conclusion
> my argument that requiring grok.context() makes code more legible, we
> would have to always require *every* Grok directive, which would mean
> dozens of Grok statements everywhere from now on.  But, instead, both
> the grok.context() directive and every other Grok directive is going
> to always have the Most Useful Default possible, so that in as many
> places as possible they disappear.

That's the "Convention over Configuration" principle of Grok. If you
spell everything out, the configuration is completely non-convention
driven. The way we introduce conventions is by having defaults for the
directives as much as possible. If you follow certain conventions (one
model per module), this makes your code quite compact, and I believe,
quite readable.

>
> If I understand that correctly - and thanks for your long and helpful
> reply - then there is a new piece of documentation I would like.
>
> I want a concise document showing, for every class that can be
> decorated with Grok directives, the list of every single Grok
> directive that applies to that class, and gives the default value.

Yes, the reference. :) See the thread I started earlier about this.

Note that we have been discussing this principle in presentations
about Grok, but of course these presentations don't reach everybody so
you're right there's a need for a good reference. We've recognized
this need from the start, but somehow it keeps getting stuck. Let's
hope the newest attempt will actually succeed!

Regards,

Martijn


More information about the Grok-dev mailing list