SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Silverlight/WPF: возврат от паттерна MVVM к MVP Гладких Денис http://outcoldman.ru
История Первое упоминание паттерна MVC в Smalltalk’80 Задача: архитектурное решение, которое позволяло бы манипулировать графическими представлениями данных приложения таким образом, чтобы изменение Представления этих данных не влияло на бизнес-логику и данные (Модель) приложения, а так же, чтобы была возможность иметь несколько Представлений для одной Модели. 
Термины Model(модель данных) - бизнес логика вашего приложения; View(представление) – пользовательский интерфейс; Controller(контроллер) - содержит логику на изменение модели при определенных действиях пользователя;
Классический MVC Действия  пользователя View Передача  вызова Сообщение об изменениях Изменение модели Model Controller
Реализация UserEditView UserEditController Model (User,Repository) Пользователь  нажал Apply controller.UpdateUser( textBoxName.Text, … ) user.Name = name; repository.Save(user); Сообщить об изменении  (INotifyPropertyChanged)
Model – View – Presenter  Действия  пользователя Passive View Supervising Controller View Передача  вызова Обновление Изменение модели Presenter Model Сообщение об изменениях
Реализация IUserEditView UserEditView UserEditPresenter Model (User,Repository)
Реализация Model (User,Repository) UserEditView UserEditPresenter Пользователь  нажал Apply presenter.UpdateUser(); name = view.UserName; user.Name = name; repository.Save(user); view.UserName= user.Name;
INotifyPropertyChanged INotifyCollectionChanged DependencyObject Silverlight/WPF Binding МАГИЯ View Controller TextBox UserName Button Command
Model – View – Presenter  Действия  пользователя View Передача  вызова Обновление Изменение модели Presenter Model Сообщение об изменениях
Model – View – ViewModel Действия  пользователя View Передача  вызова Обновление Изменение модели ViewModel Model Сообщение об изменениях
Реализация Магия Model (User,Repository) UserEditView UserEditViewModel Пользователь  нажал Apply ExecuteSaveCommand() name = UserName; user.Name = name; repository.Save(user); TextBoxполучит актуальное  значение
View ViewModel Задачи (View / ViewModel) Установка значений в соответствующие контролы Связь/взаимодействие с моделью Валидация измененных / новых данных Создание данных (из Модели) для отображения Визуализация контролов
BindingModel View BindingModel   .       .       . Создание данных (из Модели) для отображения Валидация измененных / новых данных ViewModel         .     . Связь/взаимодействие с моделью Presenter
Demo (by Davy Brion)
Silverlight/WPF: возврат от паттерна MVVM к MVPГладких Денис (outcoldman) http://outcoldman.ru http://twitter.com/outcoldman outcoldman@gmail.com

Weitere ähnliche Inhalte

Empfohlen

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Empfohlen (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Add2010 - Silverlight/WPF: MVP&MVVM

  • 1. Silverlight/WPF: возврат от паттерна MVVM к MVP Гладких Денис http://outcoldman.ru
  • 2. История Первое упоминание паттерна MVC в Smalltalk’80 Задача: архитектурное решение, которое позволяло бы манипулировать графическими представлениями данных приложения таким образом, чтобы изменение Представления этих данных не влияло на бизнес-логику и данные (Модель) приложения, а так же, чтобы была возможность иметь несколько Представлений для одной Модели. 
  • 3. Термины Model(модель данных) - бизнес логика вашего приложения; View(представление) – пользовательский интерфейс; Controller(контроллер) - содержит логику на изменение модели при определенных действиях пользователя;
  • 4. Классический MVC Действия пользователя View Передача вызова Сообщение об изменениях Изменение модели Model Controller
  • 5. Реализация UserEditView UserEditController Model (User,Repository) Пользователь нажал Apply controller.UpdateUser( textBoxName.Text, … ) user.Name = name; repository.Save(user); Сообщить об изменении (INotifyPropertyChanged)
  • 6. Model – View – Presenter Действия пользователя Passive View Supervising Controller View Передача вызова Обновление Изменение модели Presenter Model Сообщение об изменениях
  • 7. Реализация IUserEditView UserEditView UserEditPresenter Model (User,Repository)
  • 8. Реализация Model (User,Repository) UserEditView UserEditPresenter Пользователь нажал Apply presenter.UpdateUser(); name = view.UserName; user.Name = name; repository.Save(user); view.UserName= user.Name;
  • 9. INotifyPropertyChanged INotifyCollectionChanged DependencyObject Silverlight/WPF Binding МАГИЯ View Controller TextBox UserName Button Command
  • 10. Model – View – Presenter Действия пользователя View Передача вызова Обновление Изменение модели Presenter Model Сообщение об изменениях
  • 11. Model – View – ViewModel Действия пользователя View Передача вызова Обновление Изменение модели ViewModel Model Сообщение об изменениях
  • 12. Реализация Магия Model (User,Repository) UserEditView UserEditViewModel Пользователь нажал Apply ExecuteSaveCommand() name = UserName; user.Name = name; repository.Save(user); TextBoxполучит актуальное значение
  • 13. View ViewModel Задачи (View / ViewModel) Установка значений в соответствующие контролы Связь/взаимодействие с моделью Валидация измененных / новых данных Создание данных (из Модели) для отображения Визуализация контролов
  • 14. BindingModel View BindingModel . . . Создание данных (из Модели) для отображения Валидация измененных / новых данных ViewModel . . Связь/взаимодействие с моделью Presenter
  • 15. Demo (by Davy Brion)
  • 16. Silverlight/WPF: возврат от паттерна MVVM к MVPГладких Денис (outcoldman) http://outcoldman.ru http://twitter.com/outcoldman outcoldman@gmail.com