Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the...
Transcript of Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the...
![Page 1: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/1.jpg)
1
Chien-Tsun ChenDepartment of Computer Science and Information EngineeringNational Taipei University of Technology, Taipei 106, Taiwan
[email protected]. 25 2004
Organizing Presentation Logic
![Page 2: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/2.jpg)
2
This talk introduces some common issues of developing GUI applications and provides an example to give the MVP pattern a try
Why presentation design is harder than design of other layers?
A SWT/JFace application is developed to show the power of the MVP pattern
![Page 3: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/3.jpg)
3
ReferencesMartin Fowler, Organizing Presentation Logic, 2004, http://www.martinfowler.com/eaaDev/OrganizingPresentations.html.Todd Sundsted, MVC meets Swing, Javaworld, 1998.Mike Potel, MVP: Model-View-Presenter. The TaligentProgramming Model for C++ and Java, 1996.Michael Feathers, The Humble Dialog, 2002.Jason Cai et. al., HMVC: The Layered Pattern for Developing strong client tiers, Javaworld, 2000.W. Greg Phillips and T.C. Nicholas Graham, Software Architectures for Multiuser Interactive Systems
![Page 4: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/4.jpg)
4
Common issues of developing GUI applications
![Page 5: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/5.jpg)
5
We use Album to discuss the issues of organizing basic behaviors within a single window
The initial state of Album application
Check Classic button enable the Composer
![Page 6: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/6.jpg)
6
Other Other PackagesPackages
The global picture: An application can be divided into three (coarse-grained) layers
Presentation Presentation Layer Layer
Domain Domain Layer Layer
Data Source Data Source LayerLayer Transaction Transaction
Management Management
MessagingMessagingSystemSystem
DatabaseDatabase
Application External Systems
Users
session state record statescreen state
![Page 7: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/7.jpg)
7
There are several ways to split up the logic of the presentation, such as MVC & PAC
MVC & HMVC
PAC
PAC & PAC Hierarchy
![Page 8: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/8.jpg)
8
However, the well-known MVC approach doesn’t work well with most GUI frameworks
separating the model from the view/controller
separating view from controller was not popular in rich client GUI framework
Most GUI framework are designed so that the UI controls both display and receive the user input events
![Page 9: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/9.jpg)
9
Let’s look at a Swing JButton example: each widget is a “UI component”
Swing UI Component
AbstractButton
setUI()
JComponent
setModel()
AbstractButton
![Page 10: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/10.jpg)
10
AbstractButton declares most of the Button’s behaviors and variables related to UI painting
Not all UI states are defined in the model
![Page 11: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/11.jpg)
11
ButtonModel and ComponentUI
AbstractButton
JComponent
![Page 12: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/12.jpg)
12
Data is copied between layers and applications have to coordinate and synchronize the data between layers
Domain Layer(session state)
Presentation Layer(screen state)
External Systems(record state)DatabaseDatabase
![Page 13: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/13.jpg)
13
Frequency and granularity are major design issues when synchronizing between layers
Key synchronization
Field synchronization
Screen synchronization
Coarse-grained synchronization: changes the entire UI whenever anything is changed
Fine-grained synchronization: changes the fields that really need updating
![Page 14: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/14.jpg)
14
The concept of active screen is used to denote that the screen state is not synchronized to the session state
Sequential active screen
Single active screen
Multiple active screens
1
2
3
![Page 15: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/15.jpg)
15
In “direct synchronization”, parent and child communicate directly to synchronize their changes
direct synchronization
child session state parentchange
save
save
*changed
load
![Page 16: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/16.jpg)
16
In “mediated synchronization”, child communicates with mediator (a shared state) and separately the parent synchronizes itself with the mediator
child session state parent
change
save
*changed
load
mediated synchronization
![Page 17: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/17.jpg)
17
Organizing presentation by MVP
![Page 18: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/18.jpg)
18
Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events
viewpresenter
titleFieldChanged
titleBar.text = “Album:” + titleField.text
change title filed
view
1
23
sequence diagram
presenter
![Page 19: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/19.jpg)
19
The first (simple) implementation of MVP: presenter and view are strongly coupled
view
selectedChangedEvent
m_view.m_txtTitle.setText()
select Album list
presenter
m_view.m_lstAlbum.getSelectedIndex()m_albums.getTitle()
![Page 20: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/20.jpg)
20
The second implementation of MVP: presenter and view are loosely coupled
view
selectedChangedEvent
IAlbumView.setTitle()
select Album list
presenter
IAlbumView.getSelectedIndex()m_albums.getTitle()
![Page 21: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/21.jpg)
21
Before implementing, we review the “interface”of the view
getAlbums
setAlbums
getArtist setArtist
getTitle
setTitle
getClassical
setClassical
getComposer setComposer
setEnableApplyAndCancel
setSelectedAlbumIndex
getSelectedAlbumIndex
getWindowTitlesetWindowTitle
![Page 22: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/22.jpg)
22
We apply test first programming in the second implementation to find the interface of view
Test the initial state of view
![Page 23: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/23.jpg)
23
To run the test, we have to create AlbumPresenter and MockAlbumView
![Page 24: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/24.jpg)
24
Now we can run the test but it failed. We should write some code in the MockAlbumView
![Page 25: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/25.jpg)
25
The getAlbums() and setAlbums() is implemented to pass the test
before
after
![Page 26: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/26.jpg)
26
The test passed. We can continue to write more tests
![Page 27: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/27.jpg)
27
When Eclipse finds a undefined method, it can create the method for you
![Page 28: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/28.jpg)
28
We run the test and it falls again, of course. A lot of works need to do…
![Page 29: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/29.jpg)
29
Finally, I finished the tests, MockAlbumView, and Presenter
MockAlbumViewMockAlbumView
PresenterPresenter
TestsTests
![Page 30: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/30.jpg)
30
Next step, creating interface IAlbumView
![Page 31: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/31.jpg)
31
I extract an interface from MockAlbumView by using “Extract Interface”
![Page 32: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/32.jpg)
32
Implement AlbumViewImp by copying code from AlbumView of the first example
copy & modify
![Page 33: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/33.jpg)
33
I write a test for AlbumViewImp by coping the test for MockAlbumView with little modification
copy & modify
![Page 34: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/34.jpg)
34
The VM arguments must be set to run the test of AlbumViewImp, which is a SWT/JFace program
![Page 35: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/35.jpg)
35
As you expected, the test fail
![Page 36: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/36.jpg)
36
Why the test fail?
When initial,composer should be disabled
Find a bug of Presenter
![Page 37: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/37.jpg)
37
The test still fail !
![Page 38: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/38.jpg)
38
Why the test still fail?
Apply & Cancel should be disabled
The Presenter does not set up the initial value of the view.Why the tests for MockAlbumView do not find this bug?
![Page 39: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/39.jpg)
39
I fixed the bug, but another bug occurs in the test method: testListSelectedShouldCauseUpdate()
![Page 40: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/40.jpg)
40
The bug is caused by AlbumViewImp
The problem is that the org.eclipse.swt.widgets.List does not fire event when we call the setSelection(int) method
Add this statement
![Page 41: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/41.jpg)
41
All done. The test pass
![Page 42: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/42.jpg)
42
Conclusion
Question?
Organizing your application so that it is easy to implement as well as testing
MVP not only separates the behavior of a presentation from the view but also supports presentation behavior testing without the view
![Page 43: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/43.jpg)
43
MoclAlbumView (1/2)
![Page 44: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/44.jpg)
44
MoclAlbumView (2/2)
![Page 45: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/45.jpg)
45
Presenter
![Page 46: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/46.jpg)
46
AlbumPresenterTest is used to test Presenter with MockAlbumView
![Page 47: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/47.jpg)
47
Test Initial state of view (screen state)
![Page 48: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/48.jpg)
48
List selected should cause update
![Page 49: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/49.jpg)
49
Check the classical box should enable composer field
![Page 50: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/50.jpg)
50
The most complex test case. Step 1
Domain layer Domain layer ((session statesession state))
==
F F
FF
0Bug
When initial, the screen state == session state
State 0
![Page 51: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/51.jpg)
51
Test code of Step 1: screen state == session state
![Page 52: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/52.jpg)
52
Step 2: screen state != session state
F F
FF
0
T T
TT
0
State 0
State 1Domain layer Domain layer
((session statesession state))!=
Domain layer Domain layer ((session statesession state))
==
![Page 53: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/53.jpg)
53
Test code of Step 2: screen state != session state
![Page 54: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/54.jpg)
54
Step 3: At state 3, screen state should equal to session state but I forget to check at state 2
T T
TT
0
F F
TT
3
State 1
State 3
State 2
Domain layer Domain layer ((session statesession state))
??
![Page 55: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/55.jpg)
55
Test code of Step 3: screen state is checked but it is not checked with session state
![Page 56: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/56.jpg)
56
Step 4: Go be to item 0 and make sure the view state == session state
F F
TT
3
State 3
Domain layer Domain layer ((session statesession state))
==
State 4F F
TT
0
F F
FF
0
State 0
![Page 57: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/57.jpg)
57
Test code of Step 4: screen state == session state
![Page 58: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/58.jpg)
58
Extract Interface from MockAlbumView (1/6)
![Page 59: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/59.jpg)
59
Extract Interface from MockAlbumView (2/6)
![Page 60: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/60.jpg)
60
Extract Interface from MockAlbumView (3/6)
![Page 61: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/61.jpg)
61
Extract Interface from MockAlbumView (4/6)
![Page 62: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/62.jpg)
62
Extract Interface from MockAlbumView (5/6)
![Page 63: Organizing Presentation Logicctchen/pdf/OPL.pdf · Model View Presenter (MVP) separates the behavior of a presentation from the view while allowing the view to receive user events](https://reader036.fdocuments.in/reader036/viewer/2022070916/5fb65163bba6c052e14de741/html5/thumbnails/63.jpg)
63
Extract Interface from MockAlbumView (6/6)