SlideShare a Scribd company logo
Blendability Barry Gervin bgervin@objectsharp.com ObjectSharp, Founding Partner www.ObjectSharp.com/blogs/barry
We should...
But sometimes we...
We Should...
But sometimes we...
What is “Blendability”? “Ability to work on a project in Expression Blend” “Developers and Designers can work within their own tools, in harmony with each other,  throughout the development lifecycle” “Valuing the declaration of intention in our code 			overthe fine grain control of proceduraloperations.”
does it blend?
Not Blendable!
It Blends!
Blendability
Demo: Blend Tooling Design Time Attributes, Sample Data, Visual State Manager
XML Data Source Attractive option for designers, but... Generates unique syntax Difficult to move to CLR object binding.
Practices Techniques Data Binding Model Concerns (Change Notification) MVVM Value Converters Control Templates Triggers, Actions & Behaviours Source Code Management
Model Concerns publicstringViewModelProperty { get{ returnthis.viewModelProperty; } set{ this.viewModelProperty = value; this.NotifyPropertyChanged("ViewModelProperty"); }  }
Model Concerns publicclassItemCollection : ObservableCollection<Item> { .. } ... privateItemCollection _myCollection = newItemCollection(); //make it blend!publicItemCollectionMyCollection{ get	{ returnthis._myCollection; 	} }
Model-View-ViewModel Pattern created by John Gossman from WPF team Inspired by MVC, MVP & Martin Fowler’s PresentationModel pattern Excellent choice for Bindability Lots of evolution, popularity, frameworks
Why MVVM? Separation of Concerns (UI & Business Logic) Event driven code is not very unit testable Views & View Models don’t have to be changed by changes in each other. Blendability
MVVM .DataContext View ViewModel Model {Binding .. } Window User Control ,[object Object]
EF/L2S Entity
DTO,
WCF ProxyDomain / Service / Repository
With Model-View-Presenter View Model /Business Layer Presenter Selection Save
With Model-View-ViewModel View Model / Business Layer ViewModel {Binding} Selection {Binding} Save {Binding}
ViewModel Construction publicpartialclassMainView : UserControl {  publicMainView() { this.DataContext = newMyViewModel(); InitializeComponent(); }  } Not very blendable, neither is DI.
ViewModel Construction <UserControl.Resources><local:MainViewModelx:Key="MainViewModelDataSource"/> </UserControl.Resources> <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResourceMainViewModelDataSource}}" d:DataContext="{d:DesignData /SampleData/MainViewModelSampleData.xaml}"> Nice!
MVVM Demo Invoking Actions, Update the UI
ViewModel Instantiation View Constructor Dependency Injection XAML (Easiest Blendability) ViewModelLocator Service
MVVM Frameworks ,[object Object]
Composite WPF (Prism)
MVVM Foundation
MVVM Light Toolkit
Onyx,[object Object]
Value Converter vs. View Model Full Name = LastName + “, “ + FirstName Better candidate on the Model or ViewModel Ask yourself... How reusable is this?  Will I need to test this as part of the test for the View Model?
Control Templates Expressing Intention
Interactivity without Code Silverlight 2 Storyboards  with Animations, triggered playback Interactive Controls  Data Bindings Data Templates ...and code, frequently common code
Interactivity without Code Silverlight 3 & 4 Triggers & Actions (a la WPF) Action = Object that is invoked to perform operation  Change Property Open Window Trigger = Event that causes some behaviour Clicked Timer
Interactivity without Code Silverlight 3 & 4 Behaviours Self-Contained Reusable “snippets” of interactivity code, Trigger + Action? Assigned to art board content Works in Blend Excellent for Prototyping AND Production
Behaviours Inherit from Behaviour<T> Override OnAttached <T> AssociatedObject programmatically add xaml, storyboards, etc. Assign event handlers Implement Event Handlers (i.e. Triggers) Begin Storyboard Set Propertys, etc.
Behaviours Add interactivity without code.
Triggers, Actions & Behaviours Trigger: Event that causes a behaviour Action: Behaviour that is invoked on some trigger. Behaviour:  Much more, but think Trigger + Action
Custom Behaviour publicclassInverseColorClickBehavior : Behavior<FrameworkElement>{  protectedoverridevoidOnAttached(){  base.OnAttached();  this.AssociatedObject.MouseLeftButtonDown +=  newMouseButtonEventHandler(   AssociatedObject_MouseLeftButtonDown ); } privatevoidAssociatedObject_MouseLeftButtonDown( object sender,  MouseButtonEventArgs e ){  this.AssociatedObject.Effect = this.AssociatedObject.Effect == null ?  	this.AssociatedObject.Effect = this.inverseColor : 	this.AssociatedObject.Effect = null;} } Determines type of AssociatedObject, and what you can do? Event handlers, customize element. Don’t forget to clean up in Detached!

More Related Content

What's hot

Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
Valentine with AngularJS
Valentine with AngularJSValentine with AngularJS
Valentine with AngularJS
Vidyasagar Machupalli
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
dizabl
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
Bipin
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
Betclic Everest Group Tech Team
 
Introduction of angular js
Introduction of angular jsIntroduction of angular js
Introduction of angular js
Tamer Solieman
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
Munir Hoque
 
Angular js
Angular jsAngular js
Angular js
Manav Prasad
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
Mindfire Solutions
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at DatacomDavid Xi Peng Yang
 
Angular Seminar-js
Angular Seminar-jsAngular Seminar-js
Angular Seminar-js
Mindfire Solutions
 
Angular from Scratch
Angular from ScratchAngular from Scratch
Angular from Scratch
Christian Lilley
 
WJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
Philipp Burgmer
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
أحمد عبد الوهاب
 

What's hot (20)

Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Valentine with AngularJS
Valentine with AngularJSValentine with AngularJS
Valentine with AngularJS
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Introduction of angular js
Introduction of angular jsIntroduction of angular js
Introduction of angular js
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
Angular js
Angular jsAngular js
Angular js
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
 
Angular Seminar-js
Angular Seminar-jsAngular Seminar-js
Angular Seminar-js
 
Angular from Scratch
Angular from ScratchAngular from Scratch
Angular from Scratch
 
WJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
 

Similar to Will your code blend? : Toronto Code Camp 2010 : Barry Gervin

Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Mahmoud Hamed Mahmoud
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
The Magic of WPF & MVVM
The Magic of WPF & MVVMThe Magic of WPF & MVVM
The Magic of WPF & MVVM
Abhishek Sur
 
Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Waters
michael.labriola
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its featuresAbhishek Sur
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
kaven yan
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
Boulos Dib
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJS
Boyan Mihaylov
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
Ilia Idakiev
 
Knockoutjs
KnockoutjsKnockoutjs
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
Jonas Follesø
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
goodfriday
 
WPF - Controls &amp; Data
WPF - Controls &amp; DataWPF - Controls &amp; Data
WPF - Controls &amp; DataSharada Gururaj
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
icubesystem
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
Knoldus Inc.
 
jQuery
jQueryjQuery
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
Ilia Idakiev
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
David Chandler
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDB
Michal Bigos
 

Similar to Will your code blend? : Toronto Code Camp 2010 : Barry Gervin (20)

Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
The Magic of WPF & MVVM
The Magic of WPF & MVVMThe Magic of WPF & MVVM
The Magic of WPF & MVVM
 
Diving in the Flex Data Binding Waters
Diving in the Flex Data Binding WatersDiving in the Flex Data Binding Waters
Diving in the Flex Data Binding Waters
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its features
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJS
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
 
Knockoutjs
KnockoutjsKnockoutjs
Knockoutjs
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
WPF - Controls &amp; Data
WPF - Controls &amp; DataWPF - Controls &amp; Data
WPF - Controls &amp; Data
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
jQuery
jQueryjQuery
jQuery
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDB
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 

Will your code blend? : Toronto Code Camp 2010 : Barry Gervin

  • 1. Blendability Barry Gervin bgervin@objectsharp.com ObjectSharp, Founding Partner www.ObjectSharp.com/blogs/barry
  • 6.
  • 7.
  • 8. What is “Blendability”? “Ability to work on a project in Expression Blend” “Developers and Designers can work within their own tools, in harmony with each other, throughout the development lifecycle” “Valuing the declaration of intention in our code overthe fine grain control of proceduraloperations.”
  • 11.
  • 14. Demo: Blend Tooling Design Time Attributes, Sample Data, Visual State Manager
  • 15. XML Data Source Attractive option for designers, but... Generates unique syntax Difficult to move to CLR object binding.
  • 16. Practices Techniques Data Binding Model Concerns (Change Notification) MVVM Value Converters Control Templates Triggers, Actions & Behaviours Source Code Management
  • 17. Model Concerns publicstringViewModelProperty { get{ returnthis.viewModelProperty; } set{ this.viewModelProperty = value; this.NotifyPropertyChanged("ViewModelProperty"); } }
  • 18. Model Concerns publicclassItemCollection : ObservableCollection<Item> { .. } ... privateItemCollection _myCollection = newItemCollection(); //make it blend!publicItemCollectionMyCollection{ get { returnthis._myCollection; } }
  • 19. Model-View-ViewModel Pattern created by John Gossman from WPF team Inspired by MVC, MVP & Martin Fowler’s PresentationModel pattern Excellent choice for Bindability Lots of evolution, popularity, frameworks
  • 20. Why MVVM? Separation of Concerns (UI & Business Logic) Event driven code is not very unit testable Views & View Models don’t have to be changed by changes in each other. Blendability
  • 21.
  • 23. DTO,
  • 24. WCF ProxyDomain / Service / Repository
  • 25. With Model-View-Presenter View Model /Business Layer Presenter Selection Save
  • 26. With Model-View-ViewModel View Model / Business Layer ViewModel {Binding} Selection {Binding} Save {Binding}
  • 27. ViewModel Construction publicpartialclassMainView : UserControl { publicMainView() { this.DataContext = newMyViewModel(); InitializeComponent(); } } Not very blendable, neither is DI.
  • 28. ViewModel Construction <UserControl.Resources><local:MainViewModelx:Key="MainViewModelDataSource"/> </UserControl.Resources> <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResourceMainViewModelDataSource}}" d:DataContext="{d:DesignData /SampleData/MainViewModelSampleData.xaml}"> Nice!
  • 29. MVVM Demo Invoking Actions, Update the UI
  • 30. ViewModel Instantiation View Constructor Dependency Injection XAML (Easiest Blendability) ViewModelLocator Service
  • 31.
  • 35.
  • 36. Value Converter vs. View Model Full Name = LastName + “, “ + FirstName Better candidate on the Model or ViewModel Ask yourself... How reusable is this? Will I need to test this as part of the test for the View Model?
  • 38. Interactivity without Code Silverlight 2 Storyboards with Animations, triggered playback Interactive Controls Data Bindings Data Templates ...and code, frequently common code
  • 39. Interactivity without Code Silverlight 3 & 4 Triggers & Actions (a la WPF) Action = Object that is invoked to perform operation Change Property Open Window Trigger = Event that causes some behaviour Clicked Timer
  • 40. Interactivity without Code Silverlight 3 & 4 Behaviours Self-Contained Reusable “snippets” of interactivity code, Trigger + Action? Assigned to art board content Works in Blend Excellent for Prototyping AND Production
  • 41. Behaviours Inherit from Behaviour<T> Override OnAttached <T> AssociatedObject programmatically add xaml, storyboards, etc. Assign event handlers Implement Event Handlers (i.e. Triggers) Begin Storyboard Set Propertys, etc.
  • 43. Triggers, Actions & Behaviours Trigger: Event that causes a behaviour Action: Behaviour that is invoked on some trigger. Behaviour: Much more, but think Trigger + Action
  • 44. Custom Behaviour publicclassInverseColorClickBehavior : Behavior<FrameworkElement>{ protectedoverridevoidOnAttached(){ base.OnAttached(); this.AssociatedObject.MouseLeftButtonDown += newMouseButtonEventHandler( AssociatedObject_MouseLeftButtonDown ); } privatevoidAssociatedObject_MouseLeftButtonDown( object sender, MouseButtonEventArgs e ){ this.AssociatedObject.Effect = this.AssociatedObject.Effect == null ? this.AssociatedObject.Effect = this.inverseColor : this.AssociatedObject.Effect = null;} } Determines type of AssociatedObject, and what you can do? Event handlers, customize element. Don’t forget to clean up in Detached!
  • 45. Blend Design Time Support Category Support in Asset Library Categories in Asset Library using a “MetadataStore” Icons PNG image as Embedded Resource and naming in a specific format:Namespace.ControlName.[Expression].[small|medium|etc].png “Installing” Behaviors COPY TO %ProgramFiles%icrosoft Expressionlend 3ibrariesilverlight3.0
  • 46. Issues “How do I turn a sketchflowprototype into production application?” You DON’T want to do this You DO want to create multiple prototypes You DO want to take the best of each You DO want to use XAML elements via Copy & Paste.
  • 47. Counter Points “I don’t use ____ instead of blend for the generation of UI elements into XAML.” Lots of code-behind Old School, pre-xaml education Unfortunate Anti-Pattern
  • 48. Takeaways Work towards incorporating Design process throughout lifecycle. Enable that with tools & practices. Don’t give up to easy, but don’t be a purist either!
  • 49. Resources Expressionblend. Codeplex.com Expression Blend Design Gallery Behaviours Samples Themes
  • 50. Thanks to our contributors

Editor's Notes

  1. Category Support in Asset LibraryWe can support Categories in Asset Library using a “MetadataStore”IconsWe can assign icons by setting a PNG image as Embedded Resource and naming in a specific format:Namespace.ControlName.[Expression].[small|medium|etc].png“Installing” BehaviorsCOPY TO %ProgramFiles%Microsoft ExpressionBlend 3LibrariesSilverlightv3.0