Just sharing some of my inconsequential lunch conversations with you... RSS  

Sunday, November 25, 2007

Code Generators: Can't live with them, can't live without them

Hollander has posted about his mixed emotions about code generators. Same here.

When I started working source handcrafting was the way to do it. Then I developed a believed in CASE megalithic development suites. Then those didn't work as expected and we all head back to the old code-from-scratch model. And a bunch of people stopped believing on code generators - some of them still refuse to use them until today.

As software grew in complexity we felt again the need for code generators. But we were afraid of the megalithic model, so tried the minimalist approach. I was one of many who tried writing code generators for very constrained and focused domains. And they worked very well when they were kept constrained. But code generators tend to get a live of their own - they are very cool to write - , and very soon they generated all of the application tiers. Not only an incredible increase on complexity, but even worst, complexity that has to be maintained and ported by yours truly!

This generation of code generators had another problem: they were not standard. We had to educate all the new comers to our projects - and generated code often tended to radical designing. And this wasn't a bright idea...

Today I rather use code generators maintained by others. I've dumped my generators for years and have been using NetTiers. I'm presently considering jumping to the Entity Framework, and haven't yet decided what to do with the presentation generators - I'll probably use the scaffolding capabilities in ASP.NET MVC. My point is: I'm hooked on code generators.

Will internal DSLs substitute code generators has we see it today? Probably not. Will the functional paradigm do it? Not likely.

Do code generators get us into trouble? Sometimes, yes. But it's hard to create a coherent and productive line of projects without them. We'll have to know when to use them and when to stay away from them. And hopefully future classes of code generators, tools and practices will help us
entering the industrialized era.

No comments:

Development Catharsis :: Copyright 2006 Mário Romano