concept UI in category silverlight

appears as: UI, UI, The UI
Silverlight 4 in Action: Silverlight 4, MVVM, and WCF RIA Services

This is an excerpt from Manning's book Silverlight 4 in Action: Silverlight 4, MVVM, and WCF RIA Services.

Before the sibling inventions of WPF and Silverlight, individual programming languages and platforms had a variety of ways of specifying the user interface (UI). Most of them touted the concept of separating the UI from the implementation code. In some cases, such as on the web with HTML and CSS, the representation of the UI was theoretically separated from its underlying implementation but not truly so until tried and true patterns, such as Model-View-Controller (MVC), were applied. In others, such as Windows Forms, the separation was due only to hidden autogenerated, uneditable files that contained the language-specific code necessary to create the UI.

If you’re familiar with the Model View Controller (MVC) pattern, you’ll find similarities. But the MVVM pattern is optimized more for modern UI models whereas the UI markup is completely separated from the logic, using messages and binding to pass information back and forth, assuming the UI and ViewModel can both be stateful.

Figure 16.5. In the usual code-behind approach, a fair bit of logic is tightly coupled to the UI and to other layers. Services in this case mean both web services and logical services (utility functions, reusable business logic, and so on).

Structured method invocation isn’t the only way to separate the UI from the rest of the system. Some slightly more insidious couplings have made it through right under our noses; we’ll need to address them. The first is the use of entities coming from your database model. You can do this if you really want, but for a number of reasons to be explained, I don’t like to. The second coupling is through the use of concrete types referenced from your various classes. In section 16.4.4, we’ll take a conceptual look at what’s involved in reducing this coupling.