johnnyg24

class libraries

4 posts in this topic

I have been remodeling our website from classic ASP to vb.net over the past few months and being new to the .net world I was wondering if someone could tell me the benefits of creating a class library to hold all of my classes. I currently have a class library for not only common classes but also for classes that are specific to a single web page. Historically I prefer to keep all resources (ex: .css and .js files) about a page within the folder where the page resides. So if I have a root>sales>index.vbhtml then I like to keep any page specific .css and .js inside the root>sales folder. I would prefer to keep any classes specific about that page inside the root>sales folder as well. Is this bad practice and should I continue to put all classes inside my class library?

 

Thank you,

Share this post


Link to post
Share on other sites

It's typical to think of an entire website as a single application, so all of the resources go in one place. It sounds like you're thinking of each page as a single application. It would be easier to update if pages shared common resources instead of duplicating things that you use on more than one page. Also, if your entire site has a single CSS and Javascript file, then the user only has to download that file once and then the browser will use the cached version, instead of needing to download separate files for each page.

Share this post


Link to post
Share on other sites

The .css and .js files that I place within each folder are unique to that page and only that page. Common files are all stored in one place. I opt not to include page specific .css and .js in my common files because they are not needed on every page and some users will never need them or visit the page where they are applicable. I was thinking of apply the same concept to any class files that are specific to a page. Keeping all non-common files in their own folder structure helps me locate and update resources. I know it doesn't matter where I keep .css and .js files but I'm unsure of if that applies to my class files as well. I guess another way to ask my question would be will storing class files in separate folders have any negative performance issues and could I be creating a nightmare for the next coder that comes along to work on my website?

Share this post


Link to post
Share on other sites

That shouldn't cause any performance problems, but I can't say if your structure would make it difficult for someone in the future to perform maintenance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now