Design Question

Design Question

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


MadGerbil posted on Wednesday, July 05, 2006

I'm reading through The Book(tm) and I'm picking up a great deal of good information.  I'm responsible for putting together our departments first ASP.NET application so I'm wanting to do it the right way.

Right now we are looking at 3 physical layers.

- Client Workstation (Web Browser)

- Application/Web Server

- SQL Server

I'm reading through the first chapter in The Book(tm) and the flexibility of being able to use mobile objects is very interesting - although, apparently something I won't be using since I only have 3 physical tiers.   Just to make sure I'm 'getting' this, though, I want to ask if in a web environment if the mobile business objects are ever passed to the client workstation.

I'm guessing NOT, but I wanted to make sure.  It looks like when The Book(tm) is talking about mobile objects those objects can only pass between machines with the proper .DLLs installed, so conceptually, I could pass 'em between the Database server and the Application Server and the Web Server (if web/application were on two seperate servers) but not to the client workstation in a web environment.

Does that all sound good?

cneller replied on Wednesday, July 05, 2006

Yep - you got it.  The objects are NOT intended to be serialized to JavaScript on the client's computer (though you might be able to pull this off using Atlas or JSON.NET)

dredge replied on Wednesday, July 05, 2006

The single most important thing to remember when doing an ASP.NET application, is that your application architecture should not be any different on ASP.NET vs. WinForms vs. any other project type in .NET. ASP.NET is just a different type of UI. Your core architecture should look the same whether it's Windows or Web - in fact, you should be able to take your core business objects and logic and put it in the web or windows without any changes. If your archetecture does not allow for this, then i would highly recommend re-evalutation of your architecture.

Of course, there are significant differences between Windows and the web, and this needs to be accounted for when you are creating your user interface, custom controls, and UI specific logic - but your business object model should never have a reference to system.web or system.windows.

If you need some reading material on how to achieve this, I would start by studying the Model View Presenter pattern, and the Inversion Of Control / Dependency Injection patterns.

I've been developing applications from one winform/webform, all the way out to scalable n-tiered (physical / logical) enterprise level applications for years now, and I've never once had to choose between Windows and Web for the user interface (and i do both, regularly) - it just doesn't matter. You need to know the limitations and advantages of each, but it really doesn't matter when it comes to your application architecture.

DavidDilworth replied on Thursday, July 06, 2006

I'd say yes that all sounds good, with one minor mistake.

Mobile objects do not "move" between the database server and the application server.  Only data moves between the database server and the app server - not objects.

Objects move between the app server and the web server (using remoting).  And that's as far as the objects go.  They are then "consumed" by your web pages on the web server.

You are correct that the client workstation does not have access to the objects, since it does not have access to your DLLs.

HTH

Copyright (c) Marimer LLC