Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 159

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 162

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 165

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 168

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 171

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 173

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 175

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 197

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 201

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 224

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 225

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 226

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316

Warning: Creating default object from empty value in /home/jfcouture/jfcouture.com/wp-content/themes/platform/core/library/class.layout.php on line 316
Metaprogramming + DSL Considered Harmful

The Rails Edge: Quotes and Notes is a very interesting collection of quotes from the rails edge conference. Two in particular caught my attention:

“Metaprogramming + DSLs is the Ruby equivalent of Design Patterns in the Java world”
— Chad Fowler. Fowler’s point here was more about the buzz and hype, just like there was a time in the early 2000s when every Java programmer wanted Design Patterns whether or not they were needed, Fowler sees a similar rush to add DSLs to Ruby programs.

“If programmers, on average, were able to write parsers and compilers, Ruby on Rails would not have taken off”
— Stuart Halloway

This is something I’ve noticed a lot recently: every plugin that gets released is a DSL! or it uses a cool metaprogramming trick! That’s nice, but was it really needed? And can we really talk about a ‘language’ when your plugin adds two simple commands to a controller?

I guess it’s a rite passage when learning ruby to write something using metaprogramming. The problem is when you start using it for everything, just like when you add patterns after patterns to your code, just because.

Again, this is a case of using the right tool for the right job. Metaprogramming is a power tool that is useful some time.

Here are other quotes that I like, as they echo the discussion I had with Fred Brunel at the last book club about process:

“The right process is always ‘not quite enough process’”
— Stuart Halloway

“Do the dumbest, simplest thing that almost works”
— Stuart Halloway, on process

“The traditional view, with sixteen pounds of documentation, introduces a single point of failure in the process, understanding the problem domain”
— Dave Thomas

“Getting a specification involves bullying the customer”
— Dave Thomas

Popularity: 26% [?]

 

8 Responses to Metaprogramming + DSL Considered Harmful

    • Mathias says:

      Hi Patrick,First of all thanks for puinttg down an article for Kaltura which is rare. But am facing a difficulty which you might be able to understand and help me out.I took the trial version of Kaltura KMC and tried using the gem Kaltura to integrate a video from KMC into my rails app by using this in my view:[544,360] %>but am not getting the video to be rendered at my app, am just getting a string-containing div and some JavaScript code containing variables for the video.Have defined the credentials in yml file for kaltura as per your github site kaltura_fu.

      • Mamidi says:

        This looks very promising! I have had the same ideas and actlauly built an implementation of this for a client, but without the automatic generation of the classes. I was actlauly checking out how to do this, but it seems that it is already done. Great work!In our code we have a Factory that delivers a hand-written class which is typesafe for the item’s template. Like:var item = TemplateFactory.GetTemplate(Sitecore.Context.Item);litTitle.Text = item.Title;Not too much work, but automatically generating these classes is wonderful.BTW. You forgot to mention how useful this is in databinding contexts:Cheers, Matthijs

    • Marisol says:

      Didn’t Wiley find you at that Rails talk? Imagine if you hadn’t given it. No Wiley. No LanguageCalls. No Lloyd, HQ, Nevinator, Scott Lee, Paul Coffey, etc. You have WAY more great stories to tell than you once did, and you have BLUG to thank for that.

  1. Increase your traffic to your website, you need not pay anything is absolutely free! And know what are the advantages of increasing your web traffic?

  2. Etsuko says:

    I read a lot of interesting content here. Probably you spend
    a lot of time writing, i know how to save you a lot of time, there is an online
    tool that creates readable, SEO friendly articles in minutes, just search in google – k2seotips unlimited content

    • Lucas says:

      I just downloaded the Custom Item Generator and inlltased it in Sitecore 6.4.1. However when I push the Generate button in the tool window I recieve the error Unable to find resource CustomItem.base.vm’ . I have tried downloading the source code and stepped through it in debug mode but as far as I can see the path to the nVelocity templates is resolved correctly and set in CustomItemGenerator.CodeGenerator.GenerateCode() in line 41 props.SetProperty( file.resource.loader.path , NvelocityUtil.GetTemplateFolderPath()); where GetTemplateFolderPath() returns the correct physical path for the NVelocity template folder.Have you encountered this error?

    • Sammi says:

      I absolutely adore you for pointsg this, and in so saying I’d like to add that date_format also works great for selecting entries from a specific month. eg: $sql = SELECT count(*) FROM entries WHERE DATE_FORMAT(time,’%Y-%m’) = . date( Y-m’) . ;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>