Why is it bad to have lots of logic in the UI layer?
A common question isn’t it? I am sure that most of us are tired of answering this question time and again. What really happens is that when you have lots of logic in the UI layer; the code in the UI layer of an application becomes very difficult to test without either running the application manually or maintaining ugly UI runner scripts that automate the execution of UI components. While this is a big problem in itself, an even bigger problem is the reams of code that are duplicated between common views in an application. It can often be hard to see good candidates for refactoring when the logic to perform a specific business function is copied among different pieces in the UI layer. Reusability and Maintainability are the two major factors which force us to use a specific design pattern while developing an application.