473,785 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is this a good application Design?

Hello,

Currently my application has three tiers-

1. Presentation Layer (Asp.Net / Win Forms/ Pocket PC UI.)
This predominantly contains User Controls, Custom Controls and Win/Web
Forms.
I have one base form and I inherit from that form.
All validation is done in this tier. There is zero Data Access code in this
tier. This tier exclusively gets DataViews/ Arays/Lists as input. Outputs
are string objects with SQL Statements or just paremeters with
dataconnection key.

2. Business Layer.
Currently this is just a Library residing in the same machine as
Presentation layer. Eventually I plan to use WebServices if application
needs physical seperation.
Most of Business Logic are implemented in this layer. There is absolutely no
UI code here.
These are all bunch of static methods which perform CRUD functionality.
All methods are atomic in nature. I dont rely on Static Variables. There is
just one DatabaseGateway class which does all the functionality.

3. Data Layer. (SQL Server)
I dont use stored procedures. predominantly use Views.
I have been reading up on Rockford Lhotka's business objects and I just feel
that his framework is unnecessarily complex. I just dont see the need to
hold these intermediate Business Objects.

Thanks for your responses.

--
Jay Balapa
Director Of Software Engineering
www.atginc.com

Nov 17 '05
50 2841
Steve Walker <st***@otolith. demon.co.uk> wrote in
news:TX******** ******@otolith. demon.co.uk:
Using C# from within the database is not terribly portable between
databases. Implementing a tiered design with simple stored procedures
gives you more options and allows you to do what SQL is good at in SQL
and what object oriented languages are good at in object orientated
languages. If presentation, domain model, data access and database
logic (i.e. stored procedures)are all distinct tiers it's relatively
easy to substitute a different platform for any one of them. If the
stored procedures are relatively simple CRUD affairs, you will even be
able to migrate to a platform which doesn't support stored procedures
with relative ease.


Spot on.

In fact, you can even see performance benefits from this approach, as well as more scalable
deployments.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 17 '05 #31
"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** *************** ***@127.0.0.1.. .
"bradley" <so*****@micros oft.com> wrote in
news:#9******** ******@TK2MSFTN GP15.phx.gbl:
If you want to do away with the complexity of the business objects,
then consider moving this business logic to the database as stored
procedures and triggers.


There are of course many schools of thought, but personally I would never
recommend that. If
you want my views as to why, you can read the link that I just posted.


Chad,

I have to respectively disagree with you. There are several instances where
the business logic should be in the stored procedures. Suppose you have a
posting procedure that needs to compute the average cost of items based on
thousands of invoices, then post those costs to another table. In order to
do that logic in the business tier, you would have to retrieve all of the
relevant data locally, crunch it, then send it back to the DB server in
another form. This defeats the whole purpose of having a database server to
begin with. Now you're back to the FoxPro days where the network bandwith
was sucked up by thousands and thousands of rows of data being sent back and
forth across the network for processing. One of the main advantages of
having a database server is to let it crunch (read - perform logic) all the
data and return only the much smaller result set.

I'm not saying your approach is necessarily incorrect. That would work
great if you were dealing with small chunks of data. But when you have to
insert values into tables based on numbers computed from thousands of rows
of data in other tables, I think it's best to let the DB server do all of
the work for you. That way nothing has to travel across a wire.

My $.02

Mike Rodriguez
Nov 17 '05 #32
"Michael Rodriguez" <mi**@nospamfor me.com> wrote in
news:Oe******** ******@TK2MSFTN GP09.phx.gbl:
I have to respectively disagree with you. There are several instances
where the business logic should be in the stored procedures. Suppose
you have a posting procedure that needs to compute the average cost of
items based on thousands of invoices, then post those costs to another


These exceptions are rare, and if you read the URL I posted, I even covered this. These account for <
1% of business logic, yet most systems implement often half of their business logic in the
datbase.

Even in this case, its a simle matter of running a grouping query, dividing and reposting. There are
complex cases though beyond your example that definitely need to be in an SP, but again they are
rare.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 17 '05 #33

"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** *************** **@127.0.0.1...
"Michael Rodriguez" <mi**@nospamfor me.com> wrote in
news:Oe******** ******@TK2MSFTN GP09.phx.gbl:
I have to respectively disagree with you. There are several instances
where the business logic should be in the stored procedures. Suppose
you have a posting procedure that needs to compute the average cost of
items based on thousands of invoices, then post those costs to another


These exceptions are rare, and if you read the URL I posted, I even
covered this. These account for <
1% of business logic, yet most systems implement often half of their
business logic in the
datbase.


I have to admit I have a rare application! We do accounting for restaurants
and everything is based on theoretical food costs, which involves a lot of
data to compute. Many of my posting stored procedures are contain over 500+
lines of T-SQL code. As much as I would like that work done in the business
layer, it just isn't practical in our case.

I did like your article, though. Nice work.

Mike

Nov 17 '05 #34
"Michael Rodriguez" <mi**@nospamfor me.com> wrote in
news:e8******** ******@tk2msftn gp13.phx.gbl:
I have to admit I have a rare application! We do accounting for
restaurants and everything is based on theoretical food costs, which
involves a lot of data to compute. Many of my posting stored
procedures are contain over 500+ lines of T-SQL code. As much as I
would like that work done in the business layer, it just isn't
practical in our case.
Exceptional cases do exist. :) But in most business applications such calculations that can be done
with measureable diference in performance in the SP's versus the business layer are a small
amount.

I dont envy the large SP's you have to maintain. I once designed a system to track trades, which we
thousands per second. We had to build big calcuation and aggregation servers becuase not even the
DB could keep up.
I did like your article, though. Nice work.


Thanks. I hope you found something useful. Please feel free to pass it around and dont forget to
vote in the bottom right. :)

Its actually the first in a series of articles, so keep your eyes open.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 17 '05 #35
"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** *************** **@127.0.0.1...
Exceptional cases do exist. :) But in most business applications such
calculations that can be done
with measureable diference in performance in the SP's versus the business
layer are a small
amount.

I dont envy the large SP's you have to maintain. I once designed a system
to track trades, which we
thousands per second. We had to build big calcuation and aggregation
servers becuase not even the
DB could keep up.


It's really a very fine line. If you have a system where hundreds of users
are crunching loads of data, which poison do you pick? Do you do all the
work in stored procedures (= database bottleneck), or do you send everything
back to the clients and distribute the processing (= network bottleneck).
We're still trying to figure it out...

Mike
Nov 17 '05 #36
For good architectures read on:
http://msdn.microsoft.com/practices/...s/default.aspx

Kurt

"Eliyahu Goldin" wrote:
I am not sure what are you getting to by insisting on moving the SQL to the
business layer. It looks to me like insisting on the dotnet framework to
belong to one layer only.

A database consists of tables, view, stored procedures, triggers etc. Tables
and views belong to data layer. Stored procedures and triggers can be in
either data or business layer. It won't hurt the SQL server if it will
contain elements of both levels.

Eliyahu

"Josh" <s@a.com> wrote in message
news:uG******** ******@tk2msftn gp13.phx.gbl...
Keeping the layers truely seperate is difficult. I would suggest that

even
if you have to itereate through a result set the SQL should be in the
Business Layer, pass your filter criteria to the business layer.


"Jay Balapa" <jb*****@hotmai l.com> wrote in message
news:eD******** *****@TK2MSFTNG P12.phx.gbl...
Josh,

Thanks for your response.

SQL most of the time is in the Business layer.

Sometimes I need to iterate Datarows in a Datagrid. In those cases I make that exception.

--
Jay
"Josh" <s@a.com> wrote in message
news:OS******** ******@TK2MSFTN GP10.phx.gbl...
> Your SQL should be in the Business Layer. The presentation layer should> not make or provide decisions on how data is collected ( that what tables> / view or columns are used ) as that is a business rule.
>
>
>
> "Jay Balapa" <jb*****@hotmai l.com> wrote in message
> news:%2******** ********@tk2msf tngp13.phx.gbl. ..
>> Hello,
>>
>> Currently my application has three tiers-
>>
>> 1. Presentation Layer (Asp.Net / Win Forms/ Pocket PC UI.)
>> This predominantly contains User Controls, Custom Controls and Win/Web>> Forms.
>> I have one base form and I inherit from that form.
>> All validation is done in this tier. There is zero Data Access code in
>> this tier. This tier exclusively gets DataViews/ Arays/Lists as input.>> Outputs are string objects with SQL Statements or just paremeters with
>> dataconnection key.
>>
>> 2. Business Layer.
>> Currently this is just a Library residing in the same machine as
>> Presentation layer. Eventually I plan to use WebServices if application>> needs physical seperation.
>> Most of Business Logic are implemented in this layer. There is
>> absolutely no UI code here.
>> These are all bunch of static methods which perform CRUD functionality.>> All methods are atomic in nature. I dont rely on Static Variables.
>> There is just one DatabaseGateway class which does all the
>> functionality.
>>
>> 3. Data Layer. (SQL Server)
>> I dont use stored procedures. predominantly use Views.
>>
>>
>> I have been reading up on Rockford Lhotka's business objects and I just>> feel that his framework is unnecessarily complex. I just dont see the
>> need to hold these intermediate Business Objects.
>>
>>
>>
>> Thanks for your responses.
>>
>> --
>> Jay Balapa
>> Director Of Software Engineering
>> www.atginc.com
>>
>>
>>
>>
>>
>
>



Nov 17 '05 #37
Josh wrote:
Your SQL should be in the Business Layer. The presentation layer
should not make or provide decisions on how data is collected ( that
what tables / view or columns are used ) as that is a business rule.


SQL belongs in the Data Access Layer, not in the Business Layer. Why
tie the business logic to any specific persistence mechanism?
Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 17 '05 #38
What? I would get your facts straight before advising people to simply
depend on C# for Stored Procedure coding. While it's entirely possible to
write stored procedures and other server-side executables in CLR languages
(including C# and VB.NET), it's not always (and not even usually) a good
idea to do so. CLR code execution should be reserved for a few specific
cases where CPU-intensive operations or those jobs that TSQL was never
designed to handle.
--
_______________ _______________ ______
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
www.sqlreportingservices.net
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
_______________ _______________ ____
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
With SQL Server 2005 you can write stored procedures etc. in c#.

Eliyahu

"Steve Walker" <st***@otolith. demon.co.uk> wrote in message
news:Iv******** ******@otolith. demon.co.uk...
In message <Xn************ **************@ 127.0.0.1>, Chad Z. Hower aka
Kudzu <cp**@hower.org > writes
>"bradley" <so*****@micros oft.com> wrote in
>news:#9******* *******@TK2MSFT NGP15.phx.gbl:
>> If you want to do away with the complexity of the business objects,
>> then consider moving this business logic to the database as stored
>> procedures and triggers.
>
>There are of course many schools of thought, but personally I would
>never recommend that. If
>you want my views as to why, you can read the link that I just posted.


Agree. For one thing, TSQL is a horrible language to do anything
non-trivial in.

--
Steve Walker


Nov 17 '05 #39
"Michael Rodriguez" <mi**@nospamfor me.com> wrote in
news:#Q******** ******@TK2MSFTN GP10.phx.gbl:
It's really a very fine line. If you have a system where hundreds of
users are crunching loads of data, which poison do you pick? Do you
do all the work in stored procedures (= database bottleneck), or do
you send everything back to the clients and distribute the processing
(= network bottleneck). We're still trying to figure it out...


It depends on your system, and every sysetm is unique. No pattern will fit every system. What I
presented works well in my experience in 90%+ of systems. But each developer needs to evualate
the pattern and see if it is a good match for their system.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Nov 17 '05 #40

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

Similar topics

2
3475
by: ggg | last post by:
I'm looking for a complete project/application done with heavy use of of object-oriented programming & design. Preferably something well documented and/or commented so that I can pick it apart and learn how/why they designed it they way they did. Any suggestions?
3
3802
by: Erik De Keyser | last post by:
Hi group, I have a couple of projects with up to 8 forms. On most projects I write the code on each form with no modules. The last project I use 1 module and minimal code on each form , in fact just the code for each visual object, and all the subroutines are placed in a module. What is the best practice where I can place my VB code, at each form or in a separate module ? Pro's & con's ? Performance benefit ?
55
3482
by: Cindy | last post by:
Hello!! I'm new at access and there's is an article by Arvin Meyer for beginners that is references in Google Groups but I can't seem to find the original post with the article's URL. Does anyone know where I can find that article, or why the thread appears to be missing from the archives? Here's the link: ...
45
2423
by: Brett | last post by:
If I do this without declaring a corresponding field, is it considered bad design? What are the advantages or disadvantages to either method? Notice there is not set. public string URL { get { return "www.somewhere.com/test.aspx"; }
4
1490
by: Bob | last post by:
I know this is a tall order, but I'm looking for a book that talks about the implications of alternative approaches to languages than we typically see, such as allowing multiple inheritance... detailed, but not so heavy that the interesting, qualitative conclusions are left to the reader to dig out of a set of equations. Any recommendations? Bob
4
1706
by: GS | last post by:
Hi, I'd rather start from a good design and go from there so would be greatfull for any input. I have a simple ASP.NET application and would like to make solution elegant. I store settings in web.config file and I would like to have class in my application which will hold application level objects. Some methods of the class will be executed in different threads and some properties are shared among threads and static in nature. So what...
1
1872
by: GS | last post by:
Any points of what would be the good error handling design for application? User error handling in Application_OnError and throw() new errors on conditions through the code? I'd like utlimiately to consolidate all error_handling in one method which I'll be able to easily modify to write to event log or text file etc instead of error hanlding scattered through the code. Thanks, GS
2
1787
by: dotnet dude | last post by:
What boook do you guys recommend for somebody with the software development backgroud who wants to get started from scratch with the designing of good sofware application. I am interested in understanding how the logical and physical design of a software is prepared. Details about the design patterns and the application blocks; and how and when they should be used. I would really appreciate if you guys can recommend some good boook that...
7
1626
by: TAVOSOFT | last post by:
Hi friends, I am begginer , I wanna to learn VB2005 ,Which are good book for to learn VB2005 of level -begginer-intermediate. Thanks you friends.
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9958
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.