What code generation tool are folks using?

What code generation tool are folks using?

Old forum URL: forums.lhotka.net/forums/t/3652.aspx


Rayk posted on Friday, October 05, 2007

What code generation tool are folks using, where there templates are updated regularly?  I'm hoping to find somewhat recent templates.  CodeSmith seems to have fallen out of favor.  CodeComplete says it stays up to date with CSLA, but I can't figure out what version of CSLA they are using.

I posted this in the other section, but no response yet.  I have a new developer that I am managing remotely, and I need to find out if I have to buy a CodeSmith license for her. 

Thanks,
Ray

JoeFallon1 replied on Friday, October 05, 2007

I use Codesmith.

It is a fantastic tool.

I believe the sample templates for C# are up to date (Ricky Supit does a lot of work there.)

Over the years I have tweaked my VB templates to meet my own style and coding conventions.

If you take the templates as a Starting point and modify them to meet your needs you shuold be OK.

Not sure why you think Codesmith has falen out of favor? Maybe people are too busy using it to keep touting it as the next best thing.

Joe

 

DeanB replied on Friday, October 05, 2007

Great Question:

First my background as it is relevant.  I have been coding CSLA for about 2 years and have been to Rocky's classes at VSLive.  I am a big fan of hand coding the cool stuff but hate coding the database objects.  I have used several codegen products (former nettiers guy).

First CodeSmith: I own a license for this and really like it for generating NetTiers.  I used to recommend it for basic CSLA stuff.  It seems now that the template crowd has backed off this community.  I also didn't like the disconnect between the sql stored procs and Csla proc names.  They weren't the same.  I know how to change the templates and did, but I am assuming the reader would want something ready out of the box. I downloaded the templates from Codeplex.

Second MyGeneration: I used it after CodeSmith.  I like that it generated the project in a hurry!  What I didn't like is the liberties it took with the framework.  I am not saying it is bad.  It just isn't the way I write my objects.  It did work though.  Templates also available through Codeplex site on Source tab.

Finally CodeComplete:  I actually bought this last night!  I really like it.  It supports Csla 2 out of the box but you can drop the new Csla compiled .dll in the installation directory (replacing the old after you copy it somewhere!) to get the 3.x support.  Now, they have a new version coming out in the fall native to 3.xxxx.  I really like this product for Csla generating but I am still fairly new with CodeComplete.  Beware though, when you purchase it, it takes them a few hours to get you the download link.  Their support is good (so far) as well.

I know that this isn't an answer as such.  I have simply found that generators thrive in different areas.  The CodeSmith Nettiers is really cool if you use if for that.  However, for Csla (which I use mostly now) I find CodeComlete very interesting.  Go to their site http://eurowisesoft.com  and watch the videos.  Good luck!

Q Johnson replied on Friday, October 05, 2007

re: MyGeneration and your comment: "What I didn't like is the liberties it took with the framework.  I am not saying it is bad.  It just isn't the way I write my objects. "

Are you talking about the behavior of the template you used or the behavior of MyGeneration? 

If the former, it doesn't matter to me because I always found it useful to modify templates my use for per project (whether I used CodeSmith or MyGeneration).  If the latter, I'd be interested in "the liberties with the framework" you felt it was taking.

Thanks,

 

xal replied on Friday, October 05, 2007

You can find a codegen tool index for csla here:
http://www.lhotka.net/cslanet/codegen.aspx

I use CslaGenerator. (but I'm biased) :D

Andrés

DeanB replied on Friday, October 05, 2007

To see some differences do this:

Install the Sql Server Northwind Database (because CodeComplete only allows this database in demo mode :-) and use these three to generate a class or two from it.  You will see the difference immediately.  Mygeneration does a couple of things a little different.  I would post classes but I won't be at my computer for about 5 more hours.

DeanB replied on Sunday, October 07, 2007

I just thought I would follow up with my thoughts on Code Complete.  I want to start by saying I think it has the potential to be the "one" for Csla code generation.  However, right now, I can't say I recommend it.  I am going to use it though.  Now that those two sentences have torn a whole in the universe let me explain.  It is a wonderful tool for generating Csla objects especially IF YOU DON'T USE STORED PROCEDURES IN SQL SERVER 2005.  If this is your situation then buy it!  However, most of us aren't in that club.  There is a confirmed issue with generating stored procedures when you select more than one table in the database to generate objects against (Confirmed by Phillip from Code Complete on 10/07/2007).  I got an email just this morning from their support stating they are working on it.  In fairness, they did suggest a work around.  Here is what they said:

You could try to create the data sources one by one and see whether it generates the SPs that way.

The problem with this is that many of us work with very large databases.  Doing it one at a time robs efficiency from a tool that otherwise excels. 

I have said before that their response times are great.  They did say they are looking at it and hope to issue a fix soon.  As soon as they do, I will update this post. 

Let me state again for the record:  Phillip in customer support has been very good at answering all my questions in a very timely fashion.  They certainly get an A+ for that!

Conclusion: This generator has the potential to be the "one".  HOWEVER, many developers will likely find the Stored Procedure generation bug a deal breaker.  Keep your eyes open for a fix though.  I WILL UPDATE THIS AS SOON AS I HEAR MORE.

Remember:  I have years of experience in Csla and Code Generation (though I am somewhat new to this forum).  These observations are my personal conclusions based on my experience.

DeanB replied on Monday, November 12, 2007

Updated Code Complete Thoughts.

I promised an update to the Code Complete review I wrote earlier.  Here it is!

Pros:

1. User Experience

First let me say I am using the newest version available on their site as of today.  In my original review I blasted the product for its lack of support for SQL 2005 stored procs.  This has been cleared up in the latest release.  I haven't run into any issues that with my production database.  This product has really nice wizards that help you generate a pretty complete solution.  It certainly stands shoulders above its competition in this area.  The resulting code is great.  The generator uses Csla version 3.

2. Tech Support

Outstanding.  Best I have come across that is email based.  Keep in mind timezone issues though.  Sometimes answers take 12 hours or so.  I had no issues where the answer didn't address the issue.

Cons:

1.  When you are going through the wizard, there is a annoying behavior where you can't resize a drop down list.  For instance: If you select a table and go to select a column via drop down, It is very likely your column name (if say above 10 characters) will not be totally visible.  This seems very bizarre to me.

2.  The demo mode is too restrictive.  I think they should have followed the CodeSmith model.  Their product is high quality.  They should let demo users generate against on of their own databases.  I am certain that given this opportunity, more people would purchase the product.  If they don't do this at least use a more complex database like adventureworks for the demo project.

3. No Visual Studio 2008 Integration (In fairness, this isn't a real big issue since VS 2008 isn't yet gold.  If you are a MSDN user you must have BOTH VS 2005 and VS 2008 on the machine you intend to generate code on.  You can use VS 2008 to update the project.  I have had no issues doing this.

FINAL THOUGHTS:

When comparing code generators for CSLA projects only (CodeComplete, CodeSmith, MyGeneration) I am giving the nod to CodeComplete.  Their product isn't perfect but given the progress lately and their dedicated technical support, I see no reason it won't continue to distinguish itself among Csla generators.  I really hope all the issues listed under the Cons section get resolved.  However, (except for the wizard combo box sizes) none of them are very big issues.
I personally own CodeSmith and love it too.  However, for strictly Csla products, I think CodeComplete has a definite edge.

DeanB replied on Monday, October 08, 2007

Just an update.  I got an email from the Code Complete people.  They said that the Sql fix is a very high priority and that they are currently working on it.  I think I will be beta testing the fix so I will update accordingly.  I think we are looking at days not weeks but I have been wrong before! :-)

Rayk replied on Monday, October 08, 2007

Thanks for all the feedback. 

We've used the CodeSmith templates, and we've tweaked them a bit to our liking.  For example, if a field is nullable, and we put a ZERO in the property, we want the ZERO to go to the database, not a null.  Also, we don't remove the underscores from the field names, because we also use the business objects for end-user report generating, and having the underscores in the column names really helps end-users. 

I will check out the CodeSmith templates again to see about the updates.  I will also download a trial of CodeComplete and see what is up with that. 

-Ray

DavidDilworth replied on Tuesday, October 09, 2007

We use CodeSmith as well, but we wrote our own templates.  It's not hard to do if you're familiar with the ASP.NET style of code.

We used our own templates to:
(1) Produce classes that worked off our own extensions to the CSLA framework.
(2) Match our own coding style and conventions.

In fact we took our code generation a step further by writing a CodeSmith.Dll that can be called from our templates that provides supporting classes and functionality to the code generation process.

Copyright (c) Marimer LLC