Code generators: Do you guys use them?

V

VMI

In the next few weeks, we'll be discussing what standards will be used
for our web development, and one of the suggestions was to use a code
generator (in our case, the first version of LLBLGen).
Personally, I don't like code generators. I inherited two web
applications that use LLBLGen, and they are just impossible to debug.
It generates so many classes and so much code that isn't actually used.
In my case, I'm maintaining web app with 235 classes (not counting the
LLBLGen folder) that basically just stores data. Also, you lose control
of what you write, you can't be creative, you can't discuss other
alternatives and have programming discussion. And what are you going to
say when you go to a job interview?

Does any have any feedback (good or bad) about these code-generating
tools?

Thanks.
 
G

Glenn

Hi

We built our own code generators with CodeDom for automating data access
layers for Oracle 10g/Lite based applications. This was initially to deal
with the frustration of continous schema evolutions which ended up breaking
our "hand-made" code. Anyway, it works great, we just say here's the
database, go generate us a new date data access layer. Any specialised
stuff we can't auto generate directly from the database either gets hand
coded in partial classes (with the help of autogenerated helper methods),
or, if demand is high enough, added to the code generator.

Our code looks how we want, behaves how we want, and it's as lean or fat as
we want it to be, and best of all, if we don't like how it's working, we
just change the code generator.

The initial downside is that you have to spend sometime upfront, actually it
took about 3 man days for the first version, but it's really paid off. It
took about five minutes for the code generator to build the necessary
(adapters, datatables, datarows and datasets) for our main business systems
200+ tables.

HTH

Glenn
 
M

Michael Nemtsev

Hello VMI,

I use CodeSmith tools time to time to generate code that is used frequently.

BTW pay attention to the Web Service & Web Client Software Factories, in
your context. Not the pure codegen tool, but VSIP that mitigate your work
http://blogs.msdn.com/mpuleio/archive/2006/09/15/756796.aspx

Rather interesting tool.

V> In the next few weeks, we'll be discussing what standards will be
V> used
V> for our web development, and one of the suggestions was to use a code
V> generator (in our case, the first version of LLBLGen).
V> Personally, I don't like code generators. I inherited two web
V> applications that use LLBLGen, and they are just impossible to debug.
V> It generates so many classes and so much code that isn't actually
V> used.
V> In my case, I'm maintaining web app with 235 classes (not counting
V> the
V> LLBLGen folder) that basically just stores data. Also, you lose
V> control
V> of what you write, you can't be creative, you can't discuss other
V> alternatives and have programming discussion. And what are you going
V> to
V> say when you go to a job interview?
V> Does any have any feedback (good or bad) about these code-generating
V> tools?
V>
V> Thanks.
V>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
F

Frans Bouma [C# MVP]

VMI said:
In the next few weeks, we'll be discussing what standards will be used
for our web development, and one of the suggestions was to use a code
generator (in our case, the first version of LLBLGen).
Personally, I don't like code generators. I inherited two web
applications that use LLBLGen, and they are just impossible to debug.
It generates so many classes and so much code that isn't actually
used. In my case, I'm maintaining web app with 235 classes (not
counting the LLBLGen folder) that basically just stores data. Also,
you lose control of what you write, you can't be creative, you can't
discuss other alternatives and have programming discussion. And what
are you going to say when you go to a job interview?

Does any have any feedback (good or bad) about these code-generating
tools?

The old llblgen tool I wrote back in 2002 doesn't use templates and
generates per table a class with a couple of routines which call a
variety of stored procs, also generated.

there's a lot of redundant code in there, and because it's not
template based, it's not that customizable. However, I disagree that
it's hard to debug, as all the code you will run into is there in code
format, so you can step into it if you want, and as it's pretty
straightforward code, it's not that hard to understand as well.

The successor of LLBLGen, LLBLGen Pro, which I wrote in 2003 and is
now in its 6th revision, was rewritten from the ground up and fixes the
shortcomings of the old one, so it uses a template based code generator
engine (controlled by tasks) and uses o/r mapping to bring down the
amount of redundant code generated and also to enhance the featureset a
lot.

Code generators are a great timesaver. There are two aspects: 1) it
saves you a lot of time designing and writing code, as that's already
generated for you and 2) as it's generated code, it's already debugged
and (hopefully ;)) error free. If you would write it yourself from
scratch you will run into all the mistakes everyone makes the first
time s/he writes a dal, and also you will introduce a lot of errors (we
all do).

So I don't think it's a disadvantage to use a generator, on the
contrary: refusing to use a code generator is IMHO stubborness and
could cause trouble in the long run if competitors will use code
generators to get ahead of you.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
G

Guest

I inherited two web
applications that use LLBLGen, and they are just impossible to debug.
It generates so many classes and so much code that isn't actually used.
In my case, I'm maintaining web app with 235 classes (not counting the
LLBLGen folder) that basically just stores data. Also, you lose control
of what you write, you can't be creative, you can't discuss other
alternatives and have programming discussion. And what are you going to
say when you go to a job interview?

LLBLGen 1.2005.2 and v2.0 is great - we use them here and it cuts down
development time significantly.

LLBLGen cuts down on the need to build mundane code - the data layer :)

Give v2.0 a try, you'll be surprised at how well it works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top