 |
| ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 11th, 2005, 02:27 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
need guidelines for application design
Dear all,
I am designing a fairly big ASP.Net application. But, I have experience in doing only small web applications (like shopping cart, job recruitment site etc.) using ASP.Net
In these small applications, I was using the following design guidelines.
1) Determine the ASPX pages reqd. and define the functionalities.
2) Determine the entities involved (for e.g. category, product, cart, order, product reviews and customer for a shopping cart).
3) Define classes (persistent) for these entities.
4) The aspx pages act as the boundary classes. Determine the repeating portions between pages and make them into user controls (ascx). For. e.g. menu, login form, search box, customer details display portion, cart details list portion etc. etc. for the shopping cart.
5) The code behind files act as the control class. They create objects of persistent classes and implement the business logic.
6) It uses SQL server. I have defined necessary indices and using only stored procedures for all db operations.
But, after seeing the full codes and methodologies, one expert has commented that the design is not at all good. It will be very slow and this is not at all the concept of dotnet design. I am very much frustrated now.
I have learned that I can create assemblies out of the classes (one assembly per namespace). Some of the user controls, I can implement as server side controls. Will this make the difference ? Or, should I create composite server controls for all page elements ?
Is there anything fundamentally wrong with my understanding of dotnet technology ? (I am very much confused and frustrated after getting this comment !!!).
Thanks for your time.
Madhu Kampurath
|
|

April 13th, 2005, 09:43 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Without seeing what you have actually designed, it's hard to say if your design is good or bad or whether you understand .NET technology.
Your list of guidelines looks fine and proves to some extent that you grasp the basics of what you need to make a good application.
- Peter
|
|

April 14th, 2005, 11:18 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply. I will try to put my code in a site (but most of the asp.net hosting is costly).
I think, what is wrong is that I am not creating or using assemblies. Also, I am using only user controls. May be, I should create assemblies for the name spaces and then I should create some server side controls also. How much the performance is going to be enhanced with the introduction of these two ideas ?
I find that the shopping cart is only as fast as a similar shopping cart done in PHP. Also, it takes longtime when the pages are loaded for the first time. I know it is because of the delay in compiling it. But, is there anyway to avoid this ?
Thanks again,
Madhu
|
|

May 3rd, 2005, 05:23 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Your design is almost right, but if your problem is huge or changing exponentially then consider seperating the major three tiers in seperate assemblies, the db stored procedures are good. dont ever user the "Src" attribute in aspx pages use "Inherits" and i reffer the microsoft reference applications "IBuySpy" etc.
|
|

May 3rd, 2005, 06:53 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Mehmood Khan. I think, what you mean is this. Suppose, the application can be divided into specific modules like "Quotation mgmt", "timesheet preparation", discussion board" etc. etc, I can create seperate assemblies for each of these modules.
But, in VS 2003, I am not able to do it. I am defining seperate namespaces (one each for each module). But, when it is built (ctrl+shift+B), it is being compiled into one and only one dll (application_name.dll)
May I know how can I have an application with more than one developer created assemblies ?
|
|

May 3rd, 2005, 07:19 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
The "three tiers" mentioned above does not mean three modules to the application, but rather three *tiers* to the application.
All the modules of your application live inside the user interface (UI) tier (i.e. the web application project in VS2003). You should also have a business layer (BL) that lives as another .NET project (assembly). Then you have a data access layer (DAL or DL) that lives as yet another project/assembly. The UI talks to the BL and the BL talks to the DL. This way your UI code is only code needed to make the UI function. The code needed to make the application function is in the BL. This way, you could potentially have several user interfaces to your application (web forms, win forms, web service, etc) and you don't have to copy application logic from an existing user interface because that logic lives in the business tier.
- Peter
|
|

May 4th, 2005, 01:17 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you Peter for replying.
No, tiers are not the 3 modules I mentioned. I just mentioned 3 modules in my application.
Here is how I have done it. Take "quotation mgmt." module for example. This has got one aspx page (QuotationMgmt.aspx) which contains a web form for taking inputs from users. Associated with this aspx page, there is a class file (Quotation.cs) which contains methods to create a quotation, validate a quote item, add a quote item, remove a quote item, modify a quote item, calculate total amount, create quotation from template, add payment terms, export to excel etc. etc. Each of these methods interact with database through direct system.data.sqlclient class.
The code behind file (QuotationMgmt.cs) contain button click events which will
1) Create objects of appropriate class.
2) Call appropriate methods of objects to handle the save, clear, view activities as desired by the user.
3) Handle the exceptions raised by the Quotation.cs class
Similarly, there will be 3 files for time sheet mgmt. also (TimeSheetMgmt.aspx, TimeSheetMgmt.cs - the code behind file and TimeSheet.cs - the class file)
Now, I want to compile Quotation.cs into a dll (Quotation.dll) and TimeSheet.cs into another(TimeSheet.dll). However, it is creating only <ApplicationName>.dll.
Then I tried to put the aspx files, code behind files and class files for one module in a seperate folder (say Quotation, TimeSheet etc.). I have put one assemblyinfo.cs file in each folder and filled it with appropriate values. However, on compilation, it gives an error that "duplicate assembly file found". This is the problem I am facing.
Is there anything wrong with my approach ? Can this be called three tier development ?
Thanks you for all helps
Madhu
|
|

May 4th, 2005, 06:39 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Madhu,
Your approach is not what I'd call 'tiered'. The term 'tier' refers more to a chain of execution. The UI calls your Business logic which calls the data access layer. (The database itself is also concidered a tier: the data store.) Your approach is what I would call a 'modular design': different applications (or pieces of 1 application) that exist adjacent to each other. You can certainly have a modular multi-tier application because the two are not mutually exclusive.
You can't do what you are trying to do. Organizing the pages under folders does nothing more than organize them under folders. Every .cs file in your project will get compiled together as if they exist in the same folder. You could have two .cs files named the same thing in two different folders (with a few exceptions) and they will both compiled as long as their contents don't conflict (ex. each has a class named the same). As you have found, the assemblyinfo file can't be duplicated.
If you want to separate your modules into different assemblies, you'll need to either compile them manually or create different web projects for each module. Keep in mind however that when running the result of the latter you will run into problems because each web project will live in a different virtual directory and won't share session state (among other nightmares).
- Peter
|
|

May 4th, 2005, 11:32 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Peter.
Now, I understood that modularisation is different from tiering. I also got another article from net ( http://www.c-sharpcorner.com/Tutoria...3TierAppPA.asp). In a 3 tier application, there are 3 projects. One UI project, one BL project and one DAL project. In each of them I can have modularisation (organize pages in different folders). But, there will be only 3 dlls corresponding to each project / layer. I can even host these 3 projects in 3 different servers. Am I correct ?
I thank you very much for helping me in getting correct concepts.
|
|

May 5th, 2005, 01:01 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Madhu,
TO start learning the basics of three tired application, one of the simplest, smallest and fully working example of a logicaly three tired application is the Time tracker starter kit. You also can seperate the BLL & DAL to different assemblies easily.
You can download it from ASP.net( http://www.asp.net/StarterKits/Downl...ndex=0&tabid=1)
or find it in the asp.net resource kit CD if you have.
Its highlight is the excellent documentation, which also gets installed.
(See it at: http://www.asp.net/TimeTrackerStarterKit/Docs/Docs.htm)
Prashant
|
|
 |