composite ui application block - brad wilson · july 24, 2005 portland code camp 1.0 dependency...
TRANSCRIPT
![Page 1: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/1.jpg)
July 24, 2005 Portland Code Camp 1.0
Composite UI
Application Block
Brad Wilson
Microsoft patterns & practices
http://msdn.microsoft.com/practices/
http://bradwilson.typepad.com/
![Page 2: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/2.jpg)
July 24, 2005 Portland Code Camp 1.0
What is a Composite
Smart Client?
![Page 3: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/3.jpg)
July 24, 2005 Portland Code Camp 1.0
![Page 4: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/4.jpg)
July 24, 2005 Portland Code Camp 1.0
Technology
![Page 5: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/5.jpg)
July 24, 2005 Portland Code Camp 1.0
Dependency Injection
The "old way":
Components have
intimate knowledge
of services
public class Component
{
private Service svc = new Service();
}
Component
Service
![Page 6: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/6.jpg)
July 24, 2005 Portland Code Camp 1.0
Dependency Injection
In the right direction:
Component uses
services by interfaces
and factories
public class Component
{
private IService svc = ServiceFactory.GetService();
}
Component
Service
IService
![Page 7: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/7.jpg)
July 24, 2005 Portland Code Camp 1.0
Dependency Injection
The "CAB way":
Dependencies are
injected at runtime
instead of compile time
public class Component
{
[ServiceDependency]
private IService svc;
}Container
Component
Service
IService
![Page 8: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/8.jpg)
July 24, 2005 Portland Code Camp 1.0
Demo
Dependency Injection
![Page 9: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/9.jpg)
July 24, 2005 Portland Code Camp 1.0
Event Broker
The "old way":
Events are wired up
at compile time
public class Sender {
public event EventHandler evt;
}
public class Listener {
mySender.evt += new EventHandler(myHandler);
}
Listener
Sender
![Page 10: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/10.jpg)
July 24, 2005 Portland Code Camp 1.0
Event Broker
The "CAB way":
Events are wired up
at runtime
public class Sender {
[EventPublication("topic://Sender/event1")]
public event EventHandler evt;
}
public class Listener {
[EventSubscription("topic://Sender/event1")]
private void MyHandler(object sender, EventArgs e)
}
Container
Listener Sender
![Page 11: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/11.jpg)
July 24, 2005 Portland Code Camp 1.0
Event Broker
Multiple subscribers
Sender
Listener 2
Listener 1
![Page 12: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/12.jpg)
July 24, 2005 Portland Code Camp 1.0
Event Broker
Multiple publishers
Against multiple subscribers, too
Sender 1
Sender 2
Listener 1
topic://sender/event
topic://sender/event
Listener 2
![Page 13: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/13.jpg)
July 24, 2005 Portland Code Camp 1.0
Demo
Event Broker
![Page 14: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/14.jpg)
July 24, 2005 Portland Code Camp 1.0
Command Dispatching
De-couples UI elements from command
handlers
Architecture similar to Event Broker
![Page 15: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/15.jpg)
July 24, 2005 Portland Code Camp 1.0
Demo
Command Dispatching
![Page 16: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/16.jpg)
July 24, 2005 Portland Code Camp 1.0
Modules
Isolated, reusable functionality
Loosely coupled teams
Role-based modules
Application
Shell
Module
Module
Module
![Page 17: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/17.jpg)
July 24, 2005 Portland Code Camp 1.0
Demo
Modules
![Page 18: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/18.jpg)
July 24, 2005 Portland Code Camp 1.0
CAB Application ArchitectureApplication Host
Shell
Module A
Services
Monitors
WorkItem A
Services Monitors
Controller A
View A
Controller B
View B
State
Module B
WorkItem C
Services Monitors State
Controller A
View A
Controller B
View B
![Page 19: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/19.jpg)
July 24, 2005 Portland Code Camp 1.0
CAB Architecture
Component Model
Composite UI
Composite UI
(WinForms)
![Page 20: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/20.jpg)
July 24, 2005 Portland Code Camp 1.0
CAB Architecture
Component Model
Composite UI
Composite UI
(WinForms)
Composite UI
(Avalon)
Composite UI
(3rd party)
![Page 21: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/21.jpg)
July 24, 2005 Portland Code Camp 1.0
Views & Controllers
Views present model data to the user
Controllers contain the business logic
Automatically wired up by the container
A view has one and only one controller
A controller may control many views
![Page 22: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/22.jpg)
July 24, 2005 Portland Code Camp 1.0
Work Item
Represents a use case in the system
Specialized container for
Model Data
Views
Controllers
Workspaces
Services
Key point of reusability
Model
Model
Model
View Ctrlr
Svc
![Page 23: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/23.jpg)
July 24, 2005 Portland Code Camp 1.0
Workspaces
Workspaces are canvases onto which you can paint your views
For Windows Forms, we ship:
WindowWorkspace
MdiWorkspace
ZoneWorkspace
TabWorkspace
DeckWorkspace
![Page 24: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/24.jpg)
July 24, 2005 Portland Code Camp 1.0
Demo
Bank Teller QuickStart
![Page 25: Composite UI Application Block - Brad Wilson · July 24, 2005 Portland Code Camp 1.0 Dependency Injection The "old way": Components have intimate knowledge of services public class](https://reader035.vdocument.in/reader035/viewer/2022081611/5f090ca97e708231d424fd0d/html5/thumbnails/25.jpg)
July 24, 2005 Portland Code Camp 1.0
Q & A