Finally we come to the User Interface Layer, logically this can be the simplest part of your application with something like a web service that simply exposes a set of APIs calls to your business layer or by far the most complex part of your application with something like a multi-threaded winform.
The most important thing to remember is just like every other layer, the UI layer ONLY contains UI logic:
- Navigation: One of the most important and visible parts of your application, it doesn't matter how good your content is, if you can’t navigate through it. The basic rules are: Keep it simple, Intuitive, and Consistent if your customers have to think about how to navigate, there is a problem.
- Event Handling: The basic process of taking input from the customer and responding to it appropriately.
- Application State: Keeping track of where the user is and what they are doing can be very complex or fairly simple depending on the type application your working on.
- Displaying: This is basically everything the the user sees from controls to the application output and has the same basic rules as Navigation for the same reasons, if your application is hard to use, your users wont use it.
The most important thing to remember is to keep any logic that isn’t specific to the UI out of the UI, a good example is validation. If you put your validation in the UI you then have to maintain your validation logic in multiple places(asp.net application, WinForm, Web service, etc). and can lead to inconsistent validation between your applications, Save yourself the pain and put a validation in the biz layer. There are some small exceptions for web development when using client side validation, just remember to NEVER trust input from the client, this goes double for web clients, to quote Tony Rose “The Client is in the hands of The Enemy.” and should never be trusted, it’s too easy to have javascript errors that circumvent your validation.
No comments:
Post a Comment