UI Generation Logic

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

From an architectural/design perspective, if a web form
page uses server side logic to generate part of the UI,
this logic be abstracted within a separate presentation
layer class, or is it okay to implement using private
methods of the web form page class. Or does it belong in a
business tier class?

Note, I am not talking about common logic that can be
abstracted into a user control for use across multiple
pages, nor the handling server control events either (ie
ItemCreated in DataGrid).

My doctrine is to keep it within the web page, unless it
is used across multiple pages, where I abstracted using
user controls.

Interested in people's thoughts on this one...

Glenn.
 
FWIW, here's my take on this. In any application, you have business logic
(the logic that accomplishes some task), as well as presentation logic (the
logic that manages the User Interface). The Interface is simply the means of
accessing the business logic for the purpose of accomplishing a task. Good
N-Tier development dictates that the business logic should be separated form
the interface logic for the purpose of extensibility. For example, if I have
a web site where a pilot can file a flight plan with the FAA, the code for
that web site must interface with the FAA to file the flight plan. However,
I might later want to expose that functionality to file a flight plan with
the FAA as a web service. If I architect the original application correctly,
thaty should be a slam dunk. All I have to do is design the original app
with a class library that does the actual flight plan filing and exposes
it's functionality through a programming interface. Then I build an ASP.Net
web interface that works with that class library and provides a web
interface to do the work.

Again, I think you're on the right track when you further break down the
Interface tier into individual pages with interface logic built into them,
as well as components (Server Controls of one kind or another) that can be
re-used across pages. This makes maintaining your app easier, as well as
optimizing your program's functionality, and providing you with a set of
reusable components.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top