Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

n-tier architecture abstraction

I think I understand the concept of a multi-tier system. However, most of the .net samples I've seen don't seem to have much abstraction between layers. (ASPX generating SQL statements is not abstract!) This is for a web form, so the ASPX = run on central server bit makes it more confusing.

Particularly, how do you handle search and sort? Sort is easier: I claim it should be done either all the way out at the front end, where there's plenty of excess processing power, or all the way in the database, where there's lots of optimization. But these are both difficult: front end requires writing browser code, outside the scope of the normal framework; database 'order by' requires either the front end knows a lot about the database, or the creation of multiple methods specifiying 'how to sort'.

Similarly with search, except it clearly should be in the server. And the user may have many options ("firstname=Bob, state=NY, yearsAsCustomer > 5").

I'm leaning towards 'in the database' for both, there must be standard patterns for mapping the request all the way back from the web browser to the ASPX presentation code to a possible middle tier or even two ('business' and 'data access' abstractions) to the actual database.

Any ideas? Suggested reading (books or websites?). Martin Fowler has some thoughts on this in the draft of his next book at .

Wednesday, October 30, 2002

definatly do all sorting and stuff through the database. Databases' were made to do this sort of thing.  If your sql isn't horrible, it will almost always be faster then any algorithm you can come up with programaticly, front end or not. 

Vincent Marquez
Wednesday, October 30, 2002

This is an excellent book on designing scalable systems using MS technology. It's about COM+, but it all applies to .NET as well:

Chris Tavares
Thursday, October 31, 2002

On a web app it's not so much a question of where the processing power lives, it's a matter of minimizing network traffic.  Your network round-trips will likely be the slowest stuff in your app, by quite a bit.  if the data volume for a given page is low the round-trip isn't too bad...but then the local sort wouldn't be bad either.  If it's a lot of data, you don't want to go fetch it all again, no matter how efficient the DBMS engine is.  We usually sort on the server, but that's as much for ease of coding as anything else, plus the fact that shipping a lot of javascript around is also not free.  When data volumes get high web pages are just bog-slow, no matter what you do.  ASCII transfers will always be slow.  So, you design the GUI workflow differently for a web app.

Friday, November 1, 2002

*  Recent Topics

*  Fog Creek Home