Results 1 to 4 of 4

Thread: Template based code generation

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Template based code generation

    There are several packages on the market that can be used to generate apps based on templates. They all have strengths and weaknesses of various sorts. I've never used any of them, and now find myself using one to generate a multi-tiered app. I have the ability to edit the templates, so I can theoretically change the generation. However, in practice, I find that I can only make simple changes.

    As an example, I was having a problem with a grid that looked like it would be simple to fix. I started stepping through the code, and eventually noticed something familiar, so I looked at the stack. Sure enough, the code was re-entrant, so I was going through the same set of functions for a second time. However, I also noted that the call stack was HUGE. In fact, the stack was something like this: A called B which called C which called D.....etc. until R called S which called T which called A which called B....etc. until R called S which called T which returned all the way back. That meant that the stack was nearly 40 calls deep. Some of those functions were essential, while others were there largely because a template has to function correctly for 100% of the cases, so sometimes you have to add something goofy that is unnecessary in 95% of cases, but is essential to the other 5%.

    This leaves me nearly paralyzed when it comes to making changes. A call stack that deep, where much of the work is being done because a theoretical "other app" might need it, is beginning to appear to be impossible to maintain. Of course, I could simply alter the generated code, but if I was to start down that path, since there is so much extra crap, I'd never be able to re-generate, which defeats the purpose of using a code generator.

    Basically, I'm totally frustrated by this generation after fighting with it for months. I'm making glacial progress, and sticking with it to be a team player, but progress is so slow and halting that it can barely be called progress at all. I've learned many languages, and written dozens of programs, and I think I'm at least capable, but this whole process is making me feel utterly inept.

    What I'm looking for is anybody else's experience with template based code generation. Have you done it? How was it? What was good? What was bad?
    My usual boring signature: Nothing

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Template based code generation

    I've seen some before (my processor has efficiently erased any traces of the names from my cranial RAM) and I often refer to them as "products of abstraction monkeys". I hope this becomes an Internet meme some day.

    The premise for the existence of such products is meant to be for simple uses, it's not meant for developers. Abstraction is often done for flexibility, but when it goes too far, it is for anything but. It's pretty obvious that any industrial solution must always be written by the developers themselves. Yes, they can have a base to build upon, they don't need a generator!

    Anyways, that was my bit. I'll go and laugh at your plight now, because I am a mean soul deep down inside.

  3. #3
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: Template based code generation

    The problem is that since they are designed to be so generic and flexible, they need all those layers to be able to handle all the potential situations that may arise that they have to handle. If you know what you want to do, then you only need to build the necessary parts and your code doesn't have to be generic enough to handle something that some guy in Slovakia may decide to put into it ten years from now.

    They do make the development quicker, but the fact that it takes ten times longer to debug anything and that you have to rip apart the genericness of the functionality if it only handles for 100 possible situations and you want it to handle situation 101 make them more trouble than they're worth for anything but the most basic applications and those applications are so basic that they don't need the templates to be so overly generic.

    They take OO concepts to a ridiculous extreme and don't deliver any of the benefits that they purport to. You're going to have to hack the template to give it the functionality that you need anyways, so you may as well just ignore the template and build your own objects.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Template based code generation

    Strictly an exercise for the masochistic. Patterns should be applied where useful and ignored where not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width