views:

82

answers:

5

Months ago, I was put in charge of a web application, from scratch. I had never programmed in vb.NET and was only familiar with Classic ASP. That being the case, I put together a very workable site and yet feel as if I didn't do much better than a beginner.

What is the correct or best format for designing a .net website.

Master Pages? When to use javascript? Code Behind javascript or slap it on the .aspx page.

etc, etc.

+3  A: 

I would suggest downloading sample web applications like NerdDinner and MVC Music Store...

http://nerddinner.codeplex.com/

http://mvcmusicstore.codeplex.com/

See how they structured their examples and where they put different logic...

Domain Driven Design and MVC is something I've been using a-lot as-of-late...

Alexander
+1  A: 

It's hard to say what the "best" way is because it depends on your specific application. There are many ways to organize and design a .NET web application. The most important aspect is that it works. If you are under a tight deadline, getting it to work is critical even if it's not the most elegant solution.

If you're concerned with optimizing the design or refactoring, then again it will depend on the scale and scope of the project. Don't optimize for the sake of optimizing, but try to make things clear and concise in a way that will make future modifications less painful.

NebuSoft
Right. Thank you.
crackedcornjimmy
A: 

There is no one right way. There are multiple best practices, some of which may be more or less applicable for your situation.

There are also lots of really bad ways to do. In between there are some so-so approaches that may be good enough.

Jason
Nice! You have covered all the bases. I appreciate your answer.
crackedcornjimmy
+1  A: 

I can relate to your situation almost exactly (except in C#).

It's a very subjective question as to what is best because it all depends on your exact setup, circumstances, and requirements. I'm still fairly new to the deciding what's best for a project but based on my experiences I can let you know what I did.

We went with an N-Tier set up, so we could keep the UI, Logic, and Data separate. This let's us maintain the code easier with the additional separation of concerns.

We went with Masterpages (with WebForms) so we could work on a consistent look and feel for the application. You can further modify things with themes, plus your standard CSS and Javascript. You want to control the layout easily and not force yourself to copy / update code on every page.

When it comes Javascript, it's usually better to not use it directly on the aspx page itself (unless it's very small) as you will benefit from caching in the browser, plus you can also minify the file to allow for quicker/easier downloads. I personally recommend going with jQuery for a framework since it is easy to work with, has a huge community, and is well documented.

Those are of course, just a few things I've done. Whether it's of help to you or not depends on your circumstances. I still have a long way to go and I personally try to read as many blogs on topics I'm curious about, watch training videos when possible, or simply ask targeted questions here (if you can't already find the answers). There is a ton of good information out there and a lot of sample applications that can help you learn new patterns and design methods. In the end, there is no absolute "correct" or "best" way. :)

Delebrin
Thanks! I appreciate the empathy and the conclusion.
crackedcornjimmy
Glad I could help a little. I've also been looking into other design patterns aside from WebForms (such as MVC, which I am really liking so far). Unfortunately when I took on this project, WebForms was most familiar to me since it was what I was taught in school. There are just a limitless number of approaches to take in the end though. Each with pros and cons.
Delebrin
+2  A: 

The main problem here is that you can choose between two approaches: ASP.NET WebForms and ASP.NET MVC. Unless you choose one the question doesn't make sense because good design is different for each of them.

Ladislav Mrnka
Looks like I need to study what MVC is.
crackedcornjimmy
Ah, right. We're using this design in our Flex Applications.
crackedcornjimmy