SlideShare a Scribd company logo
Submit Search
Upload
Epic Refactorings - Melbourne Cocoaheads June 2011
Report
Share
Jesse Collis
Freelance iOS/PHP Developer at Beanhunter
Follow
•
0 likes
•
570 views
1
of
41
Epic Refactorings - Melbourne Cocoaheads June 2011
•
0 likes
•
570 views
Report
Share
Download Now
Download to read offline
Technology
By Jesse Collis and Luke Cunningham. June 2011
Read more
Jesse Collis
Freelance iOS/PHP Developer at Beanhunter
Follow
Recommended
React js intro by
React js intro
Jessica Le
451 views
•
7 slides
Backbone And Marionette : Take Over The World by
Backbone And Marionette : Take Over The World
harshit040591
794 views
•
33 slides
Marionette - TorontoJS by
Marionette - TorontoJS
matt-briggs
2.9K views
•
27 slides
Marionette structure with modules by
Marionette structure with modules
matt-briggs
11.1K views
•
18 slides
Backbone/Marionette introduction by
Backbone/Marionette introduction
matt-briggs
4.6K views
•
20 slides
Seminar Konfliktens Anatomi by
Seminar Konfliktens Anatomi
marga_dijkman
397 views
•
4 slides
More Related Content
Viewers also liked
CATiled Layer - Melbourne Cocoheads February 2012 by
CATiled Layer - Melbourne Cocoheads February 2012
Jesse Collis
862 views
•
24 slides
Terra malalta by
Terra malalta
e3005339
236 views
•
22 slides
Bedre Samarbeid, Kommunikasjon og Stressmestring i en travel arbeidsdag by
Bedre Samarbeid, Kommunikasjon og Stressmestring i en travel arbeidsdag
marga_dijkman
894 views
•
12 slides
Habitats by
Habitats
e3005339
298 views
•
54 slides
Diffusion meeting Spain by
Diffusion meeting Spain
e3005339
620 views
•
3 slides
LOGO CONTEST by
LOGO CONTEST
e3005339
297 views
•
3 slides
Viewers also liked
(13)
CATiled Layer - Melbourne Cocoheads February 2012 by Jesse Collis
CATiled Layer - Melbourne Cocoheads February 2012
Jesse Collis
•
862 views
Terra malalta by e3005339
Terra malalta
e3005339
•
236 views
Bedre Samarbeid, Kommunikasjon og Stressmestring i en travel arbeidsdag by marga_dijkman
Bedre Samarbeid, Kommunikasjon og Stressmestring i en travel arbeidsdag
marga_dijkman
•
894 views
Habitats by e3005339
Habitats
e3005339
•
298 views
Diffusion meeting Spain by e3005339
Diffusion meeting Spain
e3005339
•
620 views
LOGO CONTEST by e3005339
LOGO CONTEST
e3005339
•
297 views
La Primavera by e3005339
La Primavera
e3005339
•
177 views
A Brief History of Melbourne Cocoaheads - May 2013 by Jesse Collis
A Brief History of Melbourne Cocoaheads - May 2013
Jesse Collis
•
1.3K views
editorial by lionred17
editorial
lionred17
•
120 views
Integrating iAds (Melbourne Cocoaheads November 2010) by Jesse Collis
Integrating iAds (Melbourne Cocoaheads November 2010)
Jesse Collis
•
856 views
Writing Online News Leads by Bill Edwards
Writing Online News Leads
Bill Edwards
•
686 views
Implementing CATiledLayer by Jesse Collis
Implementing CATiledLayer
Jesse Collis
•
7.2K views
Xcode 4 shortcuts (Melbourne Cocoheads April 2011) by Jesse Collis
Xcode 4 shortcuts (Melbourne Cocoheads April 2011)
Jesse Collis
•
2.6K views
Similar to Epic Refactorings - Melbourne Cocoaheads June 2011
React.js - and how it changed our thinking about UI by
React.js - and how it changed our thinking about UI
Marcin Grzywaczewski
2.5K views
•
25 slides
ngSummit 2017: Angular meets Redux by
ngSummit 2017: Angular meets Redux
Michał Michalczuk
120 views
•
31 slides
Welcome to React & Flux ! by
Welcome to React & Flux !
Ritesh Kumar
548 views
•
28 slides
All the reasons for choosing react js that you didn't know about - Avi Marcus... by
All the reasons for choosing react js that you didn't know about - Avi Marcus...
Codemotion Tel Aviv
2.6K views
•
20 slides
IOS Storyboards by
IOS Storyboards
Muhammad Nabeel Arif
1.5K views
•
24 slides
Intro to AngularJs by
Intro to AngularJs
SolTech, Inc.
536 views
•
37 slides
Similar to Epic Refactorings - Melbourne Cocoaheads June 2011
(20)
React.js - and how it changed our thinking about UI by Marcin Grzywaczewski
React.js - and how it changed our thinking about UI
Marcin Grzywaczewski
•
2.5K views
ngSummit 2017: Angular meets Redux by Michał Michalczuk
ngSummit 2017: Angular meets Redux
Michał Michalczuk
•
120 views
Welcome to React & Flux ! by Ritesh Kumar
Welcome to React & Flux !
Ritesh Kumar
•
548 views
All the reasons for choosing react js that you didn't know about - Avi Marcus... by Codemotion Tel Aviv
All the reasons for choosing react js that you didn't know about - Avi Marcus...
Codemotion Tel Aviv
•
2.6K views
IOS Storyboards by Muhammad Nabeel Arif
IOS Storyboards
Muhammad Nabeel Arif
•
1.5K views
Intro to AngularJs by SolTech, Inc.
Intro to AngularJs
SolTech, Inc.
•
536 views
Why you should consider a microframework for your next web project by Joaquín Muñoz M.
Why you should consider a microframework for your next web project
Joaquín Muñoz M.
•
509 views
Design Patterns in ZK: Java MVVM as Model-View-Binder by Simon Massey
Design Patterns in ZK: Java MVVM as Model-View-Binder
Simon Massey
•
13.3K views
Bringing Swift into your Objective-C Projects by René Cacheaux
Bringing Swift into your Objective-C Projects
René Cacheaux
•
2K views
Reusing your frontend JS on the server with V8/Rhino by Kenneth Kalmer
Reusing your frontend JS on the server with V8/Rhino
Kenneth Kalmer
•
1.1K views
Gitter marionette deck by Mike Bartlett
Gitter marionette deck
Mike Bartlett
•
670 views
iOS storyboard by MinHyeok Kim
iOS storyboard
MinHyeok Kim
•
666 views
React js by Jai Santhosh
React js
Jai Santhosh
•
26.4K views
Android how to hellowidget by Mohammad Ali Raza Siddiqui
Android how to hellowidget
Mohammad Ali Raza Siddiqui
•
1.3K views
Android howto hellowidget by Hiron Das
Android howto hellowidget
Hiron Das
•
492 views
iOS UIStoryboard presentation by Gerald Kim
iOS UIStoryboard presentation
Gerald Kim
•
2K views
Introduction of Xcode by Dhaval Kaneria
Introduction of Xcode
Dhaval Kaneria
•
5K views
Yeoman AngularJS and D3 - A solid stack for web apps by climboid
Yeoman AngularJS and D3 - A solid stack for web apps
climboid
•
16.1K views
CQRS recipes or how to cook your architecture by Thomas Jaskula
CQRS recipes or how to cook your architecture
Thomas Jaskula
•
18K views
KnockOutjs from Scratch by Udaya Kumar
KnockOutjs from Scratch
Udaya Kumar
•
626 views
Recently uploaded
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue
222 views
•
23 slides
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue
103 views
•
23 slides
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue
84 views
•
10 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE
69 views
•
20 slides
Data Integrity for Banking and Financial Services by
Data Integrity for Banking and Financial Services
Precisely
78 views
•
26 slides
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue
79 views
•
17 slides
Recently uploaded
(20)
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue
•
222 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue
•
103 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue
•
84 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE
•
69 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial Services
Precisely
•
78 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue
•
79 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash
•
153 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc
•
160 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue
•
210 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Network Automation Forum
•
50 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue
•
166 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue
•
197 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue
•
144 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook Presentation
Rob McCarty
•
62 views
Uni Systems for Power Platform.pptx by Uni Systems S.M.S.A.
Uni Systems for Power Platform.pptx
Uni Systems S.M.S.A.
•
61 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada
Fwdays
•
53 views
Kyo - Functional Scala 2023.pdf by Flavio W. Brasil
Kyo - Functional Scala 2023.pdf
Flavio W. Brasil
•
449 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue
•
140 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue
•
101 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue
•
88 views
Epic Refactorings - Melbourne Cocoaheads June 2011
1.
epic refactorings and patterns
to make your jesse collis (@sirjec) code awesome luke cunningham (@icaruswings)
2.
firstly, read this
book!
3.
insert a pic
of us reading our books having a ‘lightbulb’ moment we did and it made us better engineers
4.
we do agile...
6.
write the minimum amount
of code to implement the story
7.
12 months later...
8.
1 small card
10.
But that isn’t what
this talk is about
11.
the problem just too
much for one view controller
12.
First Diagram
13.
alright stop! refactor time.
14.
first problem
15.
view controllers need only
worry about standard UIViews and manage the display.
16.
coordination and containment!
17.
ViewCoordinator view lifecycle
18.
@protocol ViewCoordinator <NSObject> -
(UIView *)view; - (void)viewWillAppear; - (void)viewDidAppear; - (void)viewWillDisappear; - (void)viewDidDisappear; - (void)viewDidUnload; - (void)didReceiveMemoryWarning; @end
19.
@interface YourViewController :
UIViewController { id<ViewCoordinator> viewCoordinator_; } ... @end
20.
@implementation YourViewController - (id)initWithNibName...
{ viewCoordinator_ = [[MyViewCoordinator alloc] init]; } - (void)loadView { [super loadView]; [self.view addSubview:[viewCoordinator_ view]]; } - (void)viewWillAppear { [[viewCoordinator_ view] viewWillAppear]; } ... @end
21.
single responsibility a class
should only have one reason to change.
22.
second problem
23.
they’re not simple views
24.
ListCoordinator basic selection callbacks
25.
@protocol ListCoordinator - (void)onSelectListItem:^(id)block; ... @end
26.
@interface YourViewController :
UIViewController { id<ViewCoordinator> viewCoordinator_; id<ViewCoordinator, ListViewCoordinator> listCoordinator_; } ... @end
27.
@implementation YourViewController - (id)initWithNibName...
{ listCoordinator_ = [[MyListCoordinator alloc] init]; [listCoordinator_ onSelectListItem:^(id listing) { [self showListing:listing]; }]; } - (void)showListing:(Listing *)listing;{ ... } ... @end
28.
interface segregation clients should
not be forced to depend on methods they don’t use.
29.
QueryCoordinator after configure/ cancel configure callbacks
30.
SearchBarCoord... and so on...
31.
now our structure is
more like this...
33.
Go to Xcode
34.
under the hood
35.
EventDispatcher
36.
@interface MapCooordinator <ViewCoordinator,
ListCoordinator> { ... } @end
37.
@implementation MapCoordinator ... - (void)onSelectListItem:^(Listing
*)block; { [eventDispatcher_ on:@"select-listing” performWithObject:block]; } - (void)mapView:(... *)mapView didSelectAnnotationView:(... *)view; { Listing *listing = ... find listing ... [eventDispatcher_ fire:@"select-listing" withObject:listing]; } ... @end
38.
there are no special
cases
39.
If you implement patterns
- follow your patterns
40.
Coming in iOS5
41.
thanks, jesse
collis (@sirjec) luke cunningham (@icaruswings)