Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

MVC MVVM MVP

.pdf
Скачиваний:
7
Добавлен:
17.02.2016
Размер:
164.43 Кб
Скачать

MVVM

Web application

User interaction

ViewModel

View

Model

Fig.3. Model-View-ViewModel pattern.

KBTU, Almaty

MVVM

MVVM is just a technology implementation of the MVP pattern designed specifically to play nicely with the data binding features.

MVVM is built into Microsoft .NET technologies like WPF(Windows Presentation Foundation) and Silverlight.

Choice between MVC, MVP, or MVVM depends on the context of the problem, the development environment, as well as personal preferences.

KBTU, Almaty

Controller pattern

The purpose of an Application Controller is to handle the flow of an application, deciding which screens should appear in which order. It may

appear as part of the presentation layer, or you can think of it as a separate layer that mediates between the presentation and domain layers. Application Controllers may be written to be independent of any particular presentation, in which case they can be reused between presentations. This works well if you have different presentations with the same basic flow and navigation, although often it's best to give different presentations a different flow.

Not all systems need an Application Controller. They're useful if your system has a lot of logic about the order of screens and the navigation between them.

KBTU, Almaty

Controller pattern

The purpose of an Application Controller is to handle the flow of an application, deciding which screens should appear in which order. It may

appear as part of the presentation layer, or you can think of it as a separate layer that mediates between the presentation and domain layers. Application Controllers may be written to be independent of any particular presentation, in which case they can be reused between presentations. This works well if you have different presentations with the same basic flow and navigation, although often it's best to give different presentations a different flow.

Not all systems need an Application Controller. They're useful if your system has a lot of logic about the order of screens and the navigation between them.

KBTU, Almaty

Controller pattern

Fig.4.Application Controller - a centralized point for handling screen navigation and the flow of an application.

KBTU, Almaty

Controller pattern

An Application Controller has two main responsibilities: deciding which domain logic to run and deciding the view with which display the response.

It typically holds two structured collections of class references, one for domain commands to execute against in the domain layer and one of views.

Fig.5. Two collections of references to classes.

KBTU, Almaty

Controller pattern

For both the domain commands and the view, the application controller needs a way to store something it can invoke. A Command pattern is a good

choice to do it. An application can have multiple Application Controllers to handle each of its different parts.

When to Use It

If the flow and navigation of your application are simple enough so that anyone can visit any screen in any order, there's little value in a Application Controller. The strength of an Application Controller comes from definite rules about the order in which pages should be visited and different views depending on the state of objects.

KBTU, Almaty

Key points

The presentation layer contains the components that implement and display the user interface and manage user interaction.

The presentation layer may have a server-side and client-side components. The benefit from MVVM/MVP/MVC is the separation of concerns between presentation and business logic, between the code and markup.

An Application Controller has two main responsibilities: deciding which domain logic to run and deciding the view

QA

KBTU, Almaty

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]