Building
N-Tier Applications in .NET
Host: Gurneet Singh – Microsoft MVP | Sr. Software Engineer,
HeroSoft
August
16, 2002
KunalS_MS: Hello All. I welcome Gurneet Singh and thank him for taking
out time to host today's expert chat session
Gurneet: Thanks Kunal
KunalS_MS: Gurnnet iswith HeroSoft and a Microsoft Most Valuable Professional
KunalS_MS: His focus areas are developing enterprise applications
on the .NET platform
KunalS_MS: Now over to you Gurneet
Gurneet: Thanks Kunal
Moderator: (Kumar) Gurneet, what according to you, would be the components
of an ideal enterprise wide, scalable, application?
Gurneet: I shall start with the idea of as to why we
should develope applications using .NET
Gurneet: and specially the n-tier architecture
Gurneet: Ok Kumar
Gurneet: The idea components will be user friendly interface,business
logic embedded in the classes and the data access components using
Ado.NET/XML to access the DB through the Managed providers.
Gurneet: Thought he number of layers might differ on
the basis of the application requirements
Moderator: (Kumar) I was looking for something more specifc. Like
should presentation tier comprise of WebService or ASP.NET? Or maybe
both?
Moderator: (Kumar) What kind of components should be in the middle
tier? ServiceComponents or traditional COM+ components?
Gurneet: Ideally speaking for the real time application
developed for a specific client will involve ASP.NET rather than a
Web Service
Gurneet: But if the requirement is such as of a product
or an industry vertical than might consider using a Web Service
Gurneet: If you already have invested a lot in developing
COM+ components it makes sense to use them in the middle layer
Gurneet: but with time, think of migrating towards .NET
Serviced components
Moderator: (Kumar) Should OleDb using ADO.NET will be a better option
or, using ADO?
Gurneet: The pace of migrating towards .NET Serviced
components depends on the requirements and the amount of scalability
you want to build in the component
Gurneet: If you use ADo from the managed code the processing
time will be more as the runtime callable wrapper is created and marshalling
and unmarshalling will be done in every call
Gurneet: Kumar its the difference of using ADO and ADo.NET
we are not talking of OLEDB as it remains the same for both
Moderator: (Kumar) Well, from I gather, while ADO is based on OLEDB,
ADO.NET supports both OleDb and managed native providers. To design
a database access layer that's generic as far as the underlying database
is concerned. How do you compare using ADO, to OleDB in ADO.NET. In
this comparison, don't you think we are at the same level.. that of
OleDb?
Gurneet: To design a database access layer that's generic
as far as the underlying database is concerned then we have to use
OLEDB using ADO.NET and in this case we cannot use Native provider
API's that's applicable to SQL Server only from ADO.NET
Gurneet: If you want to use OLEDB through ADO and ADO.NET
the performance will be different because one is managed and other
is unmanaged by the CLR. But if you want to directly call OLEDB layer
than it depends on the language in which the ole layer is written
Moderator: Rohit: What is the difference between an N-Tier .NET Application
and the old 3-Tier DNA Applications?
Gurneet: 3-Tier application is a type of n-tier application
Gurneet: n-tier application may have 3 or more layers
i hope i got the question correct
Moderator: (Kumar) How do the two approaches - ADO/ADO.NET, one from
the unmanaged world, and the other from the managed world, compare
in terms of efficiency and scalability?
Gurneet: In ADO.NET you open connections only long enough
to perform a database operation, such as a Select or Update. You can
read rows into a dataset and then work with them without staying connected
to the data source. In ADO the recordset can provide disconnected
scenario, but ADO is designed primarily for connected access
Gurneet: Transmitting a large ADO recordset or a large
ADO.NET dataset can consume network resources; as the amount of data
grows, the stress placed on the network also rises. Both ADO and ADO.NET
let you minimize which data is transmitted. But ADO.NET offers anot
Gurneet: But aDo.NET offers another performance advantage,
in that ADO.NET does not require data-type conversions. ADO, which
requires COM marshalling to transmit records sets among components,
does require that ADO data types be converted to COM data type
Moderator: (Rohit) What are your views on remoting vs. web services?
Which is more recommended in an enterprise environment?
Gurneet: Consider using Remoting when you want to use
it in an Intranet application or within the organization whereas your
WebService would make sense if you are providing a solution for a
particular industry vertical or a product
Gurneet: say component that can be used by anyone on
the net to solve his/her business problems
Moderator: (Kumar) But don't you think that remoting is more flexible
than WebServices?
Gurneet: It depends on the scenario of your application
Gurneet: if i find a better answer i will get back to
you on this
Moderator: (Sriram) Which is a better remoting channel: TCP, HTTP,
or SMTP?
Gurneet: HTTP as it is most generic
Gurneet: I was going through this paper that Kunal shared
in the news forum today
Moderator: (Kumar) but SMTP is equally generic, and offers a modely
very close to that of message queuing. Please suggest
Gurneet: ASP.NET is always faster (by a magnitude) with
SOAP - according to various sources this is due to the fact that ASP.NET
W/S use document encoding whereas Remoting uses the more complex RPC
encoding.
Moderator: (Rohit) What are the key reasons an enterprise should shift
existing DNA applications to .NET?
Gurneet: There are many reasons for that Rohit
Gurneet: a few that i can quote are the value, performance,
reliability, manageability, mobility
Gurneet: and so on...
Gurneet: just to explain the meaning of the first ,By
value I mean .NET framework helps reduce the costs through improved
management and increases productivity through improved reliability
and ease of use
Gurneet: The .NET Framework was designed from the ground
up to be an Internet computing environment. Its deep support for Web
services using SOAP gives interoperability with non-Windows environments
Moderator: (sriram) What was the real need for building application
more than 4 tiers? Do these layers and wrappers shake the reliability
and make it more difficult to manage?
Gurneet: A simple answer to this will be to improve scalability
and reliability of your system
Moderator: (Kumar) Can you please be more specific as to how having
an applications business logic, spread across more than a single tier,
can make it more scalable and reliable?
Gurneet: The very advantage that an n-tier application
gives is the reusability and with .NET as it brings the end to the
DLL hell maintaining multiple versions is much more easier
Gurneet: Also as you are aware of the GAC it automatically
keeps track of your objects and their lifetime
Gurneet: Partitioning of activities can help ease the
load that you place on high cost resources
Gurneet: Transactions provide another opportunity for
partitioning of activities. By separating methods that do not require
transactions from those that do, you do not needlessly impose the
overhead required for a transaction on methods that do not require
one
Moderator: (Manish) Assuming that an application's presentation tier
is Win32 UI, middle tier is comprised of .NET DLL and is single tier,
and finally data tier is present. Under what circumstances do I need
to expand my middle tier for better performance?
Gurneet: I think I answered that in my above example
Moderator: (Rohit) What would you suggest to an enterprise - migrating
existing DNA application to .NET shows same performance or is it better
to build them ground up?
Gurneet: AS I said earlier that if you have invested
a lot in your COM components it will still make sense to use them
but yes if you are looking at benefits of using a complete .NET application
they really are many
Gurneet: Managed code makes application more robust Utilizes
unified framework libraries across languages Inherent support for
ADO.NET and web services
Moderator: (Kumar) If an application is requiring its business objects
to share state but not maintain it, you think deployment of a transactional
and a non-transactional component, across separate physical servers,
for scalability, is a good option?
Gurneet: In that case for transaction and non transaction
a different structure all together can be taken/used
KunalS_MS: I am sorry to be a spoilt-sport, but we shall have to wrap
is exciting session here today
KunalS_MS: Gurneet, thank you for taking time out and joining us
Gurneet: Kumar I will be happy to take this scalability
issue in detail with you separately
Gurneet: Thanks a lot Kunal
KunalS_MS: Above all, thank you all for joining us into this chat
session.
KunalS_MS: Thank you once again and warm regard. GoodBye