Frans and Thomas you are both missing my point. We also have a "runtime" engine. Our templates do not generate a DAL, they generate a Data Abstraction layer. Our DataAbstraction layer can fully support querying any column, we just have to add it to the filter
class. As p00k said we dont need that to begin with. We don't allow our customers to query on any field in the database. We could but we just don't need to. There is no reason we can't couple a runtime engine with our template generated code. You have pointed
out our "short-sightedness", but to me you couldn't be more wrong. I guess you didn't bother to look at the templates or you didn't understand them. You also pointed out code bloat. Code bloat means repitive uncessary code. Our generated code is built on top
of an entity framework that makes maximum use of reuse. I have stated repeatedly that this isn't an argument about whether or not O/R Mappers are applicable. They surely are. However neither you nor Thomas will dictate to me what works and what doesn't. Tell
the 5,000 automotive dealerships we have running on our architecture that our platform doesn't work. It took 2 developers working on our architecture as well as 2 applications consuming the architecture 6 months to develop everything. CodeSmith enabled us
to do that and still maintain control of our environment. I am not saying an O/R Mapper wouldn't do that also, but we chose CodeSmith and have been extremely happy about it. Maybe now you and Thomas can quit trying to decide everything for the rest of us .
As far as the runtime thing goes, to a degree I agree with you. A generic runtime can certainly reduce the overall amount of code, but at what price? By the very nature of it being generic, I am paying a price for using it. Code generation scenerios may
produce more code, but this is not code that should be maintained by hand anyway so who cares? This is not what's about, Eric, and you know that. A generic runtime library is not slow because it is generic. A generic runtime lib is code which requires
input to function, so to use it properly you have to provide it with proper input. Code generation can help there, a runtime engine which produces that input based on a mapping file and class reflection can do that too. Point is: an entity is an entity is
an entity. The saving logic will never change one bit, only the destination table(s) and fields will change per entity (type). That kind of generic code. My SQL generator engines generate SQL based on very complicated input. Input produced by generated code
executed at runtime AND developer written code using that generated code. But the engine is generic and definitely not slow because it is generic. It's just common sense to migrate code which is shared among a lot of classes into a generic common library (hey,
.NET is just that! :)). It is then a matter of give and take when to stop moving code to a generic library to prevent making the overall code less flexible.
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#)
>Pretty sure that my QA department will not buy that argument... > >"Hey we just changed the schema for this, but since we did not have to recopile, you don't have >to test it as much". Well I can't help what your QA department wants to do. he he :) In the
past a recompile to my QA department meant unit testing of the methods and properties of the code affected plus functionality regression testing. Changes that did not require a recompile meant just functionality regression testing. >If you are fine with someone
else defining the majority of your architecture, then by all means >get the black box. If you want more control, you need to build it. CodeSmith is great way to do both. Well I'm certainly not going to write my own ASP tag parser in C# so if you are using
a Framework (ASP.NET, JSP, PHP) you by default are allowing someone else to define the majority of your architecture. If I test out a component and find it's stable and meets my needs I have no problem buying/using a third-party component. I agree with Frans
point about NIH syndrome.
Frans, I appreciate your civil responses. Thank you for helping to keep this thread what is hopefully beneficial to developers who may have questions about O/R or code generation. Anyway, > However what if I want to filter on a given shipping date as well?
Or only want a limited amount of rows? I have to alter the proc. Again, you're assuming codesmith only generates solutions that work with sprocs. Not true. It can certainly gen ad-hoc queries as well. However, our templates do generate sprocs and those sprocs
accept filters on any parameter and provide sql-side paging, so we can return any number of rows as well. Those parameters are all exposed out of the DAL, so it very easy to work with and very clean. We don't have to write anything by hand to get that other
than the call where we need it with the appropriate parms set. When a schema changes and therefore possibly changes the signature of a sproc, it is not a problem because everything that references that sproc is also regen'ed at the same time based on the same
schema. Also, our hierarchical biz objects do save then entire tree when necessary. Our biz object model is designed so that objects understand child objects recursively and state management is handled all the way down. As far as the argument of "writing that
all by hand" is too time consuming, sure it takes a smidge more time than dropping in a ready-made solution. But seriously, the most complex of our templates has never taken me any longer than a couple hours tops to write. Chances are most developers already
have a good deal of code written by hand. It is quite easy to convert that code to a template. And you only have to do it once. From then on it can be used against all objects and its nothing but "click...done". If code is all over the place and cannot be
easily converted to generic templates, then the developer was probably producing some hard to maintain and understand code in the first place. Also, and this is directed to whoever said that code generation = no OO/reuse,.... ?!?!?!?!?!?! What are you talking
about? ?!?!?!?!?!?!?! Code Generation generates code. The same code that would otherwise have been written by hand. Are you saying that until O/R mappers came along OO and code reuse didnt exist? Is this a new concept that YOU developed and are now championing?
Maybe now you and Thomas can quit trying to decide everything for the rest of us .
Erm... I tried to be fair and balanced in this debate. As soon as these kind of remarks pop up, I'm out. No offence but you're way out of line here. I don't know you likwid, so chances are you don't know me either. If you want to start insulting me, go
ahead, the stage is yours. However to me you're doing to me now what you think I did to you (but I didn't).
You have pointed out our "short-sightedness", but to me you couldn't be more wrong. I guess you didn't bother to look at the templates or you didn't understand them. You also pointed out code bloat. Code bloat means repitive uncessary code. Our generated
code is built on top of an entity framework that makes maximum use of reuse. I tried to explain things. If you can't stand another's opinion, that's fine. I never used
any rude word in my postings to this thread. I tried to be professional and reasonable. I never used words like short-sightedness, however I see it mentioned here and refer to me as well. I just want to explain things how I see things, from
my POV. But apparently you are so full of hate or something that whatever I seem to say, I'm dictating what others have to do. Since when is that the case? I spend a lot of time on LLBLGen 1.x, a free dal generator which helped hundreds of thousands
of developers around the world. I damn right know what I'm talking about, Likwid. I also spend 2.5 years working on LLBLGen Pro. You may say I'm wrong, that's fine by me, but don't come to me I'm not
entitled to say what I think about the subject at hand. If there is ANYTHING I hate more in this world it is people who think what I have to say is somehow telling them to do what I have to say. It's just my opinion. If you don't like it, so be it, but
don't start insulting me. I'm trying to be professional, polite, open and fair. I get the feeling you want to be threated as such as well. Then do that to others as well.
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#)
I appreciate your civil responses. Thank you for helping to keep this thread what is hopefully beneficial to developers who may have questions about O/R or code generation Thanks. I hope it will indeed benefit developers to make a choice. What we all
should avoid is creating myths. An O/R mapper has weaknesses, codesmith's template solutions has them as well.
Again, you're assuming codesmith only generates solutions that work with sprocs. Not true. It can certainly gen ad-hoc queries as well. However, our templates do generate sprocs and those sprocs accept filters on any parameter and provide sql-side paging,
so we can return any number of rows as well. Those parameters are all exposed out of the DAL, so it very easy to work with and very clean. We don't have to write anything by hand to get that other than the call where we need it with the appropriate parms set.
Ok, I know that solution, it's a way of doing things. You have some problems with filters spanning more than one table, but alas, for the sake of the argument, let's say they're not there :) What I tried to explain is that if you opt for codesmith, and
you want O/R mapper functionality, chances are you have to write a lot of that functionality by hand. (either in custom templates or in a generic lib targeted by your templates).
When a schema changes and therefore possibly changes the signature of a sproc, it is not a problem because everything that references that sproc is also regen'ed at the same time based on the same schema. But what if there are more than 1 app targeting
the db? A lot of legacy systems have this: the database is in production for several years, it has an accounting system running on it and now it also has to be connected to the intranet using .NET. Whoops :)
Chances are most developers already have a good deal of code written by hand. It is quite easy to convert that code to a template. And you only have to do it once. From then on it can be used against all objects and its nothing but "click...done". If code
is all over the place and cannot be easily converted to generic templates, then the developer was probably producing some hard to maintain and understand code in the first place.
True, writing the code out first and then migrate them to a template is the way to do it. I use that approach as well (and move the generic code the runtime lib). Problem is though that a lot of code is very complex. The synchronization of fk's and pk's
for example. myOrder.Customer = myCustomer; you then want that myOrder is in myCustomer.Orders as well. Plus if you do: myOrder.Customer = myCustomer; that myOrder.CustomerID == myCustomer.CustomerID. It's simple at first, but hard to get it right. That's
what I was referring to: these kind of things are not addable by anyone. It takes time to get this right, and a team waiting for a solution to target their DB doesn't want to spend a month fixing this but wants to spend that month on writing BL code and the
GUI.
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#)
Frans, I 100% agree. I'm obviously not saying that code reuse and OO principals are a bad thing. They are obviously a great thing. What I'm saying is that in some situations I have the option of using code generation techniques and in some cases I happen to
think that is the right way to go. I maintain a single template. I think this is code reuse to the extreme. I get the benefits of code reuse and don't pay the penalties associated with making it so generic that it can handle all the scenerios I will throw
at it. Again, this doesn't make sense in all cases, but I believe that it does make sense in some and I think that the DAL is a good example of when it does make sense. Obviously things like the .NET framework classes wouldn't be cases where code generation
would make sense as these are a bunch of classes for specific purposes and do not lend themselves to code generation techniques.
Eric J. Smith
Chief Software Architect
CodeSmith Tools, LLC
http://www.codesmithtools.com
Ok, I consider my self a good devloper. Been doing this for ten+ years. made lots of money. Getting better all the time. In your posts, when you make broad statments like: > A significant amount of developers out there is unable to see whether an O/R > Mapper
is good or bad because they lack the theoretical knowledge on how an O/R > Mapper works and > everyone using CodeSmith templates to run his O/R mapper should imho > get a beginner course in object oriented programming and > but if you sit down and write your
own O/R mapper in a code generator, then frankly, > I question your ability. Why? Simple. Because a lot in an O/R mapper is very > repetitive code. This naturally leaves to a runtime library. Well, since I am included in "Significant amount of developers"
and "everyone using codesmith", then you are talking about me. You may not have called me an idiot directly, but you sure as hell implied it. This is not my first rodeo, and I have pissed off bigger folks than you. You have indeed said I was an idiot, and
a lot of other folks too. You are pissed right? Cause your language is getting a little sloppy... Having to reach for babble fish on some of it. > But a fool with atool - is still a fool A fool with an OR mapper is still a fool. An ass with an OR mapper to
sell and a keyboard is still an ass. > Now, otoh, you are a typical code bloater. YOu will have hundreds of unnecessary classes > that actually - make your perfoarmance optimizations hard to trace, use up a lot of > additional memory, make your program execute
slower (lower cache hits in the cpu core) > and a lot of other negatives. Besides your dll's are bloated. I mean, have 300 business > objects in a library - we have 600 classes (300 stubs, 300 busienss objects). How many > thousand do you have? This makes
it hard to run a profiler. That is pretty balsy... WTF do you know about my architecture? I write templates to generate the code I use. No bloat, just good solid tested code. > If code generation is so great, dude, then why does the .NET runtime come with
reusable > classes all over the place, instead of generating the source for every grid right into the > code of the window class? You seem to believe this is a viable approach. Sure, if the Grid did not do what i need it to do, then i buy another one, or make
it myself. If MS would put the source were i could get it, then that would make it easier. GRIDS and BL/DL are way different. Are you trying to imply that my complex BL should be as generic as a grid? > Any sane person will - when doing something as complex
as an O/R mapper based on a > code generator - come up with a shared runtime instead of repeating the same coe over > and over and over again. I am not saying MINE - I am saying yours. So, now I am insane for wanting more control? > You should try to understand
that using code generation does not prohibit you from > following good programming practices. DER!!! that is what I have been trying to tell your punk ass. > Or do they pay you by lines of code? I get paid to produce results. Repeatable, quantifiable results.
How do you get paid?
Frans, For the sake of professionalism as you put it, I will be more direct in targeting my responses for the correct person. You invited me to "bash you with a big hammer" in your own words. I never stated that CodeSmith provided the exact same functionality
as LLBLGen. More of my hostility has been aimed at Thona and his unintelligble ramblings. I have seen you participate in countless debates where you expressed your opinion in such a way that it appeared your way is the only way. If I was out of line, then
I apoligize. Do you provide the source code for your runtime engine? If not... What happens if I find a bug? What if you don't implement validation the way I want, what if you dont implement concurrency the way I want. I am left to your mercy. With CodeSmith
I can write what I want, I can implement it is gradually as I want, and I can make sweeping changes to my architecture simply by regenerating with new code. Again I will reiterate, I am not saying that your way is bad. I have never said that. This is a Build
or Buy scenario and I would rather Build. I learn by building. What if I want to create my own product as you have in 5 years. If I always depended on your application, I would lack the knowledge of implementing it myself. I am sure there is some NIH syndrome,
but I do not see it as a bad thing. I have always learned better by doing rather than consuming. Your application is fine, but for us we want to make the mistakes, and learn to correct them. We will learn by building and doing rather than using your libraries.
I have said repeatedly CodeSmith is not for everyone. We spent a lot of time at work and out of work designing and developing our current architecture. I am sure we will continue to spend alot more time doing this. As for things your application does like
recursive object graphs, 1 line of code to save a tree of objects, we haven't implemented that. Guess what, we don't need it right now.
::but I believe that it does make sense in some and I think that the DAL is a good example ::of when it does make sense Frankly, Eric, my findings are just the opposite. For the same reason I am also not using the DAAB in the EntityBroker. I found that I can
handle all DAL operations with a handfull of classes - I don't want to get into the number details, because it is a question of counting, but if you ignore the query definition classes, then I basically have 5 or 6 classes ONLY that deal with ADO.NET etc.
And NONE of them would benefit in any way I would consider sane from being put under a code generator. ESPECIALLY in the DAL layer, you basically end up with code that is generic ANYWAY. See, you deal with the System.Data namespace. So all the stuff you do
is generic. Now, there are some points where I could really benegit from unrolling a loop - but really, this is so minor, the loop does not even show up on a profiler in the first place. Like for example my CRUD class. We don't use SP's - just for info. It
is responsible for one table mapping,. It is generated for this mapping, and is preparing the SQL statement, reusing it from there on. If it has to make an insert, it is then getting the fields of the object in an objet array (and it has to be an abstract
container anyway, as we allow the DAL to be remote), looping over them, position by position, coying the value into the prepared parameters for the insert statement, executing the statement. There are a handfull of checks for riggering side functionaltiy (retrieving
the identity values etc.), but the whole thing is firs totally time-uncritical, and secondly generic anyway and per definition. Especially the DAL, having to go through a generic interface anyway, is where I think code generation is abused. Further up - points
may change. But not there.
likwid
Member
280 Points
56 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:11 PM|LINK
FransBouma
Participant
1509 Points
312 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:21 PM|LINK
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
skoon
Member
170 Points
34 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:25 PM|LINK
p00k
Member
90 Points
18 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:30 PM|LINK
FransBouma
Participant
1509 Points
312 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:31 PM|LINK
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
FransBouma
Participant
1509 Points
312 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:43 PM|LINK
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
ejsmith
Member
79 Points
17 Posts
ASPInsiders
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:44 PM|LINK
Chief Software Architect
CodeSmith Tools, LLC
http://www.codesmithtools.com
tcarrico
Member
100 Points
23 Posts
ASPInsiders
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:44 PM|LINK
likwid
Member
280 Points
56 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:47 PM|LINK
thona
Member
20 Points
2923 Posts
Re: Your favorite O/R Mapper?
Aug 10, 2004 07:50 PM|LINK