Wrox Programmer Forums
|
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
 
Old October 14th, 2005, 10:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Class Library

What is the difference...or benefit...of using a project of type "Class Library"...I currently have all my classes in a Web App project (and thats all thats in there)...should I change this?

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
 
Old October 14th, 2005, 11:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Using class libraries makes it much easier to reuse the code you are doing; that is, if you design your solution properly.

E.g. you might want to put the database layer in a class library with some common functionality, which you can use in some other project. If the code is integrated in the entire solution, it is much harder to extract it later. I have made an RSS class library, which I can use in every thing I do to write RSS feeds, and therefore I do not have to rewrite the trivial methods each time.

IMO well-written code is also well-designed, which IMO means modularized code.

Jacob.
 
Old October 17th, 2005, 07:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

thanks jacob!

I can see the benefits of the database layer, but I don't fully understand how you're suggesting I reuse it. My classes are nearly all database related, but my databases are different design for different projects. How would I design the data access layer so I can reuse it? Are there specific, possibly more generic components or methods I should use?

-------------------------
Beware of programmers with screwdrivers...
 
Old October 17th, 2005, 07:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, you can see the class libraries as the stuff that you think would be nice to have in general beside the classes etc. provided my the framework. So it is really a matter of abstraction.

Class libraries are to be designed generic so for the database example there should not be any information about a specific database, table etc. Perhaps you would like a method to extract a column from a specific table. The signature might look as follows...
Code:
public somedatatype ExtractColumn(string connectionstring, string table, string column)
... and somedatatype is the format in which you in general would like to get you extract. This is a simple example but keep in mind that the methods have to be generic to be reuseable.

Jacob.





Similar Threads
Thread Thread Starter Forum Replies Last Post
use of class library Theone84 C# 1 July 26th, 2008 02:19 AM
How to use a class library vs2005? badboy700 Visual Studio 2005 2 December 10th, 2007 09:38 PM
Using a class library Kiran Patil VS.NET 2002/2003 0 August 19th, 2006 05:52 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.