The Changing Picture of Code Generation

I’m excited that a lot of forces are coming together, slowly, to bring code generation into the forefront and I want to talk about my experience doing primarily code generation on the majority of my .NET projects for over five years. There are a lot of things I’d like to talk about and this is the start of a series.

I’ve done a lot with code generation. I even wrote a book. I’d like to slice out the parts of the book that are dated, but there is so much I want to say about code generation and there won’t be another book for at least a year because things will be very dynamic for code generation in the next year or so. Instead, I want to use this blog for serious dialog on the challenges and nuances that we’re going to face. This is what I’ll do this year instead of books, and maybe later I’ll pull together these ideas into a book with a formalized structure.

In putting code generation in perspective, I wish I could talk more about the one project that didn’t use code generation. The team was so awesome and struggling so much that I was happy to sit on the edge with a side task and watch it all come down. I don’t regret the experience. Here was the highest density of great programmers I had ever seen with almost every process issue aligned for success. This was a very, very smart software company. They had money, management support, teamwork, a well defined problem, agile methodologies (at least somewhat), and comparatively a lot of time. But even success is failure. Everything they did will go in the trash can. Even if they succeed they will fail in that the whole thing will start over with a new technology.

It was also nice not to be the .NET Goddess (yes one of my partners uses that on my business card). They had no clue who I was when I came to work, just a coder reassessing and picking up some side work. It turned out to be a far more intense and long gig than I wanted, and it had its share of ups and downs, but it gave me a chance to see the best of “normal” programming; as close to a fly on the wall as I will ever get.

What I learned from this experience is that even the best normal development efforts are worse than mediocre code generation development I’ve done. But, I start with an arsenal of tools that you do not have. Without these tools, code generation is so hard to do well that I can’t even suggest the average shop incorporate it. This is what will change in about the next year. It makes no difference whether these tools are mine or someone else’s. Other people have a lot more time than I do. But you need to understand, and people with the product s in the code generation space need to understand what you need to do code generation well. The purpose of this series of articles is to output my share of knowledge on that subject. To understand deeply, I have to talk a lot. I am not wise enough to distill this into bullet points – beyond the principles I’ve already defined in my book (and will cover here soon). I want to start a conversation – in you blog if you have one – where you disagree or have more to say.

Once code generation is laid out with more clarity than today, it’s time to talk BDD. Actually I want to take just part of BDD (the artist previously known as TDD). I do not think proper development is a “Holy Grail” that is unreachable. I believe it is a reality we will hold in our hands within five years and will be a combination of code generation for all the stuff its dumb for us to write married to a highly morphed BDD for all the code we do have to write.

Of course at that point, we will have uncovered a new layer to explore – but where we have been stuck and the pressure is so great – this will be solved. It’s time we got started.


2 thoughts on “The Changing Picture of Code Generation”

  1. I’ve read your book, interesting approaches and terms that you have defined. I have not tried going down the brute force code generation scenario though. I’ve been using CodeSmith and CodeBreeze to understand the different paradigms and philosophies on what we as developers should have access to when generating and/or where we store information to be generated.

    I’m still trying to find more ideas on generating the web interface though. Using XSLT has been more troublesome for me, even though it does sound like the best principle to use to meet changing business requirements. Using XSLT is that it seems hard to maintain, i.e., applying style sheets, etc. and I have the feeling like I shouldn’t have tried to generate the UI using this approach at times. I’ve tried using custom web controls, but I have been generating only generic editors with validation that is not very customizable other than giving the user the ability to modify properties.

    I’m still looking for that one last step in my mind that does code generation at the UI level and makes the maintenance easy and flexible enough to meet changing business requirements. Maybe I’m approaching the XSLT generation in the wrong way… I would appreciate any more ideas that have come across your mind. Thanks for writing the book Kathleen.

  2. the languages and tools hide the forest behind the trees. we need ane expressive rule language, a powerfull ide and the rest are plugins for code generation…
    This is visionary…but imperative.

Leave a Reply

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