By Peter Bell

Not Just Application Generation

Sean Corfield once told me that he was not a big fan of application generation. The title of this blog notwithstanding, I agree. Often application generation is a sign of premature optimization.

I am however a huge fan of declarative metaprogramming (where you just tell the computer what you want your application to do and let existing generalized code figure out how to make that happen).

Whether you use design patterns, configuration files, databased metadata or application generation depends on your use cases and requirements. From experience it is difficult to create a truly flexible software product line that perform well without at least some application generation to remove unnecessary variability from specific applications. After all, why use a design pattern to support a variability that only occurs between applications?! That is the perfect use case for application generation and you get better performance as well as more comprehensible and maintainable code.

I think that traditional imperative programming is necessary for edge cases, but the vast majority of programming problems have already been solved. We shouldn’t be rewriting CRUD, validation, authentication, shopping carts or discussion board functionality any more. We should just be declaratively specifying the variability we want from elegantly designed base product lines - whether through language extensions in languages like Ruby, databased metadata or the all pervasive XML file.

Declarative metaprogramming is not a simple problem and it will not be solved with a single bold stroke (language workbenches not withstanding). But just keep a count of lines of XML vs. lines of code in your last project. Do the same every six months and I think you’ll see a real trend over the next two years!

Comments
Ah, Peter, you're bringing back memories of all my Prolog programming... Declarative programming does, indeed, rock! :)
# Posted By Sean Corfield | 7/6/06 12:17 AM
Thanks Sean!

I still haven't really "got" Prolog, although it does appear to be a great language for writing rules engines (I've seen one rules engine written in Prolog where they argued that to have created the same functionality imperatively would have been an order of magnitude harder).

It's on the list along with Java, Ruby, SmallTalk and a book I got after our chat at cf.objective() on Haskell! So many languages/paradigms, so little time!

Best Wishes,
Peter
# Posted By Peter Bell | 7/6/06 12:31 AM
Ironically - given all this talk about duck typing - one of my most important Prolog programs was a type analyzer. I was developing dynamically typed functional languages (that was my research topic after graduation) and using Prolog to deduce what the full type signatures would be.

For reference, this old post on my blog archives (comments don't work):

http://corfield.org/index.php?fuseaction=blog.arch...
# Posted By Sean Corfield | 7/6/06 12:58 AM
Peter, you are well on your way to being the most prolific and provocative CF blogger out there...now if only I could stop reading your posts and get some work done :-)
/ejt
# Posted By Edward T | 7/6/06 9:36 AM
Hi Sean,

Nice post. So where are the updates? Your impatient public awaits!!!

Edward, glad to be a bad influence in a good way :->

Best Wishes,
Peter
# Posted By Peter Bell | 7/6/06 10:08 AM
Er, what "updates"?
# Posted By Sean Corfield | 7/6/06 5:36 PM
Hi Sean,

As per your blog entry on Haskell:
"I'll be writing more about this once I've got everything compiled and installed"

Although as I go further up the archives I see "Comparing Haskell and ColdFusion" which does give an example. Was just wondering if it was the first in a series? :->
# Posted By Peter Bell | 7/6/06 5:52 PM
Ah, well, I did write this follow-up post shortly after:

http://corfield.org/index. cfm?fuseaction=blog.archive&month=2003_05#000355

But, despite the teaser at the bottom of that entry, I did not in fact write any more about Haskell or ColdFusion-as-functional-language.
# Posted By Sean Corfield | 7/6/06 5:58 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.