Hi all,
I have a question. Maybe it has been answered a zillion times, but I
don't seem to find the answer.
It's not so much a practical question, although it has practical
implications.
As we all know, C# is an OOP, i.e. we are supposed to treat entities
as objects (e.g. in the application I'm writing right now, there are
objects like "Site", "Customer", "WishList", etc). The data about
these entities are stored in a dabase.
With Windows Forms or ASP.NET controls, you can immediately bind to
the tables in the database. But doesn't good programming practice tell
us to use 3 layers : Presentation Layer (in which the object gets
displayed), Business Layer (in which business actions are performed on
or with the object), and Data Acess Layer (in which the object
interacts with its data source) ?
Using a control like DataGridView to bind immediately to a table seems
to skip these layers. Or should the DataGridView be considered as the
encapsulating object ?
I'm not trying to start up a theoretical debate here, I just want some
clear guidelines.
Thanks for your input
Erwin 8 1042
I think you're discovering "RAPID" development vs "GOOD" development.
RAPID is just that....get something displaying/working as fast as you can.
With Asp.Net 2.0, MS put alot of RAPID stuff in.
Layered Development ( Pres / Biz / Data ) is not rapid (although for me,
when I do it, it seems just as fast or faster since I've been doing it so
long)......
RAPID != GOOD.
RAPID isn't always bad, if you're doing a demo or mock up, then sure.
But the cost of code is MAINTENANCE, not development costs. (Google
"software maintenance costs").
Thus for anything that is going to last or you need to maintain, then I
would avoid Rapid.
One issue with Rapid is that somehow, that "mock up" starts becoming the
base for the real project if its approved. I've seen this too much.
Treat a mock up like it is, throw away code.
...........
Mine is one opinion, there are others.
"ErwinB" <er***@onedaysolutions.comwrote in message
news:c5**********************************@u46g2000 hsc.googlegroups.com...
Hi all,
I have a question. Maybe it has been answered a zillion times, but I
don't seem to find the answer.
It's not so much a practical question, although it has practical
implications.
As we all know, C# is an OOP, i.e. we are supposed to treat entities
as objects (e.g. in the application I'm writing right now, there are
objects like "Site", "Customer", "WishList", etc). The data about
these entities are stored in a dabase.
With Windows Forms or ASP.NET controls, you can immediately bind to
the tables in the database. But doesn't good programming practice tell
us to use 3 layers : Presentation Layer (in which the object gets
displayed), Business Layer (in which business actions are performed on
or with the object), and Data Acess Layer (in which the object
interacts with its data source) ?
Using a control like DataGridView to bind immediately to a table seems
to skip these layers. Or should the DataGridView be considered as the
encapsulating object ?
I'm not trying to start up a theoretical debate here, I just want some
clear guidelines.
Thanks for your input
Erwin
Sloan,
tnx for your RAPID answer (pun intented), I'm reassured now that I'm
following the right track.
Erwin
I use a 4 layer approach. Data Access Layer, Business Object Layer,
Presentation Service Layer, and Presentation Layer. So the DAL gets the data
from the database, The BOL holds the data. The PSL is used by the
Presentation Layer to coordinate real world operations on the BOL (like the
controller in the MVC pattern) and the presentation layer is the WinForms and
WebForms.
I bind my grids, and in winforms, the whole form normally to business objects.
--
Ciaran O''Donnell http://wannabedeveloper.spaces.live.com
"ErwinB" wrote:
Hi all,
I have a question. Maybe it has been answered a zillion times, but I
don't seem to find the answer.
It's not so much a practical question, although it has practical
implications.
As we all know, C# is an OOP, i.e. we are supposed to treat entities
as objects (e.g. in the application I'm writing right now, there are
objects like "Site", "Customer", "WishList", etc). The data about
these entities are stored in a dabase.
With Windows Forms or ASP.NET controls, you can immediately bind to
the tables in the database. But doesn't good programming practice tell
us to use 3 layers : Presentation Layer (in which the object gets
displayed), Business Layer (in which business actions are performed on
or with the object), and Data Acess Layer (in which the object
interacts with its data source) ?
Using a control like DataGridView to bind immediately to a table seems
to skip these layers. Or should the DataGridView be considered as the
encapsulating object ?
I'm not trying to start up a theoretical debate here, I just want some
clear guidelines.
Thanks for your input
Erwin
Come to think of it, the last 4-5 years I did nothing else then
ASP.NET applications.
In Web applications, working with objects have little use : as soon as
the page gets rendered, the server forgets about it (and its objects).
That's why I used them rarely in the past.
(And I don't believe in putting huge chunks of data in Server
variables or cookies, that just clutters the roundtrips - you can as
easily retrieve the data from the database with every roundtrip. [with
AJAX things could be different, if Javascript was an OOP !])
A question for you, Ciaran : you say "BOL holds the data". Do your
objects holds the data in the dataset created and filled in the DAL,
or do you "map" the recordset to internal fields and properties ? Just
curious..
Erwin
i load business objects from either a datareader or datatable. I dont hold
the datatable past the DAL layer.
I have seen it done but I personally prefer to stick with proper objects. It
makes it easier when you want to create new ones and stuff.
--
Ciaran O''Donnell http://wannabedeveloper.spaces.live.com
"ErwinB" wrote:
Come to think of it, the last 4-5 years I did nothing else then
ASP.NET applications.
In Web applications, working with objects have little use : as soon as
the page gets rendered, the server forgets about it (and its objects).
That's why I used them rarely in the past.
(And I don't believe in putting huge chunks of data in Server
variables or cookies, that just clutters the roundtrips - you can as
easily retrieve the data from the database with every roundtrip. [with
AJAX things could be different, if Javascript was an OOP !])
A question for you, Ciaran : you say "BOL holds the data". Do your
objects holds the data in the dataset created and filled in the DAL,
or do you "map" the recordset to internal fields and properties ? Just
curious..
Erwin
Here are a few layered examples:
One of them is a tiered example. (WCF + Interfaces) http://sholliday.spaces.live.com/feed.rss
WCF with Interface Development
Custom Objects and Tiered Development II // 2.0
Custom Objects/Collections and Tiered Development
There is a MS article located at the (bottom) URL I have above.
Find "bird's eye view" in my post, and then follow the MS trail to the
article.
I would bookmark that article and reread it about every 6 months.
"ErwinB" <er***@onedaysolutions.comwrote in message
news:80**********************************@17g2000h sk.googlegroups.com...
Sloan,
tnx for your RAPID answer (pun intented), I'm reassured now that I'm
following the right track.
Erwin
I concurr with the "populate from datareaders".
My blog URL (above post) shows how to do this.
If you have Sql Server (or other rdbms) , you can use multiple resultsets
(with the IDataReader) to hit the db one time.
Check my sample(s) from the other post.
"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in
message news:51**********************************@microsof t.com...
>i load business objects from either a datareader or datatable. I dont hold
the datatable past the DAL layer.
I have seen it done but I personally prefer to stick with proper objects.
It
makes it easier when you want to create new ones and stuff.
--
Ciaran O''Donnell http://wannabedeveloper.spaces.live.com
"ErwinB" wrote:
>Come to think of it, the last 4-5 years I did nothing else then ASP.NET applications. In Web applications, working with objects have little use : as soon as the page gets rendered, the server forgets about it (and its objects). That's why I used them rarely in the past. (And I don't believe in putting huge chunks of data in Server variables or cookies, that just clutters the roundtrips - you can as easily retrieve the data from the database with every roundtrip. [with AJAX things could be different, if Javascript was an OOP !])
A question for you, Ciaran : you say "BOL holds the data". Do your objects holds the data in the dataset created and filled in the DAL, or do you "map" the recordset to internal fields and properties ? Just curious..
Erwin
Great stuff, especially the MS article.
In all honesty, with my ASP.NET applications I am not all that far
from your point of view : my DAL also only delivers data, and nothing
else.
Thank you both for your input
Erwin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tobias Windeln |
last post by:
Hi!
I'm looking for suggestions on object-based inheritance
in Python. Automatic forwarding (often called delegation)
in Python is easy:
def __getattr__(self, attr):
return...
|
by: Pradeep |
last post by:
Hi,
In the Web application I am working on, data is read from a SQL Server
database. At any time, there are about 15 people browsing the web.
The SQL Server database is updated with new...
|
by: Patrick |
last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can
1) Either set under IIS Manager-> Any specific Virtual Directory->
Configuration->Options->ASP Script timeout for all pages...
|
by: Richard |
last post by:
hi,
I am using SQL SERVER 2000.
My query is, Can I restore my 60 transactional log file backup
in one sql statement,giving condition where it is suppose to start
and end.
|
by: prashant |
last post by:
Hi,
I am trying to set up Transactional replication with immediate
updation.
The configuration is as follows:
1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is
on the...
|
by: DickChristoph |
last post by:
Hi
I tried posting this query in microsoft.public.sqlserver.programming but got
no response.
I am new to replication but I am trying to setup up a transactional
replication of tables from one...
|
by: GoogleEyeJoe |
last post by:
Dear ladies and gents,
I'm trying to determine whether the .NET Framework implements a means
of transactional processing without the need for a database.
Essentially, I'd like to enlist...
|
by: Ian Boyd |
last post by:
i accidentally ran an UPDATE statement without the WHERE clause on a
customer's live customers table. After saying "oh shit" many many times, i
closed the ad-hoc query tool, hoping DB2 would see my...
|
by: Michael Sparks |
last post by:
Hi,
I'm interested in writing a simple, minimalistic, non persistent (at this
stage) software transactional memory (STM) module. The idea being it should
be possible to write such a beast in a...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |