At work I’ve come to realize that I don’t always produce code that just work. I make mistakes and often forget to test properly before I sign off a task. So I talked to our test lead and asked him to compile a list of the most common issues he finds when testing my work. I then printed out the list and hung it on the wall next to my desk as a checklist to go through whenever I think a task is done. 

He could actually only produce 7 common issues, but I put in three more that relates to code quality. Since I’m an ASP.NET front-end developer, the list focuses on UI issues seen through the lens of a tester. The list is not prioritized.

I hereby declare that all features, tasks and tweaks…

Works correctly in IE6, IE7 and Firefox

The test lead found that cross-browser issues surfaced from time to time. Most often it was really minor issues like positioning of elements or general IE6 quirks. The reason why this rule isn’t called “Works correctly across browsers” but instead focuses on IE and Firefox is simple. If you can get your page to work in IE6, IE7 and Firefox, then it almost always works in Safari and Opera as well. Second, those browsers cover about 98% of our visitors. Third, if it was called “Works correctly across browsers” it might be easier to ignore when going through the list.

Is XSS secure

Make sure that all input fields are handled correctly so no HTML or JavaScript entered by a user can mess up the page.

Long text doesn't break design

My limited brain tells me that a name is never longer than approx. 50 characters. I still believe it, but what happens if you put in a 300 character name? In many cases this would break the UI. Either limit the length of text a user can submit or tweak the design to take long text into account.

Localize everything

When I start working on a new feature for the website, I hard code all text because it might change during development. When the feature is approved by the product team then I localize the text. Since this is on the list, I sometimes forget to localize ALL the text. I will still do hard coding of text, but this checklist will help me remember to localize before signing off.

The enter-key works as expected

When using ASP.NET webforms, a form element is probably located at the master page so all pages resides inside that form. That often leads to strange behaviours of the enter-key. Remember to set default buttons either from code-behind or on the Panel webcontrol.

The code is reusable when possible

This is a general coding law and in ASP.NET the same rules apply. Separate elements in user- and server controls and make them small and specialized so they can be used elsewhere. Read more about reusable ASP.NET.

Unit tests written when possible

If you’re not using the ASP.NET MVC framework, unit testing your website is not easy. However, if you pull out as much of the code-behind logic into components that you can put in a library, then you can unit test. Instead of using .ashx files for HttpHandlers, put them in a separate library. Use server controls instead of user controls when you can.

The code is well commented

This goes without saying. Comment and document your code so other developers can easily pick up where you left.

Is peer verified before going into testing

Before a feature is signed off and sent to test, we do peer verification. Peer verification is when one of your colleagues performs sanity checking on your feature or just tries to break it. This let you find issues early on and make the life easier for the testers. When we are really busy, I often forget to ask for peer verification and that shows.

Is signed off by product owner

At work we have a product team that always have the ownership of a feature. We developers also have ownership of features, but that is from an implementation level. During a busy day when I do several different tasks, I sometimes forget to get the product owner to sign off my work. If it isn’t signed off, then you’re simply not done yet and I sometimes have to finish a task several days after I was “done”. This is annoying and makes it harder to meet deadlines. I must say that this is probably the single most important issue, but it is also the one that I almost never forget for that very reason.

Time will tell if this list will raise the quality of my work. I’m sure that as long as I don’t ignore the list, it will. Are any issues missing?

Comments

Dan Atkinson

There are a few things in here that are very useful for users to look upon. I'd be interested in how you localize at Zyb, given the variety of possibilities out there.

Dan Atkinson

Mads Kristensen

We localize using resx files in satellite assemblies. Pretty standard in ASP.NET

Mads Kristensen

Davy Brion

You can still unit test the logic in your webforms and usercontrols relatively easy if you want. Take a look at the following posts in case you're interested: http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/ http://davybrion.com/blog/2008/10/how-to-write-testable-aspnet-usercontrols/

Davy Brion

Wayne John

Yeah, lots of fun doing all this in a bubble too. I can squeeze most of those into an app, but of course, there are always shortfalls in forethought. It's part of the game right?

Wayne John

gOODiDEA

Interesting Finds: 2008.10.12 .NET ASP.NETMVCandthenewIIS7RewriteModule My10commonmistakesinASP.NET C#CodingS...

gOODiDEA

Uwe

Localization: When you use my cute litte free tool "Zeta Resource Editor" (http://www.codeproject.com/KB/aspnet/ZetaResourceEditor.aspx), you have it somehow a little bit easier to translate to more languages.

Uwe

Mads Kristensen

@Uwe, That app looks great. We can't use it at ZYB because we store our translations in a database that we then export to .resx for compilation. However, for BlogEngine.NET it would be perfect.

Mads Kristensen

arjansworld.com

Pingback from arjansworld.com Arjan`s World » LINKBLOG for October 12, 2008

arjansworld.com

Christian Persson

@Mads Store translations in database sounds nice. What is the main purpose in doing that? I feel at work that resx files is hard to keep up to date with different languages.

Christian Persson

blog.cwa.me.uk

Pingback from blog.cwa.me.uk Reflective Perspective - Chris Alcock » The Morning Brew #199

blog.cwa.me.uk

Tolisss

Unit testing for webforms can by achieved with Innova addIn for TypeMock. Just have a look very impressive!! --> typemock.com

Tolisss

Jitendra Singh

i would like to add some more points to this list: * Is it meet w3c standards!!! * Is there any unwanted code, just remove them!!! * Is log everything!!! * Is all style in style sheet!!! * Is cached proper things!!! may be few are also there. Thanks.......... www.newgenlives.com

Jitendra Singh

Speed Dating

I'm a web designer and SEO but not a programmer. And yet I read each one of your common asp.net mistakes very carefully and they all sound pretty important. The one that you called most important was the one that I least understand. But then again, it might be very important but simple too and maybe that's why I didn't get it? Good to see you are trying to improve your work flow. Hope the list helps you out.

Speed Dating

harsh

hi, this is harsh i like to read all these from you but want to know more about XML Membership Provider because i alredy read SQLServer,MSAccess,MYSQL ,etc ... thanks

harsh

Comments are closed