473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Layer design - some difficulties..

Hi all,

My web app is using a layered design, whereby I have UI/BOL/DAL layers....

So far things have been running fine and as the first app using this
approach I've seen some real benefits...

The problem I ran into yesterday had me in circles, and driving me crazy...

I have a following objects, class variables, properties and methods have
been "trimmed" for the posting....

RoleResourceCollection
-can contain many RoleResource objects

RoleResource object
-contains Resource object

ResourceObject
-contains AccessLevelCollection

AccessLevelCollection
-can contain many AccessLevel objects

AccessLevel object
-contains ResourceParameterCollection

ResourceParameterCollection
-can contain many ResourceParameter objects
Now, with other objects that I've created, I use my SQL.vb class which
contains various private/public methods to extract the data from our sql
server and return it, typically as a datatable, sometimes a dataset, but
never as an explicit object of types that I've created, for example, I
wouldn't return a "User" object from my sql.vb data access layer, as I feel
that this is incorrect, instead I should return the data to the calling
function which would then populate my object...perhaps like this:

So, with regards to the above object, how the hell do I get all my data!

Whilst I could produce a stored procedure to call that would return my
RoleResources's to populate the collection, and all of the Resources,
AccessLevels, ResourceParameters etc, its going to return a MASSIVE quantity
of rows, that, couple with the fact that I would then need to write a shed
load of code that iterates through the massive collection of datarows and
keeps checking to see if it should now be creating a new ResourceParameter,
or a new AccessLevel or whatever, ie, a lot of parsing of the data...it
seems a bit overkill and doesn't feel right...

I could obviously have a method thats called from each of the objects being
instantiated so that they run off to sql and just return the data needed to
create the object, downside here is that this would means LOTS of calls (a
parameter collection for example might contains 200+ datarows that need to
be turned into ResourceParameter objects, that would be 200+ database
connections!)...

I could however have a method in my sql.vb data access layer which creates
one connection, and then calls a series of stored procedures passing in the
connection, thus not having lots and lots of connections, this is great, but
my problem now is that it now doesn't seem easy/practical to just return
datatables, ie, if I'm iterating through and I return the data for a
ResourceParameter, really I need to create it then and and there, the same
is true of the other objects, but then this feels wrong because now I'm
creating my own explicit objects in the DAL which I've been trying to avoid
doing?!

Can anyone give me some pointers/suggestions on this please - am I missing
something, have I interpretted stuff wrong, is what I'm doing right? I have
found a lot recently that using this new approach (new for me), has had some
excellent benefits, but more often than not I can spend nearly a week on one
very small problem, which, if I think back to my ASP days I'd probably have
(badly) just returned a record set and iterated through it on the page! :o)

To clarify on my insane ramblings, I guess I'm asking, should I only be
returning data from the DAL (as its name would suggest) and not explicit
objects (ie, my own objects), and what would be the best approach on the
collections hell in the example above...

Any help is appreciated....

Rob

Feb 13 '07 #1
1 1101

What you're talking about is the Layer's "Glue".

And a reference to read from start to finish, aka, very informative for a
bird's eye view:
http://msdn2.microsoft.com/en-us/library/ms978496.aspx

Read this section
"Deploying Business Entities"
several times. Read it carefully.
MS recommends putting "glue" components in a seperate/common assembly.
Here is how I do it. Which is one implementation of the above URL.
http://sholliday.spaces.live.com/blog/
5/24/2006
Custom Objects/Collections and Tiered Development

Here, my glue is Data.DataSets assembly.

"Rob Meade" <ku***************@edaem.borwrote in message
news:uA*************@TK2MSFTNGP03.phx.gbl...
Hi all,

My web app is using a layered design, whereby I have UI/BOL/DAL layers....

So far things have been running fine and as the first app using this
approach I've seen some real benefits...

The problem I ran into yesterday had me in circles, and driving me
crazy...
>
I have a following objects, class variables, properties and methods have
been "trimmed" for the posting....

RoleResourceCollection
-can contain many RoleResource objects

RoleResource object
-contains Resource object

ResourceObject
-contains AccessLevelCollection

AccessLevelCollection
-can contain many AccessLevel objects

AccessLevel object
-contains ResourceParameterCollection

ResourceParameterCollection
-can contain many ResourceParameter objects
Now, with other objects that I've created, I use my SQL.vb class which
contains various private/public methods to extract the data from our sql
server and return it, typically as a datatable, sometimes a dataset, but
never as an explicit object of types that I've created, for example, I
wouldn't return a "User" object from my sql.vb data access layer, as I
feel
that this is incorrect, instead I should return the data to the calling
function which would then populate my object...perhaps like this:

So, with regards to the above object, how the hell do I get all my data!

Whilst I could produce a stored procedure to call that would return my
RoleResources's to populate the collection, and all of the Resources,
AccessLevels, ResourceParameters etc, its going to return a MASSIVE
quantity
of rows, that, couple with the fact that I would then need to write a shed
load of code that iterates through the massive collection of datarows and
keeps checking to see if it should now be creating a new
ResourceParameter,
or a new AccessLevel or whatever, ie, a lot of parsing of the data...it
seems a bit overkill and doesn't feel right...

I could obviously have a method thats called from each of the objects
being
instantiated so that they run off to sql and just return the data needed
to
create the object, downside here is that this would means LOTS of calls (a
parameter collection for example might contains 200+ datarows that need to
be turned into ResourceParameter objects, that would be 200+ database
connections!)...

I could however have a method in my sql.vb data access layer which creates
one connection, and then calls a series of stored procedures passing in
the
connection, thus not having lots and lots of connections, this is great,
but
my problem now is that it now doesn't seem easy/practical to just return
datatables, ie, if I'm iterating through and I return the data for a
ResourceParameter, really I need to create it then and and there, the same
is true of the other objects, but then this feels wrong because now I'm
creating my own explicit objects in the DAL which I've been trying to
avoid
doing?!

Can anyone give me some pointers/suggestions on this please - am I missing
something, have I interpretted stuff wrong, is what I'm doing right? I
have
found a lot recently that using this new approach (new for me), has had
some
excellent benefits, but more often than not I can spend nearly a week on
one
very small problem, which, if I think back to my ASP days I'd probably
have
(badly) just returned a record set and iterated through it on the page!
:o)
>
To clarify on my insane ramblings, I guess I'm asking, should I only be
returning data from the DAL (as its name would suggest) and not explicit
objects (ie, my own objects), and what would be the best approach on the
collections hell in the example above...

Any help is appreciated....

Rob

Feb 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PAD | last post by:
I have written a javascript routine that populates a parent document with a series of <iframe>s. Each <iframe> receives its contents from a series of separate smaller HTML files. Of course my NN...
6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
2
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
8
by: Jon Maz | last post by:
Hi, I'm facing a code-optimisation issue on an asp.net/vb.net/SQL Server 2000 project. A web page containing not much more than 3 DropDownLists is taking nigh on 6 seconds to load, because each...
8
by: deko | last post by:
Which layer should a Factory class go in? DA - Data Access BL - Business Logic UI - User Interface ??
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
6
by: Dhananjay | last post by:
hello everyone i have got a problem i want to design business layer, data access layer , presentation layer for asp.net using C#.net , can anyone help me to solve this problem. i want some...
17
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction:...
0
by: drawing in aspnet | last post by:
Question about putting the data layer in a separate class library. I keep reading that the data layer should be separated from the presentation layer and put in its own class library. I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.