Lublin Startup Festival - Mobile Architecture Design Patterns
- 4. Agenda
Out of the box approach
MVVM
Inversion of Control
Command and Query Responsibility Segregation
Tools & Tips
1
2
3
4
5
6 Questions
Powered by
- 6. Can be overkill for very simple application
Requires more time to bootstrap app
architecture
Disadventages
Powered by
Design Pattern Overview
Simplify maintenance
Separation of concerns
Minimize logic needed in UI
Enable testability
Reduce development time
Easy to customize apps
Adventages
- 7. OUT OF THE BOX APPROACH
CODE BEHIND
1
Powered by
- 8. Fast app prototyping
No time required for bootstraping application
Simple design: action + handler
Easy access to visual tree
Pros
Powered by
Out of the box approach
Code Behind
- 9. Large view classes
Breaks Single Responsibility Pattern
Hard to mantain in future
Poor code readability
UI customization can break logic inside view
Cons
Powered by
Out of the box approach
Code Behind
- 11. Creating small MVP of your product if there is an opportunity to refactor
Testing features
Small apps
When you should use it?
Powered by
When you shouldn’t use it?
Creating MVP without time to refactor
Enterprise apps
For apps with long-term support
Out of the box approach
Code Behind
- 14. Creating long term-support apps
When considering unit testing
When we need better code mantainability
When you should use it?
MVVM
approach
Powered by
When you shouldn’t use it?
For app testing purpose
When we don’t need testable bussines logic
When project is very simple (avoid architecture overengineering)
- 16. WinRT focused
Support C#, C++/CX and HTML/JS
Validation, Conventions, Attached Events, Messenger, Logging
Very modular
Has IoC – Grace Container
StyleMVVM
MVVM
frameworks
Powered by
- 17. More complex, harder bootstrap
Better support for View Composition
Event aggregator
Conventions, Coroutines
Stable!
CaliburnMicro
MVVM
frameworks
Powered by
- 19. It’s not a library, framework or tool
It’s like a way of thinking, designing code and general guidelines
Dependency Injection is a set of practices that allow to build loosely coupled
applications
DI & IOC
What is it?
Powered by
- 20. Small components that are: independent, reusable, interchamgeable
We gain such benefits like: small classes (SRP), easy maintenance,
extensibility and testability
Dependency Injection is a set of practices that allow to build loosely coupled
applications
Powered by
DI & IOC
What is it?
- 28. Query stands for reading
Commands stands for writing
Command/Query Responsibility Segregation (CQRS) is the idea that you
can use a different model to update information than the model you use to
read information (web experience).
CQRS
What is it?
Powered by
- 30. ALL OF THIS TO PROVIDE
SCALABILITY & A CONSISTENT
VIEW OF THE DATA.
[WEB]
Powered by
- 31. Classes are responsible for doing one particural job
Easy testability, extensibility and readability
Easy to mantain
Can be shared via multiple projects (portable)
Adventages of CQRS in mobile application:
CQRS
Why do we need it?
Powered by
- 39. MrAdvice – AOP tool
MethodTimer – decorates method with a timer
NullGuard – useful for Defensive Programming
Visualize – DebuggerDisplay weaver
Fody is a extensible tool for weaving .net assemblies
Tools - Fody
Powered by
- 40. Polly is a .NET 3.5 / 4.0 / 4.5 / PCL (Profile 259) library that allows
developers to express transient exception handling policies such as Retry,
Retry Forever, Wait and Retry or Circuit Breaker in a fluent manner.
Tools - Polly
Powered by
await Policy
.Handle<SqlException>(ex => ex.Number == 1205)
.Or<ArgumentException>(ex => ex.ParamName == "example")
.RetryAsync()
.ExecuteAsync(() => DoSomethingAsync());
- 41. Cimbalino Toolkit is a set of useful and powerful tools that will help you build
your Windows Platform applications.
Tools - Cimbalino
Powered by
Supports:
Windows Phone Silverlight 8.0+
Windows Phone / Windows Store 8.0 (WinRT)
Universal App Platform (Windows 10)
- 42. What do we get?
Tools - Cimbalino
Powered by
Behaviors
Converters
Extension classes
Services
Helpers
- 43. What do we get?
Tools - Resharper
Powered by
Better IntelliSense
Great refactor tool
XAML Support
R# just rocks!
- 44. Better to:
Tip #1 – Universal Apps 8.1
Powered by
Separate styles and templates using stalellite libraries
Add ViewModels to portable library NOT to shared project
Design your app architecture to support multiple platforms like Xamarin
Design your project to support adapter pattern
Throwing exceptions from layers is not the best way to handle errors
- 45. What do we get?
Tip #2 – Windows 10 XAML
Powered by
Improved XAML performance
x:Bind – faster compiled binding
Adaptive design
.Net Native
- 46. App design guidelines
Tip #3 – Xamarin
Powered by
Design your code logic to be not dependant on specific platform
Test your code on each platform
Don’t code without thinking about the problem
Design your code to be simply and readable.
Don’t overengineer your app