Code generator : the languages comparison

I’ve been hacking a code generator in various languages just to get the fell of each languages, none is the worst, but some are so much cooler. Here’s the results of my experimentation.

C#

Goods

  • Fast
  • Should run on any win32 machine with .NET

Bads

  • Too much of LOC
  • Had to use NVelocity has a template engine
  • Code to inject template bindings was ugly

Python

Goods

  • Easy to read class and attributes metadata
  • Scripting language so the developement cycle was faster, no compile step
  • Easely multiplateforme

Bads

  • Had to use Cheetah has the template engine

Boo

Goods

  • Fast
  • Implemented the generator code has a script in Boo

Bads

  • Playing with the compiler pipeline and stuff is complexe
  • lack of docs (but yeah Boo has not hit 1.0 yet)
  • No template engine usable for this with Boo’s syntax

Ruby

Goods

  • OMG!
  • Implemented in 2 LOC
    require 'erb'
    print ERB::new('mytemplate').run(binding)
    

Bads

  • Too easy😉

Leave a comment

Filed under C#, Generator, python, ruby

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s