<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx</link><description>I'm still not sure what I think about code generators. This may sound strange, coming from someone who has spent much of the last few years working on and talking up software factories, of which code generation is a significant part - but it's true. On</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6333999</link><pubDate>Sat, 17 Nov 2007 14:34:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6333999</guid><dc:creator>Miha Markic</dc:creator><description>&lt;p&gt;For me, 1. and 3. are definitely not an option. So that leaves option number 2.&lt;/p&gt;
&lt;p&gt;* For not creating code there shouldn't be problems :-) - you have to store a list of what has to be generated (or what shouldn't be) somewhere and somehow pass it to code generator at code generating time.&lt;/p&gt;
&lt;p&gt;* For tweaks it depends (I don't know the extent or the nature of your tweaks). Perhaps you could implement tweaked methods in a partial class by hand?&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6340138</link><pubDate>Sat, 17 Nov 2007 20:08:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6340138</guid><dc:creator>Peter Ritchie</dc:creator><description>&lt;p&gt;Sounds like your complaints aren't necessarily about generated code; but about code you don't really have ownership of. &amp;nbsp;Any external library you use will contain code that you're likely not going to use. &amp;nbsp;If you view the generated code as an external library, unused code is just cost of &amp;quot;reuse&amp;quot;.&lt;/p&gt;
&lt;p&gt;Short of providing configuration to govern which of the C,R,U, or D methods to generate; I don't see much of a &amp;quot;friendly&amp;quot; alternative. &amp;nbsp;That &amp;quot;configuration&amp;quot; could involve meta-data on the database side (either database-specific properties) or inferred information like if there's a stored procedure named tablename_CreateRow don't generate the create method for that table...&lt;/p&gt;
&lt;p&gt;Maybe partial methods in C# 3 might be helpful...&lt;/p&gt;
&lt;p&gt;If you're generating partial classes, maybe the generator can analyse the non-generated file and detect if the C,R,U, or D methods already exist (maybe using CodeDOM). &amp;nbsp;Or, maybe test for attributes that configure which of the CRUD methods to generate...&lt;/p&gt;
&lt;p&gt;It's too bad a #define declared in one partial class file doesn't get proliferated to the others; otherwise you could simply generate code like:&lt;/p&gt;
&lt;p&gt;#if !NO_CREATE_METHOD&lt;/p&gt;
&lt;p&gt;public void CreateMethod()&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;#endif&lt;/p&gt;
&lt;p&gt;and add&lt;/p&gt;
&lt;p&gt;#define NO_CREATE_METHOD in the non-generated CS file so the CreateMethod never gets compiled...&lt;/p&gt;
&lt;p&gt;Or, what about generating multiple files per class? &amp;nbsp;If you keep each CRUD method in it's own file you can simply not include, or exclude, that CS file in the build...&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6340216</link><pubDate>Sat, 17 Nov 2007 20:14:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6340216</guid><dc:creator>Ryan Anderson</dc:creator><description>&lt;p&gt;Being stuck in DB land for a few months now, I have an idea... Maybe, you could expand on your code generator that checks for the existence of a table within your db that explicitly outlines which objects in the database to generate code on, and what methods (CRUD) should be created. If this table doesn't exist, create all ojects and CRUD method...? This way you can dynamically create your code based on the data in this &amp;quot;generator template&amp;quot; table.&lt;/p&gt;
&lt;p&gt;This would give you some more control over the areas that you have spoken on that cause you frustration.&lt;/p&gt;
&lt;p&gt;This doesn't even have to be a table, it could be an XML file similar to what netTiers uses, but expanding on it to also contains methods that should be created.&lt;/p&gt;
&lt;p&gt;I just realized I am echoing Miha's comments... Sorry Miha, but I agree with you whole heartedly.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6340849</link><pubDate>Sat, 17 Nov 2007 20:55:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6340849</guid><dc:creator>Brad Salmon</dc:creator><description>&lt;p&gt;Life (and software development) is full of trade-offs. I typically prefer the approach of creating a framework and have done so for database access via stored procs. &amp;nbsp;The developers just called the appropriate method (Add, Update, Select, Delete) and provided the name of the proc. &amp;nbsp;The downside/tradeoff, is that in the case of a Select, the method returned a Recordset (this was ADO-days) instead of a pre-defined, strongly-typed object. The upside was that developer only created procs they needed and there were only four methods in the whole system that actually had to interact with the database.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6341602</link><pubDate>Sat, 17 Nov 2007 21:42:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6341602</guid><dc:creator>grauenwolf</dc:creator><description>&lt;p&gt;If you are using C# or VB, then code generators can be a joy.&lt;/p&gt;
&lt;p&gt;1. If you don't want your code generator to export CRUD operations for certain inputs, then specify that in a config file.&lt;/p&gt;
&lt;p&gt;2. Use Partial classes to seperate the auto-generated part from the manually created part. That way you can regenerate as often as you want without fragging your changes.&lt;/p&gt;
&lt;p&gt;3. Use Partial methods (C# 3/VB 9) to add hooks everywhere without killing performance.&lt;/p&gt;
&lt;p&gt;4. Go all the way. Use application-specific code generators to build lots of stuff, not just simple data classes.&lt;/p&gt;
&lt;p&gt;My application relies on a bunch of lookup tables and got tired of repeating the same code over and over again. So I built a simple code generator exports a data class, some caching logic, a single-select search control, and a multi-select search control. Oh, and a bunch of adapters so we can also plug it into our reporting engine.&lt;/p&gt;
&lt;p&gt;All this stuff wouldn't make any sense in any other application. But for this one, I can add new lookup tables faster than I can populate a drop-down box.&lt;/p&gt;
&lt;p&gt;5. Don't bother trying to reuse code generators from project to project.&lt;/p&gt;
&lt;p&gt;Say it takes you you 1 unit of time to code a pattern and you need to do it N time. Alternately, it takes M units of time to create a code generation template for said pattern. &lt;/p&gt;
&lt;p&gt;Clearly there is a break point, M &amp;lt; N, where it is cheaper to code the template than to keep repeating the pattern. Watch for those.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6343978</link><pubDate>Sun, 18 Nov 2007 00:07:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6343978</guid><dc:creator>Daniel COHEN-ZARDI</dc:creator><description>&lt;p&gt;Have you tried CodeFluent ?&lt;/p&gt;
&lt;p&gt;I think our R&amp;amp;D did put a lot of effort into following up a couple of principles :&lt;/p&gt;
&lt;p&gt;- Generating components (not only code) so you should not care too much about generated code at least on the business model tier (it is NOT template-based on this layer)&lt;/p&gt;
&lt;p&gt;- Do the proper separation in terms of .NET business classes architecture so you can add custom code or business rules the right way and regenerate your schema as much as you want (with an embedded SQL differential engine)&lt;/p&gt;
&lt;p&gt;- Provide extensibility at multiple level so you can preprocess the model or override generation producers to add a specific behaviour into any layer&lt;/p&gt;
&lt;p&gt;- Provide template-based generation where it makes sense, to build user interfaces for example&lt;/p&gt;
&lt;p&gt;I would be curious about your opinion once you have really tried it.&lt;/p&gt;
&lt;p&gt;Feel free to send any questions directly to info@softfluent.com.&lt;/p&gt;
&lt;p&gt;I am quite sure we have the right solution, and if not, I would like to understand your issue.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Daniel COHEN-ZARDI&lt;/p&gt;</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6345854</link><pubDate>Sun, 18 Nov 2007 02:06:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6345854</guid><dc:creator>tomholl</dc:creator><description>&lt;p&gt;Thanks for the comments so far everyone. Peter, I get your point that every framework or library will contain unused code, and it's fair to ask why I'm worried about unused generated code. I guess I see a difference between unused code in System.Globalization.HijriCalendar and in MyApplication.DataAcceess.DeleteAuditLog. The former is obviously not designed for my application (so some kind analysis will be needed to see if it will help), but if you do choose it you can be confident that it's highly tested. The latter looks like it was designed just for my app (so there may be more temptation to call it without thinking carefully), but it may never be appropriate and it may not do what people assume.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6346014</link><pubDate>Sun, 18 Nov 2007 02:14:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6346014</guid><dc:creator>Kevin I</dc:creator><description>&lt;p&gt;I've never been a fan of working with code generators either until I worked with the one developed internally at a company I worked for in Milwaukee (fairly small company at the time).&lt;/p&gt;
&lt;p&gt;They seemed to have fine tuned an amazing code generator that really answers most of the issues that I see in common ones today, and they even build a GUI on top you can use to 'configure' your object. &amp;nbsp;This is the general path to create a 'business object'&lt;/p&gt;
&lt;p&gt;You open the tool, open a project file, otherwise start a new one and point it at some tables. It derives the relationship. &amp;nbsp;And you can tweak each table allowing too many features that I could even fully explain here, including how to get the identity of a table (auto increment from db, generated from db, generated from client, etc), you can tweak all of the properties, marking fields readonly, write once, writeable, etc. &amp;nbsp;You can add virtual properties which do a lazy call to a db, dynamic or cached; you can add business rules. Some based on field calculation items with the dependencies recorded for which fields are affected, so if you change a different field, it will know what to do. &amp;nbsp;You were able to tell the system what is a 'lock' object, which means you can load the object in a lock or readonly manner - if it is locked, then anyone else trying to load that object in a lockable way will be unable to do so, with timing in place so that ui locks expire after 30 mins, and a MSMQ backend for automation applications to notify the client and steal a lock after a minute (causing the ui app to be unable to save, but the msmq message has already been reported to the user and in 99% of the cases, the user just closes the screen and mitigation is done). &amp;nbsp;The objects have a beginedit/apply/cancel, etc which also cascades to the children .&lt;/p&gt;
&lt;p&gt;It really just goes on and on. &amp;nbsp;And the system originally generated a backend dll for a middle tier (dcom) which you could click a box to say if you wanted SPs or raw sql; all generated. &amp;nbsp;And of course any save on the parent lock object would update all the child objects (only those that changed) in one big generated call instead of one by one (always a benefit of code generators). &amp;nbsp; Loadhints were available, similar to LinQ. &amp;nbsp;I see Linq and so many little pieces that were in the old system in use there. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Some of the really incredible stuff though was a BusinessObjectTester, a generic program which would load any of these created objects up and it had a fully dynamic ui to display all of the properties and items, and you could change things, save things, drill into the children, etc. &amp;nbsp;One of my projects was actually extending that to take an XML file config to determine what to show and allowed ways to hide id's for other things, provide ui's that would select from the domain (oh yeah, anything that was a lookup, had a domain object within the object you could use to get all of the lookup object table values - code1, code2, even an image to represent the id;). &lt;/p&gt;
&lt;p&gt;And when the program ended, you were pretty much dropped right into its code, and by placing 'blocks' to note where your code is, you could add logic anywhere and it would be preserved. &amp;nbsp;Since there was so much power in the configurator, most changes would not impact any code you created, but if so, you'd just have to review and fix your side, but you would never 'lose' code, and it would put it's code in there that you can just delete as needed.&lt;/p&gt;
&lt;p&gt;So all of this, amazing.. all build in VB6 back around 2000. &amp;nbsp;And the middle tier piece was dumped (2 dlls for each object were deployed to a client/server) eventually because the middle tier infrastructure was stale and underpowered. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;It's easy to sit here today and think, wow, how do you do security and such? DCOM is so old, vb6, wow ancient... &lt;/p&gt;
&lt;p&gt;But as any developer knows, there is nothing in that system that couldn't be updated, but these days I just sit back and hope someone will create something as great in C# :&amp;gt; &amp;nbsp; It was similar to perhaps what the CLSA Project offers today (from what i've heard), &amp;nbsp;and some of the negatives is that at least at that place, it had some things you had to do .. you needed a database with some databases for the codes system, the resource manager (you could always find out who is in your system, what they've locked, and other interesting details); &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I remember Many extremely large objects were build, using hundreds of tables and lookups dealing with some very complex environments, and due to that as well, optimizations were made which are the kind that rarely make it into a 3rd party generic code template generator. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;So where do I sit today on this? The one thing i see over and over which is rarely present - a UI to configure the framework. &amp;nbsp;People like using XML, and perhaps the config could be put there. &amp;nbsp;- But when you have a system with 100+ tables and lots of properties with different settings, having a ui to bounce in and go to change a field or add things, makes it go so much faster. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6351654</link><pubDate>Sun, 18 Nov 2007 05:42:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6351654</guid><dc:creator>Jeff Belina</dc:creator><description>&lt;p&gt;This may be too simplistic of an idea, but what about saving a copy of your original generated code, then when you have to regenerate because of a DB change, do a diff against the original generated code and your current codebase. &amp;nbsp;Generate the new code, and apply the changes to the new generated code?&lt;/p&gt;
&lt;p&gt;Hope this helps spark an idea that'll work for you.&lt;/p&gt;
&lt;p&gt;Take care,&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6360032</link><pubDate>Sun, 18 Nov 2007 13:06:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6360032</guid><dc:creator>ErikEJ</dc:creator><description>&lt;p&gt;Have you had a look at nettiers (www.nettiers.com). This tool has given us &amp;nbsp;minimal disruption after schema changes, and via partial classes allows us to keep our additions to both entities and data access methods. Highly recommended. Has advanced features like processing pipeline, extensible entity vaildation and Deepload / Deepsave for working with fuller object graphs.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6367071</link><pubDate>Sun, 18 Nov 2007 17:40:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6367071</guid><dc:creator>Doug</dc:creator><description>&lt;p&gt;Code generators can be useful. &amp;nbsp;And, where they are useful I think that they identify an oportunity for one or a comination of the following:&lt;/p&gt;
&lt;p&gt;- Improve the framework. With good methods you can reduce the amount of generated code needed. You can do this yourself.&lt;/p&gt;
&lt;p&gt;- Improved tools. &amp;nbsp;Maybe the way that you want to work with the form isn't the way the designers of the form automation tools imagined. This is where the code generator lives. &amp;nbsp;It would be nice if it were easier to hook a code generator into Visual Studio where you need it.&lt;/p&gt;
&lt;p&gt;- Improved or alternate languages. Language extensions like LINQ reduce the amount of code need for common tasks. &amp;nbsp;The danger is that over time the language turns into a monster. You could look upon a data file that drives a code generator as a small special purpose alternate language.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6373626</link><pubDate>Sun, 18 Nov 2007 21:57:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6373626</guid><dc:creator>MikeF</dc:creator><description>&lt;p&gt;Don't generate code, generate the config files and have generic processes to manage record maintenance and other common requirements.&lt;/p&gt;
&lt;p&gt;This approach is far more flexible than generating code and if you have very high use or critical routines you can always generate a more focussed or efficient piece of code or call a service.&lt;/p&gt;
&lt;p&gt;Warm regards, Mike&lt;/p&gt;
</description></item><item><title>Code Generators: when can you live with them?</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6378719</link><pubDate>Mon, 19 Nov 2007 01:04:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6378719</guid><dc:creator>Wojtek's Blog</dc:creator><description>&lt;p&gt;Tom Hollander just posted a note Code Generators: Can't live with them, can't live without them . His&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6378840</link><pubDate>Mon, 19 Nov 2007 01:09:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6378840</guid><dc:creator>Wojtek Kozaczynski</dc:creator><description>&lt;p&gt;Most of the comments are about the specific case of generating the DB mapping code, but don't address the key question: When it is worth creating a code generator as opposed to either (a) writing the code by hand or (b) trying to bake the logic (in this case db mapping) into a framework?&lt;/p&gt;
&lt;p&gt;Please see my blog entry that is trying to address this very question: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/wojtek/archive/2007/11/18/code-generators-when-can-you-live-with-them.aspx"&gt;http://blogs.msdn.com/wojtek/archive/2007/11/18/code-generators-when-can-you-live-with-them.aspx&lt;/a&gt; &lt;/p&gt;
</description></item><item><title>Code Generators: when can you live with them?</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6379494</link><pubDate>Mon, 19 Nov 2007 01:40:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6379494</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;Tom Hollander just posted a note Code Generators: Can&amp;amp;#39;t live with them, can&amp;amp;#39;t live without them&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6381968</link><pubDate>Mon, 19 Nov 2007 02:47:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6381968</guid><dc:creator>Evan</dc:creator><description>&lt;p&gt;I haven't found too many scenarios like you describe where the code generation can be replaced by a general purpose framework.&lt;/p&gt;
&lt;p&gt;Code generation works well, for say, generating the data model off the object model, generating the object model off the data model, or generating them both off a UML model.&lt;/p&gt;
&lt;p&gt;The problem with most code generation is that it's only uni-directional. &amp;nbsp;Without a generation tool that supports roundtripping (from source to destination, and destination to source), they are generally just a pain in the...&lt;/p&gt;
&lt;p&gt;For CRUD, I say no thanks. &amp;nbsp;I know the CRUD / Code Generation pain you speak of very, very well.&lt;/p&gt;
&lt;p&gt;It comes down to a few things for me. &amp;nbsp;First, I realize that this is not a simple problem and a simple fix will not provide the best solution (although maybe you can find good enough for you).&lt;/p&gt;
&lt;p&gt;If I'm in a situation where I can influence the thinking about the usefulness of spocs, I push hard to avoid them. &amp;nbsp;I seriously hate maintaining hundreds and hundreds of sprocs. &amp;nbsp;I hate having business logic in the database, and I hate having dumb sprocs with very simple select statements that need to be updated on a frequent basis. &amp;nbsp;I also have the same feeling as you, in that I hate having untested, unecessary methods in the Data Layer. &amp;nbsp;It just feels like a boobytrap/timebomb to me.&lt;/p&gt;
&lt;p&gt;If I can influence the team to dump sprocs (are they really necessary?), I'll push hard for an O/RM which will map my object model into the database. &amp;nbsp;Using parameterized queries, I'll even get the cached execution plans like sprocs. &amp;nbsp;My first choice falls to NHibernate. &amp;nbsp;I won't claim it's the end-all be-all, it just happens to be the first full O/RM that I tried. &amp;nbsp;I am happy as pie and never felt the need to look at anything else. &amp;nbsp;It saved me several hundred KLOC of code, and it's been around on the Java side since the dark ages.&lt;/p&gt;
&lt;p&gt;If I'm on an existing app, where sprocs are already all the rage (or the team can't jump over the no-sproc mind-barrier), I'll dig in hard for iBatis.NET. &amp;nbsp;It's much more flexible and will let me coexist my stuff with sprocs, without having all the code-gen stuff in my app tier.&lt;/p&gt;
&lt;p&gt;Or at least, that's my story and I'm sticking to it. ;-)&lt;/p&gt;
&lt;p&gt;Life is too short to write your own CRUD.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6382163</link><pubDate>Mon, 19 Nov 2007 02:53:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6382163</guid><dc:creator>Evan</dc:creator><description>&lt;p&gt;**I haven't found too many scenarios like you describe where the code generation can't be replaced by a general purpose framework.**&lt;/p&gt;
&lt;p&gt;Sorry for the typo.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6383457</link><pubDate>Mon, 19 Nov 2007 03:49:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6383457</guid><dc:creator>Evan</dc:creator><description>&lt;p&gt;Sorry, one last comment..&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420"&gt;http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Includes multiple approaches for tackling the Data Access issue (from Transaction Script, to Table Gateway, to Data Mapper, to Unit of Work, and much more). &amp;nbsp;Patterns are your friend.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6443855</link><pubDate>Wed, 21 Nov 2007 00:28:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6443855</guid><dc:creator>jezzsa</dc:creator><description>&lt;p&gt;I believe that keeping the generated code to an absolute minimaum is the key to success here. &lt;/p&gt;
&lt;p&gt;You mention codifing into a framework as an all or nothing approach, chosing the all option here. I disagree.&lt;/p&gt;
&lt;p&gt;Like most things in sw engineering its not one or the other, its a combination of both will lead to success (or perhaps find a new paradigm instead).&lt;/p&gt;
&lt;p&gt;Move the slider from 'all generated code' over towards 'generation of configuration code of a framework'.&lt;/p&gt;
&lt;p&gt;I beleive the best proven approach here is to codify the functionality of the solution domain into frameworks, and have the generated code only configure the framework.&lt;/p&gt;
&lt;p&gt;The models driving the generators simply represent (or implicitly abstract) configuration the framework parameters. It is the framework where the patterns and coding details are. That's where you extend and tweak.&lt;/p&gt;
&lt;p&gt;Basically the framework exposes a well-known interface to the models to configure via the generators.&lt;/p&gt;
&lt;p&gt;The framework is maintained seperately.&lt;/p&gt;
&lt;p&gt;Most of the problems you talk about here are related to details in the code that should not be generated (or exposed to be changed). Where fidelity of from model to code transformation is not high. &lt;/p&gt;
&lt;p&gt;Put the details into a framework where they are abstracted from the generator. &lt;/p&gt;
&lt;p&gt;If the details need changing, you can change the details within the framework without affecting the generators.&lt;/p&gt;
&lt;p&gt;Model+generator+framework is the successful pattern here.&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6538918</link><pubDate>Tue, 27 Nov 2007 04:24:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6538918</guid><dc:creator>Daniel COHEN-ZARDI</dc:creator><description>&lt;p&gt;&amp;quot;Don't generate code, generate the config files and have generic processes to manage record maintenance and other common requirements&amp;quot;... Well, I quite disagree with this.&lt;/p&gt;
&lt;p&gt;This is for example the pure meta-data based dynamic approach. To me, it should be avoided whenever you can (except if everything is really dynamic, which means you do not know your entities at design time).&lt;/p&gt;
&lt;p&gt;Experience at customers we have met trying to use this kind of approach or frameworks like N-Hibernate are nightmares. Performance is only a small part of the issue. The real issue is the operations and the debugging. Personnally, I hate messages like &amp;quot;Data Layer Error, Save Method, Entity #232&amp;quot;... whereas when you use strongly typed classes aligned to your business vocabulary, it is much easier to maintain : &amp;quot;Error on Customer.Save, Id 31&amp;quot;.&lt;/p&gt;
&lt;p&gt;Furthermore, I think we should learn from the past. Code Generators have always been at the heart of CASE Tools that have been quite popular on mainframes. So to me, they are definitely part of the solution for industrializing software.&lt;/p&gt;
&lt;p&gt;But this does not mean you need to do it yourself. As Wojtek posted, it can be very costly as complexity grows fast. But instead one can rely on products on the market, that have fully tested their generated code.&lt;/p&gt;
&lt;p&gt;My 0.02 Cents,&lt;/p&gt;
&lt;p&gt;Daniel&lt;/p&gt;
</description></item><item><title>re: Code Generators: Can't live with them, can't live without them</title><link>http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx#6591288</link><pubDate>Thu, 29 Nov 2007 07:02:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6591288</guid><dc:creator>macsgold</dc:creator><description>&lt;p&gt;I second the comments by Daniel above. &amp;nbsp;Go the (N)Hibernate (config driven runtime framework) approach and you won't scale to large domains (if you want to go there). &amp;nbsp;If you find yourself wanting to customize generated code then imagine how much fun you'll have trying to customize (N)Hibernate.&lt;/p&gt;
&lt;p&gt;Codegen is only as good as its input (including 'templates'), i.e. GIGO.&lt;/p&gt;
&lt;p&gt;If your only input (besides templates) is the data model then you will soon run into limitations (e.g. your unwanted output code).&lt;/p&gt;
&lt;p&gt;Consider:&lt;/p&gt;
&lt;p&gt;1) DataModel+Templates -&amp;gt; CodeGenCode&lt;/p&gt;
&lt;p&gt;vs.&lt;/p&gt;
&lt;p&gt;2) (MetaData+DataModel)+Templates -&amp;gt; CodeGenCode&lt;/p&gt;
&lt;p&gt;This MetaData is not 'configuration' for the templates but something higher level than (but deferring detail to) the DataModel. &amp;nbsp;E.g. &amp;quot;Customer contains fields X,Y,Z where X is typed as per field X1542 in table Cust101&amp;quot;. &amp;nbsp;The code generator gets detail from the data model but structure from the meta data.&lt;/p&gt;
&lt;p&gt;The metadata becomes a knowledgebase unto itself and can grow to serve any number of needs.&lt;/p&gt;
&lt;p&gt;Having said all this, codegen is like a cookie: messy to make but yummy in the end, even when only half baked.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-Matthew Hobbs&lt;/p&gt;
</description></item></channel></rss>