CMM,
Altough we completely agree about what you write about encapulation and
mixing this up with Tiers. Is in my opinion your calculation not
correcte and the way you tell that a real physical Tier needed as well
not.
To communicate with the middle tier on that seperate computer, you have
to communicate as well with that middle tier. However now it has to do
it twice, one time on your so called 1Gb line and the same as before on
your 100Mb line in your sample. The clientcomputer (which is not a
terminal) need the same amount of information and has the same amount of
updates.
Therefore there is only an extra piece of datacommunication introduced.
The transport of data on your 1Gb line.
For me the multitier is right in the Terminal application situation (not
windowsclient emulating). In the windowsform situation I see no
advantages, while this Terminal situated 3 tier is already done by a
classic ASP or ASPNET application where the browser functions in a way
as a Terminal and the application as a middle tier.
By the way probably before 1996 multi tier were more common because it
is a very good practise on a real Terminal based computer as Unix and
other Mainframes.
Just my thought,
Cor
"CMM" <
[email protected]> schreef in bericht
Don't listen to that other poster. I'll give you a really simple
example on why programmers in the last five years have lost their
minds.... and have forgotten all the lessons a lot of us learned in the
90's.
What developers call "tiers" nowadays, I call simple
"encapsulation".... NOT TIERS. Somewhere a mass hypnosis has taken root
across the development world concerning this.
Here's an example:
1) Supposse your DAL is on the client machine like the other user
recommends (making it a 2-tiered App). You have a dataset where you've
changed 10 rows. Calling Update on a DataAdapter with this dataset will
result in your update stored proc (or update sql) being called 10
times! That's 10 network round trips.... across a busy 100-megabit
network!
2) Even more likely you've changed one record in one table and 1 record
in 3 other related child tables (Employe--EmployeAddresses--etc.).
That's 4 round trips. Your app is now a VERY CHATTY application. A
network's nightmare.
3) In a true N-Tier structure (a 3-tiered App where the DAL is an
another machine) there's only ONE round trip with your DAL.
4) Now, your DAL and DB servers are connected via 1-gigabit(!)
connection....(this is common)...and connected to each other via a
dedicated switch (so their conversations don't swamp the network the
way your old 2-tiered rinky dink app did).
5) ...Or even better are on the SAME server. The round trips don't
matter AT ALL.
6) Now imagine that your client app needs to run on a simple VPN with
an office overseas. Your old 2-tiered rinky dink app is TOTALLY
UNUSABLE and not much better than your employees using an Access MDB on
shared workgroup server a la Windows 3.1.
Developers think that because they put their data access in a separate
files that they're code warriors and doing something special. In fact,
they're not doing much at all except achieving nice encapsulation
(always a good practice!). They're creating simple 2-tiered apps that
people were coding in 1996 and suffering later for it.
P.S.
ADO.NET 2.0 with SQL Server 2005 introduces "batch updating" which
addresses some of these concerns. But there are HUGE caveats with batch
updating that render it almost useless (like returning Id's from
INSERTS, etc) and almost always require a "rescan" of the affected
tables... rendering moot any performance gains gotten by using batch
updating. Again, TRUE N-TIER development is the answer here.
P.P.S.
You use remoted objects quite easily.... (and building your own
barebones remoting host is super-duper easy... but, if you need object
pooling and stuff like that you'll need to run them in IIS or Windows
Server Component Services).
Dim o As IContactsService =
Activator.GetObject(GetType(IContactsService), serverUri)
where IContactsService is an Interface in a lightweight DLL that exists
on the server and client. Optionally you can put the server components
directly on the client.
Check out these links
-http://
www.thinktecture.com/Resources/RemotingFAQ/default.html
-http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp
Ok, I've never done n-Tier development and I'm getting confused...
Assuming I have a business layer and a data access layer that may be
running on different machines, how does my business layer know where
my data access layer is running? What is it I have to do in the
business layer that "creates" the data access layer on the other
server?
Second, what do I pass between my business layer and my data access
layer? Should I be returning a dataset from the data access layer to
the business layer and letting the business layer convert it in to
business objects, or should my data access layer return business
objects?
For example, assume my business layer deals with "Client" objects.
Should my business layer ask my data access layer to return it a
"client" object, leaving the data access layer to determine what that
involves, or does my business layer ask the data access layer for some
information from tables and then the business layer builds the client
object from the returned dataset(s). If so, who builds the SQL, which
I thought would be a DAL function.
As you can probably tell, I could do with a simple (but practical)
tutorial on n-Tier development... anyone know of a good one as it
relates to DESKTOP based applications. Unfortunately, this app I'm
working on is not a web based app.
Thanks
Steve