This document discusses different patterns for separating the view, model, and controller/presenter layers in a ZK application. It describes the MVP, MVC, and MVVM/MVB patterns and compares their approaches. It provides best practices for implementing each layer, such as avoiding business logic in the view and using databinding to sync the view and model. The document emphasizes that the view model pattern focuses on separating application state and behavior from the view using databinding annotations.
These slides were used to explain the concepts such as android's native
library, NDK and JNI using which demonstration of native library
debugging at runtime was presented in #NSConclave2023.
These slides were used to explain the concepts such as android's native
library, NDK and JNI using which demonstration of native library
debugging at runtime was presented in #NSConclave2023.
Android 기반의 게임 프로젝트를 오픈하면서 구축한 빌드 시스템을 간
략하게 소개합니다.
osx 기반에서 Jenkins를 이용하여 Unity3D와 Android Native
Code와 설정 방법에 대해 다루고 있습니다.
세부적인 코드보다는 전체적인 흐름에 초점을 맞췄으므로
참고용으로 보시기 바랍니다.
Maintaining the product is one (if not the most) expensive area of the overall product costs. Writing clean code can significantly lower these costs, making it more efficient during the initial development and results in more stable code. In this session participants will learn how to apply C# techniques in order to improve the efficiency, readability, testability and extensibility of code.
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and Inheritance , Exploring the Base Class Library -, Debugging and Error Handling , Data Types full knowledge about basic of .NET Framework
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Hexagonal architecture - message-oriented software design (PHP Barcelona 2015)Matthias Noback
Commands, events, queries - three types of messages that travel through your application. Some originate from the web, some from the command-line. Your application sends some of them to a database, or a message queue. What is the ideal infrastructure for an application to support this on-going stream of messages? What kind of architectural design fits best? This talk provides answers to these questions: we take the *hexagonal* approach to software architecture. We look at messages, how they cross boundaries and how you can make steady communication lines between your application and other systems, like web browsers, terminals, databases and message queues. You will learn how to separate the technical aspects of these connections from the core behavior of your application by implementing design patterns like the *command bus*, and design principles like *dependency inversion*.
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기Chris Ohk
기존에 작성해 놓은 C++ 코드에 모던 C++를 적용하기는 쉽지 않습니다. 막상 개선하려고 마음먹었다고 해도, 어디서부터 바꿔야 할 지 막막하기만 합니다. 이 세션에서는 기존 C++ 코드에서 모던 C++를 적용해 프로그램의 구조와 성능을 개선하는 방법에 대해서 설명합니다. 그리고 기존 C++ 코드에 모던 C++를 적용할 때 주의해야 될 점에 대해서도 살펴봅니다.
"손코딩뇌컴파일눈디버깅" 모임을 소개합니다.
백문이 불여일런, 트라이얼앤에러(Trial and Error) 식의 몹쓸 교육을 받아 온 개발자들이 코딩하기 전에 신중하고 꼼꼼하게 생각해보기란 쉽지 않습니다.
개발 시간 중 디버깅 시간이 절반 이상을 차지하고 있는 실정에 버그를 줄이기 위해 TDD니 유닛테스트니 많은 방법들이 개발되고 있지만 가장 일차적으로 중요한 것은 개발자들이 꼼꼼히 따져보는 것이 아니겠는지요?
미국의 선진 SW회사들은 이미 화이트보드에 PS문제를 푸는 것을 인터뷰 방식으로 채택하고 있습니다. 이는 이와 같은 풀이 방식이 개발자들의 기본 역량을 측정하기에 알맞은 지표라는 것이고, 개발자들이 기본적으로 갖춰야 할 역량이기도 하다는 것 입니다.
또한 자신의 생각을 명확하게 정리하고 다른 사람이 이해할 수 있도록 전달하는 Communication Skill 도 개발자가 갖춰야 할 역량 중 하나 입니다. 알고리즘을 어떻게 구현할 것인가를 팀원들과 소통하면서 자연스럽게 생각을 정리하고 전달하는 연습도 할 수 있습니다.
컴퓨터에 앉아 코딩하기 전 펜과 종이를 들고 눈과 머리와 손을 굴려 보시는 것은 어떠신지요??
You take a React course and you learn the fundamentals. You can build simple applications and know how things work. You start building your first larger project and questions pop up. How do I structure my project? Where do I put this component? How do I make it more reusable? What styling tool to use?
There are many resources that can teach you the little pieces. No one tells you how to put them together to build real applications.
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
This Edureka "Node.js tutorial" will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi-Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
9) Demo – Grocery List Web Application using Node.js
Android 기반의 게임 프로젝트를 오픈하면서 구축한 빌드 시스템을 간
략하게 소개합니다.
osx 기반에서 Jenkins를 이용하여 Unity3D와 Android Native
Code와 설정 방법에 대해 다루고 있습니다.
세부적인 코드보다는 전체적인 흐름에 초점을 맞췄으므로
참고용으로 보시기 바랍니다.
Maintaining the product is one (if not the most) expensive area of the overall product costs. Writing clean code can significantly lower these costs, making it more efficient during the initial development and results in more stable code. In this session participants will learn how to apply C# techniques in order to improve the efficiency, readability, testability and extensibility of code.
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and Inheritance , Exploring the Base Class Library -, Debugging and Error Handling , Data Types full knowledge about basic of .NET Framework
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Hexagonal architecture - message-oriented software design (PHP Barcelona 2015)Matthias Noback
Commands, events, queries - three types of messages that travel through your application. Some originate from the web, some from the command-line. Your application sends some of them to a database, or a message queue. What is the ideal infrastructure for an application to support this on-going stream of messages? What kind of architectural design fits best? This talk provides answers to these questions: we take the *hexagonal* approach to software architecture. We look at messages, how they cross boundaries and how you can make steady communication lines between your application and other systems, like web browsers, terminals, databases and message queues. You will learn how to separate the technical aspects of these connections from the core behavior of your application by implementing design patterns like the *command bus*, and design principles like *dependency inversion*.
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기Chris Ohk
기존에 작성해 놓은 C++ 코드에 모던 C++를 적용하기는 쉽지 않습니다. 막상 개선하려고 마음먹었다고 해도, 어디서부터 바꿔야 할 지 막막하기만 합니다. 이 세션에서는 기존 C++ 코드에서 모던 C++를 적용해 프로그램의 구조와 성능을 개선하는 방법에 대해서 설명합니다. 그리고 기존 C++ 코드에 모던 C++를 적용할 때 주의해야 될 점에 대해서도 살펴봅니다.
"손코딩뇌컴파일눈디버깅" 모임을 소개합니다.
백문이 불여일런, 트라이얼앤에러(Trial and Error) 식의 몹쓸 교육을 받아 온 개발자들이 코딩하기 전에 신중하고 꼼꼼하게 생각해보기란 쉽지 않습니다.
개발 시간 중 디버깅 시간이 절반 이상을 차지하고 있는 실정에 버그를 줄이기 위해 TDD니 유닛테스트니 많은 방법들이 개발되고 있지만 가장 일차적으로 중요한 것은 개발자들이 꼼꼼히 따져보는 것이 아니겠는지요?
미국의 선진 SW회사들은 이미 화이트보드에 PS문제를 푸는 것을 인터뷰 방식으로 채택하고 있습니다. 이는 이와 같은 풀이 방식이 개발자들의 기본 역량을 측정하기에 알맞은 지표라는 것이고, 개발자들이 기본적으로 갖춰야 할 역량이기도 하다는 것 입니다.
또한 자신의 생각을 명확하게 정리하고 다른 사람이 이해할 수 있도록 전달하는 Communication Skill 도 개발자가 갖춰야 할 역량 중 하나 입니다. 알고리즘을 어떻게 구현할 것인가를 팀원들과 소통하면서 자연스럽게 생각을 정리하고 전달하는 연습도 할 수 있습니다.
컴퓨터에 앉아 코딩하기 전 펜과 종이를 들고 눈과 머리와 손을 굴려 보시는 것은 어떠신지요??
You take a React course and you learn the fundamentals. You can build simple applications and know how things work. You start building your first larger project and questions pop up. How do I structure my project? Where do I put this component? How do I make it more reusable? What styling tool to use?
There are many resources that can teach you the little pieces. No one tells you how to put them together to build real applications.
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
This Edureka "Node.js tutorial" will help you to learn the Node.js fundamentals and how to create an application in Node.js. Node.js is an open-source, cross-platform JavaScript runtime environment for developing a diverse variety of server tools and applications. Below are the topics covered in this tutorial:
1) Client Server Architecture
2) Limitations of Multi-Threaded Model
3) What is Node.js?
4) Features of Node.js
5) Node.js Installation
6) Blocking Vs. Non – Blocking I/O
7) Creating Node.js Program
8) Node.js Modules
9) Demo – Grocery List Web Application using Node.js
Pattern de référence pour les applications WPF, Silverlight et Windows Phone, MVVM est de plus en plus utilisé. Cette session d’introduction vous permettra de découvrir les différents éléments qui le compose, leur mise en place et surtout de bien comprendre quand, comment et pourquoi utiliser ce pattern ne peut que vous être profitable !
An introduction to multi-tenancy in Java enterprise applications. It covers the steps needed to use Hibernate's support, integration with migration framework Liquibase and logging.
Presentation on the Model-View-ViewModel Design Pattern for Silverlight application. Presented by Jonas Follesø at the Norwegian Developer Conference 2009.
MV* presentation frameworks in Javascript: en garde, pret, allez!Roberto Messora
HTML5 is the playing area, the strip, Javascript presentation frameworks are the fences and they are fierce and proud. In this presentation we will attend an interesting match between two of the emerging contenders in the MV* family: KnockoutJS and BackboneJS. We'll try to understand how they solve the same issues in modern web software development to better decide which one is suitable in our scenario.
Code Camp 06 Model View Presenter Architecturebitburner93
This is the slide show I created for the first Twin Cities Code Camp in November of \'06 - I did this when I was working for Digineer and also used it in a Digi-U session that I put on for the other consultants.
Knockout is a JavaScript library that helps you to create responsive display(UI)
It is based on Model–view–viewmodel (MVVM) pattern
It provides a simple two-way data binding mechanism between your data model and UI
It was developed and is maintained as an open source project by Steve Sanderson, a Microsoft employee on July 5, 2010
Building Web Application Using Spring FrameworkEdureka!
Spring is the most popular open source Java application Framework. Most of the existing frameworks like Struts or Hibernate take care of one layer or a part of the application development.
As Struts take care of MVC model, Hibernate provides ease of working with databases. However, Spring Framework combines all the industry standard framework approaches (e.g. Struts and Hibernate) into one bundle.
Spring provides Dependency Injection, Aspect Oriented Programming and support for unit testing. This gives the developer time to work on main business logic rather than worrying about non-application code. Spring makes the application development fast and increases the productivity of developers.
MVC JavaScript libraries are the hot trendiness right now, and this gives a brief overview of all of the most popular, as well as what exactly is MVC, MVVM, MVP, what they do, and why, or if, we need them.
If you’re a mobile developer then you heard about MVVM design pattern and how Google supporting it recently in android after a long time not supporting any design pattern in this presentation we will discuss what difference in MVVM than other famous design patterns and why is preferable to use it in your work.
Similar to Design Patterns in ZK: Java MVVM as Model-View-Binder (20)
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
2. Introduction
First version of this presentation was given to the
2010 UK ZK Users Group
The "ZK ToDo 2" patterns sample code is in the
zkforge project svn repository github.com
Sample code has the same screen implimented
three times; as MVP, MVC and MVVM (MVB)
Published articles document the MVP and MVC
versions. Article coming soon about MVVM...
See references at the end
4. Why Patterns? Evolving Software
A business sponsor talks about the screens but
requires a flexible business solution
Screens are likely to change all the way through
to go-live and well beyond
Features evolve slowly over time whilst the
screens can change drastically
Can you easily reskin / re-layout / rearrange your
app to freshen your user experience?
Making flexible and adaptable solutions is more
rewarding than making brittle apps
5. Why Patterns? A Challenge!
Reuse a "buy now" feature of your website in an
iphone app (as XML over HTTP)
This requires separation of View from Model
6. Programming In The View
Business state stored in
view
<label id=”hiddenBookId” value=”${book.id}” visible=”false”/>
<button label=”Buy Book”>
View knows 'who' and
<attribute name=”onClick”><![CDATA[
'how'
MyDao myDao = … ; // get daoand render mixed
Update via jndi
myDao.buyBook(user.id, hiddenBookId.value);
statusLabel.value = ”Thanks! Buy another book?”;
]]></attribute>
</button>
<label id=”statusLabel” value=””/>
7. Avoid Coding In The View
"Separated Presentation” is a core pattern
Presentation is incidental to what the customer is
logically doing which is the Use Case / User
Story (e.g. "customer buys book")
The presentation changes fast and often so
separate it out from the business logic
Junit testing of the presentation is tricky
Business logic within the View stunts the
flexibility of your software design
9. Micro vs. Macro
Much of the literature about MVC describes the
fine grained "micro-MVC" used to implement
graphical components such as Swing/JSF
When reading articles it helps to think "Is this
micro-MVC or macro-MVC?"
This century we tend to pick a winning UI
component framework (ZK!) and focus on
"macro-MVC" for complex business screens
This presentation talks about the macro world
unless explicitly stated
11. View Best Practices
"ZK Desktop == View" so mixing Java business
logic into ZK code is mixing business logic into
the View
View components should not become business
components:
BuyNowButton extends Button // avoid!
The View should observe the Model using the
databinder (more on this later):
org.zkoss.zkplus.databind.AnnotateDataBinder
12. View Has Micro Models
A BindingModel is an "push through" to update
the View. Writing to it updates the bound View
These micro models are not business domain
models which organise application features
ListModelList is binding model class for Listbox
listModelList = (ListModelList)listbox.getModel();
AnnotateDataBinder uses such micro-models as
part of its logic to sync data into the View
Intbox and Datebox have "value" property as
micro-Model as well as "visible" and "disabled"
15. Model Best Practices
The Business Domain Model should have no
compile time dependencies to the presentation
framework
EL and AnnotateDataBinder should load data
from the Model into the View (avoid coding)
Ideally the Model should be a rich Domain Model
have both behaviour as well as state
Beware designs of proceedural code loading and
saving DTOs as this is weak OO
Try test driven development of encapsulated
layers ("POJOs In Action" book)
17. Alphabet Soup
MVC: Model-View-Controller
Often cited but do we really know it as well as we
believe?
MVP: Model-View-Presenter
A specialism of MVC with a dominant controller
MVVM: Model-View-ViewModel
The Microsoft WPF pattern of the Application Model
but how do we use it with ZK?
MVB: Model-View-Binder
A clearer moniker for "MVVM" with ZK
18. MVC Has Many Interpretations
Martin Fowler:
Different people reading about MVC in different
places take different ideas from it and describe
these as 'MVC'.
Anon on c2.com:
Stuff nearest the User becomes the View, stuff
nearest the database becomes the Model, stuff in
between becomes the Controller. Marketects then
refer to their project's architecture as "MVC",
borrowing that acronym's impressive lineage(!!!)
20. The Controller Revisited
Typically org.zkoss.zk.ui.util.Composer but what
are it's responsibilities?
Does Controller read/write the Model? Yes
Does Controller read/write the View? Perhaps
Does View read/write the Model? Possibly
Is separation of behaviour (Controller) from state
(Model) the only game in town? No
Is databinding with AnnotateDataBinder part
View, part Controller, or a separate thing?
21. Model-View-ZKComposer
org.zkoss.zk.ui.util.Composer usually used as the
3rd part of the pattern
Whether it is a Controller or a Presenter depends
on the interactions with View and Model:
Presenter – pushes to Passive View
Controller – updates a model observed by the View
("Supervising Controller")
Any mix or match of the above will be called
MVC. People say "traditional MVC" to mean
View observes the Model updated by Controller
23. Model-View-Presenter
The View is the fully owned by the Presenter
ZkToDoControllerV1 implements Composer
Pushes all updates into the Passive View
ZkToDoControllerV1 implements ListitemRender
Presenter reacts to View Event notifications and
updates the Model
ZkToDo2 app example zktodo2_a.zul
For code write-up google "Massey Small Talks/2008/
November/ZK "
25. Enter The Binder
View observes the state of the Model using
databinding
<?init class=”org.zkoss.....AnnotateDataBinderInit”?>
Uses EL annotations within the ZUL page
<textbox value=”@{person.firstname}”/>
The @{pojo.property} annotations automatically
reads/write your POJOs (no UI event handling
code required as ZK Binder does the work
automatically!)
Google "site:dzone.com mvc zk massey"
26. Controller Best Practices
Aim to have the Controller and View not
communicate with one another. Let the binder
to the work
Have the binder pull the data from the Model with
load hints rather than having the composer
push data into the view model
<textbox value=”@{person.firstname,
load-after='buyButton.onClick'}”/>
zktodo2_b.zul example should have used
more 'load-after' hints and less Java code (see
weather-station-mvvm.zul)
27. Model-View-ViewModel
ViewModel (Microsoft) is similar to an
ApplicationModel (Smalltalk)
Binder syncs application state into the View
Binder maps View Events onto application
methods (ICommand types in .Net C#)
Gather both state and behaviour into one
application model (stronger OO design)
Binder is part of the View world. The application
model is its model: so called it a "ViewModel"
28. ViewModel Nirvāna
Josh Smith (msdn.microsoft.com):
"ViewModel classes are easy to unit test … Views and
unit tests are just two different types of ViewModel
consumers"
"ViewModel classes can assist in properly designing
user interfaces that are easy to skin"
"It is easy to just rip one view out and drop in a new view
to render a ViewModel"
It's all about the Binder. The name Model-View-
Binder (MVB) highlights the key part
29. Model-View-Binder (Simplified)
Legend
View compiles to
updates
Binder loads
<<reflection>>
Application Model
(has internal layers)
31. Model-View-ZKBind
Components are bound to ViewModel by the
Binder:
<listcell label="@load(reminder.name)"/>
UI Events are dispatched to ViewModel methods
by the Binder:
<button label="Save" onClick="@command('save')"/
>
ViewModel has annotations to inform Binder of
any properties changed under the covers
@NotifyChange({"reminders","selectedReminder"})
public void save() { … }
32. MVB/MVVM Best Practices
View Model has no references to View Objects
only @Command and @NotifyChange annotations
Create ViewModel classes which are "naked
screens" onto which you overlay a zul skin
ViewModel is the Mediator of the Binder to the
Model; it orchestrates the services
Use Dependency Injection of service interfaces
into the View Mode
ViewModel uses application services to get
detached entites which it exposes to the Binder
33. Summary
Presentation patterns are all about modelling the
features of our application independently of the
frequently changing screens
MVC, MVP, MVVM all have in common a
separated view
Modelling of the Model will lead to internal layers
Labels such as "ViewModel" or "DataModel" or
"ApplicationModel" are suggestions as to what
is trying to be organised where
34. Summary (Cont 1)
"B" is for Binder which plays a big part in MVC
and major part of MVVM patterns. There is no
"B" required for MVP
The Microsoft Binder is powerful and a core part
of their framework. They invented MVVM as the
best practice to organise a screen Model to
leverage their Binder
MVB is a moniker that names the new power in
modern Separated View patterns: long live the
Binder!
35. Summary (Cont 2)
ZK has a mature AnnotateDataBinder for rendering
POJO data values and state (visible/disabled) into ZK
AJAX RIA Desktop Components
The binding information is embedded into the Page
(View) as "XML annotations"
Add ZKToDo2 CommandBinder to fire application
methods on the ViewModel
ViewModel has no compile time dependencies on ZK
framework; can heavily junit with mock services
Using MVVM / MVB pattern is simply about getting the
most out of the framework Binder
36. Summary (Cont 3)
ZkToDo patterns demo code implements the
same screen in each of MVP (zktodo_a.zul),
MVC (zktodo_b.zul) and MVVM (zktodo_e.zul)
37. References
MVC article Desktop MVC Patterns ZK, Spring & JPA
Original MVP article
SmallTalks 2008 Best MVC Patterns
Book on how to build a layered domain model with
Spring POJOs In Action
ZK MVC Screen for POJOs In Action book code
Test Driving ZK FoodToGo
Book on designing ”domain objects first” for supple code
Evans Domain Driven Design
Martin Fowler GUI Patterns pages UI Architectures
Josh Smith's inspirational Microsoft .Net MVVM Article
38. Corrections
March 2012: Slide 13 had totally miss attributed Fowler where I
was using the term "Presentation Model" to mean something
totally different. Edited to call my concept "BindingModel"
March 212: Slide 21 had miss labelled Passive View as
Supervising Controller