silverlight n-tier architecture - wordpress.com · silverlight n-tier architecture focus is...

19
Silverlight n-tier Architecture Thomas Juul, Senior Consultant, TENTEO

Upload: others

Post on 18-Jul-2020

35 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Silverlight n-tier Architecture

Thomas Juul, Senior Consultant, TENTEO

Page 2: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Show of Hands

How many of you do not write code on a daily basis?

Page 3: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Silverlight n-tier Architecture

Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent ASP.NET

Page 4: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

“If you get any group of architects into a room

and ask them to describe their ideal architecture,

each one will come up with a different answer”

Page 5: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Silverlight 2-tier Architecture

UI

Domain Objects

Repository

Silverlight Client Application Server

Services

Domain Objects

Repository

Database

Page 6: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Silverlight 3-tier Architecture

UI

Domain Objects

Repository

Silverlight Client

Services

Domain Objects

Repository

Application Server

Database

Database Server

Page 7: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Silverlight 4-tier Architecture

UI

Domain Objects

Repository

Silverlight Client

Services

Domain Objects

Repository

DMZ Application Server

Services

Domain Objects

Repository

Application Server

Database

Database Server

Page 8: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Walkthrough

• Write business logic once, reuse on server and client

• Loosely coupled UI

• Loosely coupled UI Communication

• Async network Communication

• Mock the Repository

• Testability

Page 9: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Where to place the business logic?

Two approaches

Page 10: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

”True” Object-Oriented Paradigm

BehaviorData

Access

Code

State

Page 11: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

”Semi” Object-Oriented Paradigm

Behavior State

Data

Access

Code

Page 12: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Model-View-ViewModel aka Presentation Model

2-way through Data Binding

View

ViewModel

Model

Page 13: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Complexity

N-tier design will increase complexity for small applications, but decrease complexity for large applications

Page 14: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Talk is cheap. Show me the code!!

Page 15: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

WCF Services

Server Repository

Client Repository

UI Shell

UI module X

UI module Y

Unity

Model

Unity

Not Quite UML..

Page 16: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Best Practice / Our Practice...

• Do share the Business Logic (model)

• Do block the UI (area) when making service calls

• Do use SSL to secure data on the wire

• Do protect the WCF services with authentication

• Avoid the generated proxy

• Consider using prism for loosely coupled UI & Communication

• Consider using DI to manage dependencies / mock

• Consider to bundle the service calls

• Consider using compression

• Do use a framework to encapsulate logic like this

Page 17: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Frameworks functionality

Functionality that almost any Line-Of-Business application needs (silverlight or not)

- State tracking- Validations rules- Undo support- Full data binding support- Authorization - Authentication- Job scheduling- and more…

Page 18: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Frameworks

• CSLA.NET- http://www.lhotka.net/cslanet/

• RIA Services- http://code.msdn.microsoft.com/RiaServices

• PRISM-http://compositewpf.codeplex.com/

• Build-It-Yourself approach…

Page 19: Silverlight n-tier Architecture - WordPress.com · Silverlight n-tier Architecture Focus is Silverlight, but this architecture can also be applied to WPF, WinForms and to some extent

Questions

THOMAS JUUL

Senior Consultant, TENTEO

[email protected]

www.coreclr.dk