Every year, thousands of software development projects are developed. In most of these applications (especially line-of-business applications) you will see a lot of the same UI patterns:
- When the value in one dropdown changes, the list in another dropdown needs to change
- Two list boxes with arrow buttons that allow you move items between the lists
- A grid with add/edit/delete buttons that allow you to manipulate the list
Most applications have other common characteristics, like:
- The concept of a User that has to log in, reset their password, and change their password
- Some concept of security roles
- Loading objects from a database by ID
Every project also has housekeeping tasks, like:
- Setting up automated builds
- Copying files to a QA site after a build
- Coming up with a way to create a development copy of the database
The problem is that on every project, it seems that way too much time is spent getting this stuff to work. Why??
These are solved problems. We’ve all solved them before. But we end up re-implementing the same stuff over and over.
This is a problem. Making an AJAX call to update the list in a child dropdown when the parent dropdown changes is not rocket science. I don’t want to write this code ever again. I want to write stuff like this:
State: <%= this.Select(model => model.State)
.Options(Model.StateOptions, opt => opt.Id, opt => opt.StateCode)
.UpdateOptionsFor(model => model.County)
.WithAjaxCallTo(“/state/GetCountiesInState”) %>
County: <%= this.Select(model => model.County) %>
(I’m using the MvcContrib HTML Helpers here.)
You write the code to implement this fluent interface once, and you don’t ever have to write it again. That’s the way that it should be. Every time you do something, you should be trying to find a better way to do it so that you can do it better next time.
A lot of people have already done lots of work for you, and you should take advantage of it. I’m talking about things like this:
- Using the built-in ASP.NET Membership stuff instead of rolling your own code to do Forms Authentication
- Using Rails scaffolding to create your website
- Using styling and controls from jQuery UI
- Using convention-based MVC frameworks (e.g. Rails or ASP.NET MVC + MVCContrib)
- Using the auto-mapping capabilities of Fluent NHibernate instead of writing mapping files or CRUD stored procedures
- Use S#arp Architecture as the framework for your application
Every developer should have a toolbox of code that he/she can draw from so that you can avoid being a plumber and spend your time doing valuable things, like writing business logic, designing user interfaces, and other things that you are being paid to do.