Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'll be starting my first web development job in a few weeks. Most of the code I'll be working on will be ASP.NET 2.0/3.5 Web Forms. What bad habits does this platform lend itself to and how should I avoid succumbing to them?

share|improve this question
As phrased this question is just inviting a list of answers. See the What kind of questions should I not ask here? section of the FAQ. – ChrisF Apr 23 '12 at 21:45
It lends itself to creating Web Forms. – CodesInChaos Apr 24 '12 at 21:19

closed as not constructive by ChrisF Apr 23 '12 at 21:44

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

2 Answers

up vote 0 down vote accepted

Classic (non-MVC) ASP.NET tends to abstract some of the aspects of the web. For example, through its controls which copy the controls as used in Windows Forms, ASP.NET tends to forget that web is based on stateless requests, which is radically different from what happens in Windows Forms where a control remains the same during the lifetime of the form, and every event does not reset the whole form as it is a case with ASP.NET.

ASP.NET also tend to oversimplify some things over the quality of code. For example, SQL queries embedded directly in ASPX templates is, well, horribly wrong in most cases.

You can avoid to take the bad habits by:

  • Learning (or continuing to use) ASP.NET MVC,
  • Learning other languages and frameworks.
  • Creating and enforcing your own quality guidelines (for example no SQL queries in the templates), or inspire yourself by the guidelines of your colleagues.
share|improve this answer

Since you'll be working on an existing project, focus on learning as much as you can from the existing code. And don't forget about your co-developers! They can teach you a lot. Once you feel comfortable navigating the project, look for ways to improve the existing code base. Here are some suggestions.

  • Keep your code-behind as thin as possible. Move reusable business-logic out of the code-behind.
  • Use the MVP pattern if possible.
  • Do not write in-line SQL. Take the time to learn how to write Stored Procedures.
  • Make sure your comfortable with javascript, css, html.
  • Eventually move past the webforms page state and learn how the web really works. Try building a simple web app without a framework using php or ruby.

You can write a well designed n-tier architecture or you can put all your logic in the code-behind rendering the application a maintenance nightmare.

Good luck!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.