Home > Patterns & Practices > Why is it bad to have lots of logic in the UI layer?

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.

Advertisements
Categories: Patterns & Practices
  1. Narendra
    Wednesday, August 23, 2006 at 12:00 am

    Yes you are absolutely right.

    Writing all the logic in UI reduces Code reusability and increases comlexity in maintaining and modifying the code.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: