473,775 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! How many layers in my app?

There's an architect at my 200 person company that advocates having
many layers in all my C# apps. He wants web services, use case
handlers, facade layers, data gateways, etc.

When I ask why all this complexity is necessary, he gives me what if
scenarios: "What if you ever want to access the business logic with
another front end?", for example.

These are typical "intranet apps"...one or more screens selecting and
updating rows in a database, maybe doing some processing. My approach
is a single .Net project with asp.net or fat client front end, c#
class files for the middle tier, and stored procedures for the db
layer.

Who's right here? Am I just "old school", as he puts it? What are the
best practices?

Thanks,

Burt

Apr 16 '07 #1
5 2376
Burt,

While I advocate architects and what they do, you have to consider the
scale of an app, and the possible future use of the app versus the
investment in time and money to do things properly. You can easily get to
the point of diminishing returns.

For what you seem to be doing, it would seem like the single-project
approach would be fine. However, I can appreciate the architect's point of
view. For example, if this is common functionality in your intranet apps,
why not at least layer out some of the business functionality into classes
in DLL's? That way, you can do mash-ups later in time and revise the UI (or
even create a new one, you aren't linked to ASP.NET or Windows Forms now,
because you have abstracted out the business functionality) whenever you
wish.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Burt" <bu*******@yaho o.comwrote in message
news:11******** **************@ d57g2000hsg.goo glegroups.com.. .
There's an architect at my 200 person company that advocates having
many layers in all my C# apps. He wants web services, use case
handlers, facade layers, data gateways, etc.

When I ask why all this complexity is necessary, he gives me what if
scenarios: "What if you ever want to access the business logic with
another front end?", for example.

These are typical "intranet apps"...one or more screens selecting and
updating rows in a database, maybe doing some processing. My approach
is a single .Net project with asp.net or fat client front end, c#
class files for the middle tier, and stored procedures for the db
layer.

Who's right here? Am I just "old school", as he puts it? What are the
best practices?

Thanks,

Burt

Apr 16 '07 #2
On Mon, 16 Apr 2007 16:01:03 -0700, Burt <bu*******@yaho o.comwrote:
[...]
Who's right here? Am I just "old school", as he puts it? What are the
best practices?
It would be impossible for anyone here to answer that question without a
LOT more detail about your current architecture.

That said, while I agree that one should be careful to not over-complicate
the design by adding way too many layers of abstraction, it is true that
abstraction is generally a *good* thing. Even if you never wind up
reusing the components elsewhere (and the potential for doing so is a good
argument in favor), by compartmentaliz ing things at least to some degree
it helps ensure against hard-to-maintain code dependencies and
side-effects.

It's also been my experience that the effort to create suitable
abstractions and separate various code functionalities assists in the
overall thinking about the design. By figuring out where different
components actually need to interface, it also helps in figuring out just
what's important within the design and what doesn't really need to be
implemented.

Anyway, that's just a short story. The fact is that there are indeed lots
of advantages to "layering" the design, as you put it. I can't tell you
whether your architect wants you to layer too much or not...he and you
will have to work that out yourselves. But it's not unreasonable to
expect *some* kind of modularization in your design.

For what it's worth, I've got applications that compiled are under 100K,
and yet which still use multiple projects.

Pete
Apr 17 '07 #3
Burt wrote:
There's an architect at my 200 person company that advocates having
many layers in all my C# apps. He wants web services, use case
handlers, facade layers, data gateways, etc.

When I ask why all this complexity is necessary, he gives me what if
scenarios: "What if you ever want to access the business logic with
another front end?", for example.

These are typical "intranet apps"...one or more screens selecting and
updating rows in a database, maybe doing some processing. My approach
is a single .Net project with asp.net or fat client front end, c#
class files for the middle tier, and stored procedures for the db
layer.

Who's right here? Am I just "old school", as he puts it? What are the
best practices?
I would start by choosing terminology carefully. The definitions
I prefer is:

tier = something physical separated so that it can but does
need to run on different boxes

layer = something logical separated but still has to run on
the same box

So you have either a 3 tier web app:
browser
web app on IIS/ASP.NET
database server
or a 2 tier fat client app:
fat client app on client PC
database server

Both you web app and fat client app is often divided
in 3 layers:
presentation layer
business logic layer
data access layer

For the web app:
presentation layer = .aspx with tags + .aspx.cs with code behind
business logic layer = .cs with true business logic
data access layer = .cs with some database interface a la DAAB

But note that those 3 layers are only a common used way of dividing
and other are possible.

I actually prefer to consider the same code as 4 layers:
presentation layer = .aspx with tags
control layer = .aspx.cs with code behind
business logic layer = .cs with true business logic
data access layer = .cs with some database interface a la DAAB

And if it is purely CRUD stuff with no real business logic, then
you can do it as 2 layers:
presentation layer = .aspx with tags + .aspx.cs with code behind
data access layer = .cs with some database interface a la DAAB

So:
- you will by definition be using 3 tiers for your web app
- you should definitely use well defined layers to get good
code structure
- but it can be discussed whether to use 2, 3, 4 or 5 layers
- I would expect the architect to be paid to make the decision
on how many layers and which - not the developer

And a couple of loose ends.

The fact client app can be 3 layers:
presentation layer = .cs with win forms code
business logic layer = .cs with true business logic
data access layer = .cs with some database interface a la DAAB
or 2 layer:
presentation layer = .cs with win forms code
data access layer = .cs with some database interface a la DAAB

The database tier can be just 1 layer:
tables
or 2 layers:
stored procedures
tables

Arne
Apr 17 '07 #4
Arne and others,

Thanks for much for the comments. I'm familiar with the layers or
tiers you describe (presentation, business logic, db). The ones my
architect is pushing are above and beyond those though. Examples:

-Can't have business logic in the web app. The .Net GUI must
communicate with a web service on another machine. Reason: "None of
our web servers have business logic. This way we can offload the
processing".

-Web service interface should not have any logic. Need to split it
into interface and logic apps. Reason: Can upgrade the business logic
without touching the facade layer.

-Tiers shouldn't call each other directly but through messaging.
Example: you can't call a DTS package directly. Must create an MSMQ
app for this. (Reason given: "Everything must be loosely coupled").

-Apps should preferably involve a BizTalk application which can route
messages (Boy do we have some high paid BizTalk contractors at my
company).

Seems to me that these are all nice buzzwords and sound great in
theory. The reality is though, that my company only handles 20
customer transactions per day. And all of our apps do different
things- one processes loan applications, one moves data to the GL, one
handles expense reimbursements. ..there isn't much code to share btw
apps.

But it's hard to know where to draw the line at simplicity? Error
handling, using version control, and logging could be eliminated too
to keep it simple, my architect might argue.

Burt

Apr 18 '07 #5
Burt wrote:
-Can't have business logic in the web app. The .Net GUI must
communicate with a web service on another machine. Reason: "None of
our web servers have business logic. This way we can offload the
processing".
Bad advice in most cases - exception is if the business logic for
some reason is nor horizontal scalable.
-Web service interface should not have any logic. Need to split it
into interface and logic apps. Reason: Can upgrade the business logic
without touching the facade layer.
Good advice.
-Tiers shouldn't call each other directly but through messaging.
Example: you can't call a DTS package directly. Must create an MSMQ
app for this. (Reason given: "Everything must be loosely coupled").
Can be good or bad advice depending on the specific requirements.
-Apps should preferably involve a BizTalk application which can route
messages (Boy do we have some high paid BizTalk contractors at my
company).
Can be good or bad advice depending on the specific requirements.
Seems to me that these are all nice buzzwords and sound great in
theory. The reality is though, that my company only handles 20
customer transactions per day.
In that case I think the most important buzzword is KISS !!!!

Arne
Apr 19 '07 #6

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

Similar topics

102
5717
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler can't tell where a bracket is missing.... a few weeks have past, I requested a feature for the delphi ide/editor "automatic identation of code in begin/end statements etc" and today when I woke up I suddenly released a very simple solution for this...
27
2121
by: SK | last post by:
Hi I am trying to teach myself how to program in C. I am a physician hoping to be able to help restructure my office. Anyhow, I amhoping that the porblem I am having is simple to those much more experienced in programming. I am trying to use the concept of arrays to calculate the hours of my backoffice staff, however I am getting a ridiculous amount of error lines. If any one has time to help me that would be great. I am using the...
2
405
by: Neil | last post by:
Hello I would appreciate if someone could help me with this query. I have an access database and am using ASP/VB. I have a table called 'booking' which contains the following fields: bookID (autonumber) startdate (date) room (text)
2
2634
by: sun919 | last post by:
hi there... i ve a little question asking concerning saving data into database Basically, I have stored procedure name InsertquestionnaireList and the argument for this is both correct ... I have a function which run this stored procedure.. All of these are illustrated below, i dont know what i did wrong cause it should in theory work fine sine i didnt have sp_name as the store procedure name please help many thanks
5
1376
by: AAJ | last post by:
Hi all FIRST THE BORING BITS....... I normally use a Database layer, a Business layer and a GUI layer. The GUI uses an Object data source to bind to the Business layer which in turn binds to the database layer. Every thing is great. I can read data, change data in the grid, update the database, and when the GUI reloads, all the changes are all present and correct. i.e. the data seems to be persisted
23
2855
by: Gunnerman6875 | last post by:
Hi everyone, Well I'm a newbie to Access and your site so forgive me if my terminology is a little out. I'm currently trying to create what i thought would be a simple database for work. I'm in the British RAF and I'm currently in charge of the training cell at our Training Depot. Heres my problem, one of the tasks within my job role is to manage 3000+ training publications. These are signed out to instructors in various numbers, however i...
1
4347
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
How many layers are in .net application development? I have seen the following layers mentioned in various resources: Presentation Layer Workflow Layer Business Layer Data Access Layer Data Layer Are there any good articles/webcasts to explain each layer? Is any of them
0
9622
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
9454
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
10268
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10107
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7464
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
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
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
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.