SlideShare a Scribd company logo
1 of 23
Download to read offline
Refactoring the BlackBerry’s
GaugeField component
Mohammad Talha Khalid
All respective BlackBerry images and logos are the property of BlackBerry (Research In Motion)
Presentation Background
I originally created this presentation for my SE 464 Software
Architecture class, based on my co-op experience at BlackBerry.
I subsequently entered it into the SFF Technical Speaking
Competition (2nd Place Award).
GaugeField component
• UI Components team
– Makes UI Components
for the BlackBerry
Project Overview
• Refactor the GaugeField component to
adhere to the MVC pattern
– Restructure & Rearrange the code
– Splitting up into M, V, C
• SE 464 Relevance
– Refactoring
– MVC Design Pattern
Why refactor the GaugeField?
• Code will be easier to understand
– All the code was in one class... messy
• MVC makes sense for a UI component
– Easier to modify the component
– Add more input controllers
• Support touch-screen devices
– Add more Views
Refactoring Process
Applying behavior-preserving transformations
1) Adding new classes
– Controller & View
2) Method extraction
– Identify all the code relevant to M, V, C
– Extract code
– Put it in the View and Controller classes
1
2
#1: Adding Classes
Original GaugeField class
#1: Adding Classes
• Adding 2 aggregate classes
– GaugeField “has a” GaugeFieldView
#2: Method Extraction
1. Select code
2. Place it in a new (private) method
3. Call the new method
private void clone(){
}
#2: Method Extraction
GaugeField(){
//constructor…
}
TrackBall_Input (){
//handle trackball events…..
}
Paint_ProgressBar(){
//paint the progress bar…
}
Controller
View
GaugeField(){
GaugeFieldController _controller;
GaugeFieldView _view;
}
TrackBall_Input (){
_controller.TrackBall_Input()
}
Paint_ProgressBar(){
_view.Paint_ProgressBar()
}
GaugeFieldController
TrackBall_Input(){
//handle trackball events…..
}
GaugeFieldView
Paint_ProgressBar(){
//paint the progress bar…
}
GaugeField(){
GaugeFieldController _controller;
GaugeFieldView _view;
}
TrackBallInput (){
_controller.TrackBallInput()
}
PaintProgressBar(){
_view.PaintProgressBar()
}
GaugeFieldController
FooTrackBallInput(){
//handle trackball events…..
}
GaugeFieldView
PaintProgressBar(){
//paint the progress bar…
}
Adding Classes
GaugeField has a
Controller and View
1
GaugeField(){
GaugeFieldController _controller;
GaugeFieldView _view;
}
TrackBallInput (){
_controller.TrackBallInput()
}
GaugeFieldController
TrackBallInput(){
//handle trackball events…..
}
Method Extraction
Redirecting to the Controller
2
A note about re-directing
• Cannot destroy current
methods
– Developers rely on the API
• But old methods can
redirect to the new
methods
Just re-directing?
• Many methods were self-contained
– Extraction
– Re-direction
• There was code that was not self-contained
Benefits
• Code is neatly organized
– Split up into M, V, C
• Beneficial for the Controller & View
– Easier to add more methods in the future
1
2
Beneficial for the View
Progress Bar View Pyramid View
Beneficial for the Controller
Trackball Trackpad Touch-screen
Beneficial for the Controller
GaugeFieldController
TrackBall_Input(){
//handle trackball events…..
}
TouchEvents(){
//handle touchscreen events…
}
Trackpad(){
//handle trackpad…
}
Beneficial for BlackBerry?
Summary
• Restructured the GaugeField code
• Added Classes
• Method Extraction
– Old methods re-directed to the new
methods
– Helped preserve the API
• MVC allows you to enhance the
View & Controller with more
functionality
1
2
The End
All respective BlackBerry images and logos are the property of BlackBerry (Research In Motion)
Image References
Images in this presentation were extracted from the Internet, and are the property of
their respective owners, including BlackBerry.
A non-exhaustive list of miscellaneous image references follows. Caveat: Some of the
labels in the domain names are a bit peculiar.
Peculiar URL References:
• http://2.bp.blogspot.com/_xhI2QKKA6cY/ScFMZdFhxMI/AAAAAAAAAWI/YsmJKn7
Doz4/s400/image.axd+%281%29.png
• http://www.stopgettingcheated.com/images/easy-button.jpg
• http://www.stop-age.com/userfiles/image/syringe2.jpg
• http://www.code-magazine.com/article.aspx?quickid=0401071&page=2
• http://www.dreamstime.com/doctor-with-syringe-needle-image5290308

More Related Content

Viewers also liked

Excursión Atalaya
Excursión AtalayaExcursión Atalaya
Excursión Atalayagelfling333
 
Mercedes Benz - Story of a thousand hours
Mercedes Benz - Story of a thousand hoursMercedes Benz - Story of a thousand hours
Mercedes Benz - Story of a thousand hoursZeeshan Ali Contractor
 
Technical Seminar PPT
Technical Seminar PPTTechnical Seminar PPT
Technical Seminar PPTKshitiz_Vj
 
Download presentation
Download presentationDownload presentation
Download presentationwebhostingguy
 
Free Download Powerpoint Slides
Free Download Powerpoint SlidesFree Download Powerpoint Slides
Free Download Powerpoint SlidesGeorge
 
Technology powerpoint presentations
Technology powerpoint presentationsTechnology powerpoint presentations
Technology powerpoint presentationsismailraesha
 

Viewers also liked (6)

Excursión Atalaya
Excursión AtalayaExcursión Atalaya
Excursión Atalaya
 
Mercedes Benz - Story of a thousand hours
Mercedes Benz - Story of a thousand hoursMercedes Benz - Story of a thousand hours
Mercedes Benz - Story of a thousand hours
 
Technical Seminar PPT
Technical Seminar PPTTechnical Seminar PPT
Technical Seminar PPT
 
Download presentation
Download presentationDownload presentation
Download presentation
 
Free Download Powerpoint Slides
Free Download Powerpoint SlidesFree Download Powerpoint Slides
Free Download Powerpoint Slides
 
Technology powerpoint presentations
Technology powerpoint presentationsTechnology powerpoint presentations
Technology powerpoint presentations
 

Similar to Technical Presentation - BlackBerry - Refactoring the Gaugefield Component - University of Waterloo

angular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdfangular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdfNuttavutThongjor1
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftOleksandr Stepanov
 
Android development 1july
Android development 1julyAndroid development 1july
Android development 1julyEdureka!
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6William Marques
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Oro Inc.
 
Building an Angular 2 App
Building an Angular 2 AppBuilding an Angular 2 App
Building an Angular 2 AppFelix Gessert
 
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopDevelop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopEdureka!
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios
 
Angular 2 at solutions.hamburg
Angular 2 at solutions.hamburgAngular 2 at solutions.hamburg
Angular 2 at solutions.hamburgBaqend
 
Lightning salesforce
Lightning salesforceLightning salesforce
Lightning salesforcemounikadv
 
Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Kasper Reijnders
 
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...Igalia
 
Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)Sameer Rathoud
 
Gutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesGutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesRiad Benguella
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteMVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteRavi Bhadauria
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM patternNAVER Engineering
 

Similar to Technical Presentation - BlackBerry - Refactoring the Gaugefield Component - University of Waterloo (20)

angular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdfangular fundamentals.pdf angular fundamentals.pdf
angular fundamentals.pdf angular fundamentals.pdf
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in Swift
 
Android development 1july
Android development 1julyAndroid development 1july
Android development 1july
 
Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6Angular 2 Migration - JHipster Meetup 6
Angular 2 Migration - JHipster Meetup 6
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
Building an Angular 2 App
Building an Angular 2 AppBuilding an Angular 2 App
Building an Angular 2 App
 
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopDevelop Mobile App Using Android Lollipop
Develop Mobile App Using Android Lollipop
 
What is your money doing?
What is your money doing?What is your money doing?
What is your money doing?
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
 
Angular 2 at solutions.hamburg
Angular 2 at solutions.hamburgAngular 2 at solutions.hamburg
Angular 2 at solutions.hamburg
 
Lightning salesforce
Lightning salesforceLightning salesforce
Lightning salesforce
 
angular fundamentals.pdf
angular fundamentals.pdfangular fundamentals.pdf
angular fundamentals.pdf
 
Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)
 
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...
Implementing one feature set in two JavaScript engines (Web Engines Hackfest ...
 
Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Gutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisablesGutenberg sous le capot, modules réutilisables
Gutenberg sous le capot, modules réutilisables
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteMVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 

Recently uploaded

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Technical Presentation - BlackBerry - Refactoring the Gaugefield Component - University of Waterloo

  • 1. Refactoring the BlackBerry’s GaugeField component Mohammad Talha Khalid All respective BlackBerry images and logos are the property of BlackBerry (Research In Motion)
  • 2. Presentation Background I originally created this presentation for my SE 464 Software Architecture class, based on my co-op experience at BlackBerry. I subsequently entered it into the SFF Technical Speaking Competition (2nd Place Award).
  • 3. GaugeField component • UI Components team – Makes UI Components for the BlackBerry
  • 4. Project Overview • Refactor the GaugeField component to adhere to the MVC pattern – Restructure & Rearrange the code – Splitting up into M, V, C • SE 464 Relevance – Refactoring – MVC Design Pattern
  • 5. Why refactor the GaugeField? • Code will be easier to understand – All the code was in one class... messy • MVC makes sense for a UI component – Easier to modify the component – Add more input controllers • Support touch-screen devices – Add more Views
  • 6. Refactoring Process Applying behavior-preserving transformations 1) Adding new classes – Controller & View 2) Method extraction – Identify all the code relevant to M, V, C – Extract code – Put it in the View and Controller classes 1 2
  • 7. #1: Adding Classes Original GaugeField class
  • 8. #1: Adding Classes • Adding 2 aggregate classes – GaugeField “has a” GaugeFieldView
  • 9. #2: Method Extraction 1. Select code 2. Place it in a new (private) method 3. Call the new method private void clone(){ }
  • 10. #2: Method Extraction GaugeField(){ //constructor… } TrackBall_Input (){ //handle trackball events….. } Paint_ProgressBar(){ //paint the progress bar… } Controller View
  • 11. GaugeField(){ GaugeFieldController _controller; GaugeFieldView _view; } TrackBall_Input (){ _controller.TrackBall_Input() } Paint_ProgressBar(){ _view.Paint_ProgressBar() } GaugeFieldController TrackBall_Input(){ //handle trackball events….. } GaugeFieldView Paint_ProgressBar(){ //paint the progress bar… }
  • 12. GaugeField(){ GaugeFieldController _controller; GaugeFieldView _view; } TrackBallInput (){ _controller.TrackBallInput() } PaintProgressBar(){ _view.PaintProgressBar() } GaugeFieldController FooTrackBallInput(){ //handle trackball events….. } GaugeFieldView PaintProgressBar(){ //paint the progress bar… } Adding Classes GaugeField has a Controller and View 1
  • 13. GaugeField(){ GaugeFieldController _controller; GaugeFieldView _view; } TrackBallInput (){ _controller.TrackBallInput() } GaugeFieldController TrackBallInput(){ //handle trackball events….. } Method Extraction Redirecting to the Controller 2
  • 14. A note about re-directing • Cannot destroy current methods – Developers rely on the API • But old methods can redirect to the new methods
  • 15. Just re-directing? • Many methods were self-contained – Extraction – Re-direction • There was code that was not self-contained
  • 16. Benefits • Code is neatly organized – Split up into M, V, C • Beneficial for the Controller & View – Easier to add more methods in the future 1 2
  • 17. Beneficial for the View Progress Bar View Pyramid View
  • 18. Beneficial for the Controller Trackball Trackpad Touch-screen
  • 19. Beneficial for the Controller GaugeFieldController TrackBall_Input(){ //handle trackball events….. } TouchEvents(){ //handle touchscreen events… } Trackpad(){ //handle trackpad… }
  • 21. Summary • Restructured the GaugeField code • Added Classes • Method Extraction – Old methods re-directed to the new methods – Helped preserve the API • MVC allows you to enhance the View & Controller with more functionality 1 2
  • 22. The End All respective BlackBerry images and logos are the property of BlackBerry (Research In Motion)
  • 23. Image References Images in this presentation were extracted from the Internet, and are the property of their respective owners, including BlackBerry. A non-exhaustive list of miscellaneous image references follows. Caveat: Some of the labels in the domain names are a bit peculiar. Peculiar URL References: • http://2.bp.blogspot.com/_xhI2QKKA6cY/ScFMZdFhxMI/AAAAAAAAAWI/YsmJKn7 Doz4/s400/image.axd+%281%29.png • http://www.stopgettingcheated.com/images/easy-button.jpg • http://www.stop-age.com/userfiles/image/syringe2.jpg • http://www.code-magazine.com/article.aspx?quickid=0401071&page=2 • http://www.dreamstime.com/doctor-with-syringe-needle-image5290308