﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Rafal commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>SQL is imho abstract enough - it hides the details of the underlying data store behind a nice high-level language. It's bad IMHO that ORMs are all trying to hide it behind their own, often leaky and limited abstractions. It lets you forget about SQL when coding but you are quickly reminded of it's existence when there are any problems in runtime.
Anyway, trying to hide ORM's abstraction behind another abstraction (the repository) makes everything worse - so Ayende's right about it. But C# is IMHO  ugly and very limited as a data manipulation language and instead of trying to fix it with ORM we should rather think about ditching it and handling the data in a language designed for that purpose. So that ORMs would not be needed at all. </description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment26</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment26</guid><pubDate>Wed, 11 Jan 2012 19:38:53 GMT</pubDate></item><item><title>Miki commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@jim These two features are a major point in my Point Of Sale application

&gt;&gt; What's the point of abstracting sql with hql for example

hql has a better coding interface than SQL, and allows you to use your domain model objects and the property names as they appear in the model, rather than the table and field names, which when using a legacy database, can have absolutely no relationship between your domain name and the field name. It also allows you to express complicated joins between tables in a way that makes it easier to read later on.
I have in my application one large hql query, which is the heart of the application, which if I had to write it in sql, would have grown to over 2 pages of sql and would be near unreadable.

&gt;&gt; and there is no point abstracting data access so that it is db agnostic, no one changes db engines on a whim.

It's very useful actually, this feature enabled me to support clients with both SQL and Oracle databases, without having to change my domain model at all (the server database is created from a third party application, so it has the same structure). All I had to change were a few minor references to schema names, and everything kept working. If I didn't had this feature, I would have lost of my largest clients.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment25</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment25</guid><pubDate>Wed, 11 Jan 2012 18:44:19 GMT</pubDate></item><item><title>jim commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Speaking of needless abstractions, I can point out several in NHibernate. 

You should write a blog post on what's WRONG with NHibernate. That would actually be productive.

What's the point of abstracting sql with hql for example, and there is no point abstracting data access so that it is db agnostic, no one changes db engines on a whim.

"In good applications, I have hard time finding the data access code, because it isn’t there. It is in the OR/M or the server client API"

I would say the opposite. Repetitive plumbing code might be a bad thing but explicit data access is not.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment24</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment24</guid><pubDate>Wed, 11 Jan 2012 16:42:27 GMT</pubDate></item><item><title>Ayende Rahien commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Jim,
I wrote several blog posts expressing my frustrations with different parts of NHibernate.
Query parsing in particular has been a problematic area, the way NHibernate SQL generation is dumb, the fact that there are no less than 4 (or maybe 6) different ways to do a query is horrendous. 
I can go on, probably longer than you care.

It doesn't change the fact that NHibernate is actually:
* A really good OR/M
* Not meant to be a sample app
</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment27</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment27</guid><pubDate>Wed, 11 Jan 2012 16:30:53 GMT</pubDate></item><item><title>Rafal commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Thanks to all guys who know how to build applications 'better' we have such a mess now. I won't be surprised if the next big thing will be the discovery that we can use plain SQL for data access directly from web page templates. Or even from browser-side javascript:) Who needs LINQ if there's SQL - clean, simple and powerful...</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment23</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment23</guid><pubDate>Wed, 11 Jan 2012 10:03:45 GMT</pubDate></item><item><title>Dmitry commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Most modern ORMs already use IQueryable&amp;lt;T&amp;gt; as a repository. Sometimes an interface implements the IQueryable to add Include/Fetch methods.

Operations like Insert/Update/Delete should be done by the unit-of-work.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment22</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment22</guid><pubDate>Wed, 11 Jan 2012 04:19:24 GMT</pubDate></item><item><title>Steve Py commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Implementing ICollection is absolutely the wrong approach for a repository pattern like this.

Inheritance is "Is A", not "Is Something Like A". 'nuff said.

Regarding the multiple ORM implementation and abstraction, I agree it's definitely not something people should try in real-world projects. You only have to try it once to hopefully realize how much extra work you're doing for something that will *never* actually be used. Perhaps their goal was to show how the patterns can be applied with different ORM solutions but they should have simply picked one and noted that others could be applied easily enough.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment21</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment21</guid><pubDate>Tue, 10 Jan 2012 23:35:56 GMT</pubDate></item><item><title>Alex Simkin commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@Jeff Sternal

Why?  

DELETE * FROM TABLE_NAME and 
SELECT * FROM TABLE_NAME

are possible implementations of Clear and CopyTo :)</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment20</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment20</guid><pubDate>Tue, 10 Jan 2012 21:44:24 GMT</pubDate></item><item><title>Wayne M commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Thanks for the reply.  I'll definitely check out the blog source code; I have to say I always thought it was "wrong" to put data retrieval methods directly in a controller without some kind of abstraction layer, but maybe that's because I have a mostly WebForms background and it's a cardinal sin to put raw data access code in a code-behind file.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment19</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment19</guid><pubDate>Tue, 10 Jan 2012 21:42:40 GMT</pubDate></item><item><title>Jeff Sternal commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>ICollection is the wrong abstraction because the interface promises things the concrete class can't (and shouldn't) do.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment18</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment18</guid><pubDate>Tue, 10 Jan 2012 19:15:14 GMT</pubDate></item><item><title>João Bragança commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Because you already have IQueryable. What other abstraction do you need? Jumping through hoops to try to pretend the database isn't there just isn't worth the effort.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment17</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment17</guid><pubDate>Tue, 10 Jan 2012 18:04:31 GMT</pubDate></item><item><title>Remyvd commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Why is ICollection (and/or IQuerably/IEnumerable) the wrong abstraction? Saying that ICollection is bad is ok, but without explanation/reason we can't discuss/learn from it. The only risk I see, is that a developer could load a complete table into memory (you don't want that with large tables).

Also I understand your point about using the OR/M as the repository if all data can be called this way. But if you have several kind of data sources in different technologies, then it would be nice if you have one kind of interface. Also when an object (like Customer) is combined from data out of different data sources, the repository is for me a good place to initialize the object and return it. How would you solve this cases?



 </description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment16</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment16</guid><pubDate>Tue, 10 Jan 2012 17:57:46 GMT</pubDate></item><item><title>TJ commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>I agree with ayende, the ICollection is not suitable for IRepository</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment15</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment15</guid><pubDate>Tue, 10 Jan 2012 16:02:24 GMT</pubDate></item><item><title>Tyrone commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>+1 for @Wayne M! @Ayende, have you come across any other applications we can have a look at, besides your own Raccoon Blog, who have implemented 'good practices'? By the way, I implemented the abstraction you talk about here in my first major mvc app, and I have to agree, it is just too much. Thank you and I am learning a great deal from the source of this blog.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment14</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment14</guid><pubDate>Tue, 10 Jan 2012 15:57:41 GMT</pubDate></item><item><title>Ayende Rahien commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Giacomo,
Yes, ICollection is bad here.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment13</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment13</guid><pubDate>Tue, 10 Jan 2012 15:30:03 GMT</pubDate></item><item><title>Ayende Rahien commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Wayne,
For queries, I just make the queries from the controller.
For reusable queries, I make an extension method for that.
For sample application, look at this blog source code.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment12</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment12</guid><pubDate>Tue, 10 Jan 2012 15:18:56 GMT</pubDate></item><item><title>Joseph Daigle commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@James: Point of clarification. I meant that the architecture of NSK hasn't changed much at all, while patterns and practices have. NSK is just too far out-of-date to be used as a learning of example.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment11</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment11</guid><pubDate>Tue, 10 Jan 2012 14:36:25 GMT</pubDate></item><item><title>James McKay commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@Joseph: On the contrary, architectural patterns and practices have changed a lot since then. They're a lot more lightweight for starters (e.g. Don't Repeat Yourself, Convention over Configuration, XML bad/JSON good etc) and, as I said, there's the difference between having to choose from a couple of mature, stable ORMs versus a larger number of fleeting, immature ones.

@Giacomo: I'm thinking here of, for example, Subsonic and micro-ORMs such as Massive, Dapper etc. Just off the top of my head...</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment10</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment10</guid><pubDate>Tue, 10 Jan 2012 14:21:31 GMT</pubDate></item><item><title>Giacomo commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@Ayende : can you elaborate on 

&gt; &gt; Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.
&gt;
&gt; The fact that this is totally the wrong abstraction to use doesn’t enter to the design, it seems.

You mean that ICollection&lt;T&gt; is the wrong abstraction, right?

@James : out of idle, can you list some of the "alternatives worth using" that are on Github. I'd like to take a look at them. You are talking of .NET tools, aren't you? </description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment9</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment9</guid><pubDate>Tue, 10 Jan 2012 14:01:08 GMT</pubDate></item><item><title>Joseph Daigle commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>As others have pointed out, this project apparently started 6-7 years ago. I think it's important to realize what a different mindset everyone had back then, in terms of .NET development.

While the project has been maintained since, I doubt very much that the architecture has changed much at all in the last 6 years.

I'm not sure it's valid to use such an old architectural example (which was never intended to be used in a commercial/production system) as a learning tool for today.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment8</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment8</guid><pubDate>Tue, 10 Jan 2012 13:57:37 GMT</pubDate></item><item><title>James McKay commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Andrea's post does raise an interesting point that puts the practice of supporting multiple ORMs into perspective: NSK has a long history and dates back to a time when the needs of .NET development were quite different to what they are today.

Back in 2004, when NSK first got going, .NET O/R mappers were all commercial offerings produced by two-guys-in-a-garage ISVs. (Anyone remember Pragmatier, EntityBroker, WilsonORMapper, Objectz.net?) These were coming and going like nobody's business, and you couldn't rely on the one you chose still being around six months later. With that in mind, abstracting out your ORM "just in case" you needed to replace it was the only sensible thing to do.

These days, of course, we have NHibernate and Entity Framework, both of which are well established and not going away any time soon, and any alternatives worth using are on Github. With that in mind, it's perfectly sensible to pick one and stick with it, and planning for the contingency where you'll need to swap one for another is much more a waste of time.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment7</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment7</guid><pubDate>Tue, 10 Jan 2012 13:41:55 GMT</pubDate></item><item><title>Wayne M commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>I'm curious, if you don't use Repositories what do you use for your data access?  I can't remember if you touched on it in a previous blog post but I would be interested to know.  

I tend to use a Repository-like pattern (it's really more like the Table Data Gateway than the DDD Repository; in fact I only refer to it as "Repository" because I think it sounds nicer and because it's based on what I saw Rob Conery do in the MVC Storefront series) so I don't have to use ActiveRecord (which I detest for all but the simplest scenarios).

Also, is there any complete sample application that you would recommend as a general "best practices" guideline?  Macto, obviously, but that's not quite finished yet :)</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment6</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment6</guid><pubDate>Tue, 10 Jan 2012 13:25:20 GMT</pubDate></item><item><title>Jason Meckley commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>I'm with Oren on this. From what I have seen NSK is a big ball of mud. The goal of the project may be demonstrate "layering", "common design patterns" and a domain model, but it fails to in it's implementation.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment5</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment5</guid><pubDate>Tue, 10 Jan 2012 13:17:07 GMT</pubDate></item><item><title>raffaeu commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>Few comments:
*there is not reason to have multiple implementations with different OR/Ms*
Not true, the first target of NSK is a learning audience and everyone uses a different OR/M. NSK shows you how to abstract your architecture from the OR/M so that you can switch between them and recycle your data layer for future applications.</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment4</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment4</guid><pubDate>Tue, 10 Jan 2012 13:05:11 GMT</pubDate></item><item><title>Ronnie Overby commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@Marta THEN DON'T READ HIS BLOG!</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment3</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment3</guid><pubDate>Tue, 10 Jan 2012 12:17:13 GMT</pubDate></item><item><title>Marta commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>@Ayende: I do not like your tone, always arrogance and haughtiness!
@Andrea: Nice post! But when a wise man points the moon, the fool looks at the finger [Cit] ...it's mean that 2(euro)cents are too many, Ayende cannot understand the goal of the project and will continue to look at the finger!</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment2</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment2</guid><pubDate>Tue, 10 Jan 2012 12:07:09 GMT</pubDate></item><item><title>Andrea Saltarello commented on Northwind Starter Kit Review: Data Access and the essence of needless work, Part I</title><description>just my 2 (euro)cents: http://goo.gl/DQUma</description><link>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment1</link><guid>http://ayende.com/153028/northwind-starter-kit-review-data-access-and-the-essence-of-needless-work-part-i#comment1</guid><pubDate>Tue, 10 Jan 2012 11:28:20 GMT</pubDate></item></channel></rss>