SlideShare a Scribd company logo
Refactoring
  Jesse Warden
Who?
Who?

• Jesse Warden
Who?

• Jesse Warden
• Web App Solution
Who?

• Jesse Warden
• Web App Solution
• Flex, Java, and BlazeDS Consulting
What?
What?

• Basic Refactoring
What?

• Basic Refactoring
• Priority Pyramid
What?

• Basic Refactoring
• Priority Pyramid
• Stories
What?

• Basic Refactoring
• Priority Pyramid
• Stories
• Leadership
Why?
Why?

• Coding is more fun
Why?

• Coding is more fun
• People like working with you
Why?

• Coding is more fun
• People like working with you
• Grow in your career
Why?

• Coding is more fun
• People like working with you
• Grow in your career
• Better Software
No seriously...
No seriously...

• I loathe it
No seriously...

• I loathe it
• People have said articles helped them
No seriously...

• I loathe it
• People have said articles helped them
• Mentor Leadership / Stewardship
Basics
Basics

• Exceptions
Basics

• Exceptions
• Architecture
Basics

• Exceptions
• Architecture
• Refactoring Paths
Exceptions
Exceptions

• Synchronous: 100%
Exceptions

• Synchronous: 100%
• Asynchronous: 99%
Exceptions

• Synchronous: 100%
• Asynchronous: 99%
• Null Pointers
Synchronous
Synchronous

• throw new Error(“b00m”);
Synchronous

• throw new Error(“b00m”);
• try/catch
Synchronous

• throw new Error(“b00m”);
• try/catch
• “Road to hell is paved with good intentions.”
Asynchronous
Asynchronous

• dispatchEvent(new ErrorEvent(“b00m”));
Asynchronous

• dispatchEvent(new ErrorEvent(“b00m”));
• addEventListener(“b00m”, onHandle);
Asynchronous

• dispatchEvent(new ErrorEvent(“b00m”));
• addEventListener(“b00m”, onHandle);
• Same as before, don’t swallow.
Uncaught
Uncaught

• loaderInfo.uncaughtErrorEvents
Uncaught

• loaderInfo.uncaughtErrorEvents
• won’t always get a stack trace
Uncatchable
Uncatchable


• Error #2044: Unhandled IOErrorEvent:.
  text=Error #2036: Load Never Completed.
Null Pointers
Null Pointers

• Sir Charles Antony Richard Hoare
Null Pointers

• Sir Charles Antony Richard Hoare
• British Computer Scientist
Null Pointers

• Sir Charles Antony Richard Hoare
• British Computer Scientist
• "I call it my billion-dollar mistake"
Null Pointers

• Sir Charles Antony Richard Hoare
• British Computer Scientist
• "I call it my billion-dollar mistake"
• Programmer Enemy #1
Null Pointers
Null Pointers

• Loose Typing
Null Pointers

• Loose Typing
• External Data
ExternalInterface
ExternalInterface

• Marshall Exceptions
ExternalInterface

• Marshall Exceptions
• set to true
Exceptions
Exceptions

• Crashes
Exceptions

• Crashes
• Unexpected/Unrelated Errors
Exceptions

• Crashes
• Unexpected/Unrelated Errors
• Breed Insecurity
Exceptions

• Crashes
• Unexpected/Unrelated Errors
• Breed Insecurity
• Cause Fire Drills
Exceptions
Exceptions

• Best Defense is a Good Offense
Exceptions

• Best Defense is a Good Offense
• Broken Windows
Fighting Back
Fighting Back

• try/catch
Fighting Back

• try/catch
• log the catch
Fighting Back

• try/catch
• log the catch
• log uncaughtErrors
Fighting Back

• try/catch
• log the catch
• log uncaughtErrors
• Code Review
Loose Typing
Loose Typing
• Object
Loose Typing
• Object
• Dictionary
Loose Typing
• Object
• Dictionary
•*
Loose Typing
• Object
• Dictionary
•*
• Dynamic
Loose Typing
• Object
• Dictionary
•*
• Dynamic
• Interfaces
Object
Object

• Protoyping
Object

• Protoyping
• JSON
Object

• Protoyping
• JSON
• Teaching
Object

• Protoyping
• JSON
• Teaching
• delete slots
Object Solution
Object Solution

• Don’t Use Object
Object Solution

• Don’t Use Object
• Ensure casts aren’t null
Object Solution

• Don’t Use Object
• Ensure casts aren’t null
• Same for Dynamic & Interface
Dictionary
Dictionary

• Easier lookups vs. ByteArray
Dictionary

• Easier lookups vs. ByteArray
• Strict Equality on Keys
Dictionary Solution
Dictionary Solution


• Wrap
Star
Star


•*
Star Solution
Star Solution

• Don’t Use It
Star Solution

• Don’t Use It
• Log It
Star Solution

• Don’t Use It
• Log It
• Ensure Consumers Guard
External Data
External Data

• Factories
External Data

• Factories
• Value Object / Data Transfer Object
External Data

• Factories
• Value Object / Data Transfer Object
• Parsing
Parsing
Parsing

• Poison Entire System
Parsing

• Poison Entire System
• When in doubt, return null
Parsing

• Poison Entire System
• When in doubt, return null
• Proactive: throw meaningful error
Parsing

• Poison Entire System
• When in doubt, return null
• Proactive: throw meaningful error
• Uber Proactive: Unit Test
Parsing
Parsing


• Holy S$*(%&: Null Pattern
Architecture
Architecture

• Encapsulation
Architecture

• Encapsulation
• Testability
Encapsulation
Encapsulation

• Black Box
Encapsulation

• Black Box
• Manages its own internal state
Bad Encapsulation
Bad Encapsulation

• Global Variables / Singletons
Bad Encapsulation

• Global Variables / Singletons
• No Accessors/API for Data Models
Bad Encapsulation

• Global Variables / Singletons
• No Accessors/API for Data Models
• No API so you dig
Testability
Testability

• Easy to test
Testability

• Easy to test
• not welded together
Testability

• Easy to test
• not welded together
• not spaghetti code
Services
Services

• Service Inside the Proxy
Services

• Service Inside the Proxy
• Not a service, just a loader
Services

• Service Inside the Proxy
• Not a service, just a loader
• No centralized error reporting
Service Solutions
Service Solutions

• Create a base class
Service Solutions

• Create a base class
• log all errors
Service Solutions

• Create a base class
• log all errors
• create an integration suite
Big Ole’ Commands
Big Ole’ Commands


• switch
Refactoring Paths
Refactoring Paths

• What do you build now?
Refactoring Paths

• What do you build now?
• What do you change to later?
Refactoring Paths

• What do you build now?
• What do you change to later?
• When?
Refactoring Paths

• What do you build now?
• What do you change to later?
• When?
• Not Architecting
Refactoring Path
Refactoring Path

Ability to code now, satisfy non-programmers
for trust earning, with assurance you haven’t
coded yourself into a corner.
Marriage
Marriage


Compromise
Refactoring RIA Unleashed 2011
Good Book
It’s Ok. It’ll Be Ok.
It’s Ok. It’ll Be Ok.

• Lose some battles...
It’s Ok. It’ll Be Ok.

• Lose some battles...
• ...as long as you win the war.
Detractors
Detractors

• Don’t have their Poetic License
Detractors

• Don’t have their Poetic License
• Fear
Detractors

• Don’t have their Poetic License
• Fear
• Understand the Rules & Ramifications
Detractors
Detractors

• Ivory Zealots
Detractors

• Ivory Zealots
• Scars
Detractors

• Ivory Zealots
• Scars
• Don’t Believe in their Refactoring Ability
Detractors

• Ivory Zealots
• Scars
• Don’t Believe in their Refactoring Ability
• or Yours
Refactoring Paths
Refactoring Paths

• Refactoring is Temporal
Refactoring Paths

• Refactoring is Temporal
• Architecture is not
Refactoring Paths

• Refactoring is Temporal
• Architecture is not
• Architecture is Plan
Refactoring Paths

• Refactoring is Temporal
• Architecture is not
• Architecture is Plan
• Refactoring is a Strategy
Refactoring Path
Refactoring Path

• Know the rule(s) ur breaking
Refactoring Path

• Know the rule(s) ur breaking
• do it
Refactoring Path

• Know the rule(s) ur breaking
• do it
• document what needs to change
Refactoring Path

• Know the rule(s) ur breaking
• do it
• document what needs to change
• when you have time, fix it
Refactoring Paths
Refactoring Paths

• Use a *
Refactoring Paths

• Use a *
• Cast It
Refactoring Paths
Refactoring Paths

• Make an Object
Refactoring Paths

• Make an Object
• Make a ValueObject
Refactoring Path
Refactoring Path


• Event with public var data:*;
Refactoring Path
Refactoring Path

• Scouting
Refactoring Path

• Scouting
• Bear Bait
Refactoring Path

• Scouting
• Bear Bait
• Intentional Parsing Throws
Refactoring Path

• Scouting
• Bear Bait
• Intentional Parsing Throws
• Intentional Grenades
Refactoring Path
Refactoring Path
• if if if if if if
Refactoring Path
• if if if if if if
• then then then then
Refactoring Path
• if if if if if if
• then then then then
• badger badger badger badger
Refactoring Path
• if if if if if if
• then then then then
• badger badger badger badger
• make a switch
Refactoring Path
• if if if if if if
• then then then then
• badger badger badger badger
• make a switch
• make functions
Refactoring Paths
Refactoring Paths

• <s:Component> vs Item Renderer
Refactoring Paths

• <s:Component> vs Item Renderer
• Passive
Priority Pyramid
Priority Pyramid
1. Report
Priority Pyramid
1. Report
2. Understanding
Priority Pyramid
1. Report
2. Understanding
3. Trust
Priority Pyramid
1. Report
2. Understanding
3. Trust
4. Lead
Priority Pyramid
Priority Pyramid
5. Build
Priority Pyramid
5. Build
6. Explosions
Priority Pyramid
5. Build
6. Explosions
7. Diagnostics
Priority Pyramid
5. Build
6. Explosions
7. Diagnostics
8. Architecture
Priority Pyramid
5. Build
6. Explosions
7. Diagnostics
8. Architecture
9. Workflow
Pyramid: Report
Pyramid: Report

• Who is my boss?
Pyramid: Report

• Who is my boss?
• What will make you happy when I leave?
Pyramid: Understanding
Pyramid: Understanding

• Listen
Pyramid: Understanding

• Listen
• What’s the True Goal?
Pyramid: Understanding

• Listen
• What’s the True Goal?
• What are the problems?
Pyramid: Understanding

• Listen
• What’s the True Goal?
• What are the problems?
• What are the challenges?
Pyramid: Understanding
Pyramid: Understanding

• Explore & Document
Pyramid: Understanding

• Explore & Document
 • Learn Data Model
Pyramid: Understanding

• Explore & Document
 • Learn Data Model
 • Learn Framework
Pyramid: Understanding

• Explore & Document
 • Learn Data Model
 • Learn Framework
 • Understanding the Story
Pyramid: Understanding
Pyramid: Understanding


 • Looking for Red Flags
Pyramid: Understanding


 • Looking for Red Flags
 • Looking for Mines
Pyramid: Understanding


 • Looking for Red Flags
 • Looking for Mines
 • Looking for Validation
Pyramid: Understanding
Pyramid: Understanding


 • Dissect People
Pyramid: Understanding


 • Dissect People
 • What makes them tick?
Pyramid: Understanding


 • Dissect People
 • What makes them tick?
 • Who listens to who?
Pyramid: Trust
Pyramid: Trust

• Make Friends
Pyramid: Trust

• Make Friends
• Provide Immediate Value
Pyramid: Trust
Pyramid: Trust

• Check in code into source control 1st week
Pyramid: Trust

• Check in code into source control 1st week
• fix a problem
Pyramid: Trust

• Check in code into source control 1st week
• fix a problem
• Only get 1 change at 1st impression
Pyramid: Trust

• Check in code into source control 1st week
• fix a problem
• Only get 1 change at 1st impression
• Under Promise, Over Deliver
Pyramid: Trust
Pyramid: Trust

• Stop Fire Drills
Pyramid: Trust

• Stop Fire Drills
• Empower Through Diagnostic Tools
Pyramid: Trust

• Stop Fire Drills
• Empower Through Diagnostic Tools
• Easy to use, visible logger
Pyramid: Trust

• Stop Fire Drills
• Empower Through Diagnostic Tools
• Easy to use, visible logger
• Easy to use, visible environment info
Pyramid: Trust
Pyramid: Trust

• Update on Direction
Pyramid: Trust

• Update on Direction
• Provide Transparency
Pyramid: Trust

• Update on Direction
• Provide Transparency
• What, why, and when
Pyramid: Trust

• Update on Direction
• Provide Transparency
• What, why, and when
• Plan A, Plan B
Pyramid: Lead
Pyramid: Lead

• Be Positive
Pyramid: Lead

• Be Positive
• Short Term Goals
Pyramid: Lead

• Be Positive
• Short Term Goals
• Long Term Goals
Pyramid: Lead
Pyramid: Lead

• Plan
Pyramid: Lead

• Plan
• 1 thing at a time
Pyramid: Lead

• Plan
• 1 thing at a time
• Assess Problems
Pyramid: Lead

• Plan
• 1 thing at a time
• Assess Problems
• Document
Pyramid: Lead
Pyramid: Lead


• Re-prioritize as needed
Pyramid: Lead
Pyramid: Lead

• Delegate
Pyramid: Lead

• Delegate
• Help
Pyramid: Lead

• Delegate
• Help
• Divide & Conquer
Pyramid: Lead

• Delegate
• Help
• Divide & Conquer
• Short Term Branches: 3 days
Experiences
Refactoring RIA Unleashed 2011
Hearts & Minds
Refactoring RIA Unleashed 2011
Fight Only to Win
Refactoring RIA Unleashed 2011
People on Pedestals
Refactoring RIA Unleashed 2011
Idle Hands
Winston Wolfe
    [show video]
      [dissect]
Conclusions
Conclusions

• Exceptions: Catch & Log
Conclusions

• Exceptions: Catch & Log
• Refactoring: Remember The Paths
Conclusions

• Exceptions: Catch & Log
• Refactoring: Remember The Paths
• Listen, Build Trust, and Lead
Thank You! Questions?
Thank You! Questions?

 Jesse Warden
Thank You! Questions?

 Jesse Warden
 webappsolution.com
Thank You! Questions?

 Jesse Warden
 webappsolution.com
 jessewarden.com
Thank You! Questions?

 Jesse Warden
 webappsolution.com
 jessewarden.com
 @jesterxl

More Related Content

KEY
Testing gone-right
ZIP
Forget The ORM!
KEY
Irb Tips and Tricks
KEY
Social dev camp_2011
PDF
Plone for Education: Bibliographies
PDF
Funtional Ruby - Mikhail Bortnyk
PPTX
Adopting Elixir in a 10 year old codebase
KEY
Project Tools in Web Development
Testing gone-right
Forget The ORM!
Irb Tips and Tricks
Social dev camp_2011
Plone for Education: Bibliographies
Funtional Ruby - Mikhail Bortnyk
Adopting Elixir in a 10 year old codebase
Project Tools in Web Development

What's hot (15)

KEY
Becoming a more productive Rails Developer
KEY
LEMON - On Drupal diseases and cures
PDF
Different ways of integrating React into Rails - Mikhail Bortnyk
KEY
LeanStartup:Research is cheaper than development
PDF
Interconnected gear pieces smart arts process 6 stages style 1 powerpoint pr...
KEY
Doing cool stuff with WordPress
PPTX
Selfish Accessibility — WordCamp Europe 2017
KEY
Becoming a more Productive Rails Developer
PPTX
Introduction to python
PDF
Japanese CloudSearch Use-Cases and Tech Deep Dive
PDF
prdc10-tdd-patterns
PDF
CodeCamp 2012-mvc-vs-ror-2
PDF
PRDC-ror-trilogy-part1
PDF
Ruby Masters 2011
KEY
Developing With Django
Becoming a more productive Rails Developer
LEMON - On Drupal diseases and cures
Different ways of integrating React into Rails - Mikhail Bortnyk
LeanStartup:Research is cheaper than development
Interconnected gear pieces smart arts process 6 stages style 1 powerpoint pr...
Doing cool stuff with WordPress
Selfish Accessibility — WordCamp Europe 2017
Becoming a more Productive Rails Developer
Introduction to python
Japanese CloudSearch Use-Cases and Tech Deep Dive
prdc10-tdd-patterns
CodeCamp 2012-mvc-vs-ror-2
PRDC-ror-trilogy-part1
Ruby Masters 2011
Developing With Django
Ad

Viewers also liked (8)

PDF
Webcast: Asynchronous Programming Demystified
PPTX
Asynchronous programming
PPT
Code Refactoring
PDF
Refactor your Java EE application using Microservices and Containers - Arun G...
PDF
Refactoring 101
PDF
Refactoring - An Introduction
PPT
Refactoring Tips by Martin Fowler
PDF
Refactoring: Improve the design of existing code
Webcast: Asynchronous Programming Demystified
Asynchronous programming
Code Refactoring
Refactor your Java EE application using Microservices and Containers - Arun G...
Refactoring 101
Refactoring - An Introduction
Refactoring Tips by Martin Fowler
Refactoring: Improve the design of existing code
Ad

Similar to Refactoring RIA Unleashed 2011 (20)

KEY
No Show 2012 - Heather Decker-Davis and Luke Dicken - Procedural Processes
KEY
WebGL Camp 4 - A3 3D Engine
KEY
Austin NoSQL 2011-07-06
KEY
The business case for contributing code
PPTX
My Little Webap - DevOpsSec is Magic
PDF
Why puppet? Why now?
PDF
Tackling Testing Telephony
PDF
Functional Ruby
KEY
Trending with Purpose
PDF
3 years with Clojure
PPT
'An Evolution Into Specification By Example' by Adam Knight
PDF
Cloud conference - mongodb
KEY
In-house web automation?
KEY
Xtext Best Practices
PPT
Domain Driven Design Demonstrated
KEY
Tweakers Anonymous
PDF
TDC2016SP - Otimização Prematura: a Raíz de Todo o Mal
PDF
My Parents Configured Their Living Room
KEY
onGameStart
PDF
6 reasons Jubilee could be a Rubyist's new best friend
No Show 2012 - Heather Decker-Davis and Luke Dicken - Procedural Processes
WebGL Camp 4 - A3 3D Engine
Austin NoSQL 2011-07-06
The business case for contributing code
My Little Webap - DevOpsSec is Magic
Why puppet? Why now?
Tackling Testing Telephony
Functional Ruby
Trending with Purpose
3 years with Clojure
'An Evolution Into Specification By Example' by Adam Knight
Cloud conference - mongodb
In-house web automation?
Xtext Best Practices
Domain Driven Design Demonstrated
Tweakers Anonymous
TDC2016SP - Otimização Prematura: a Raíz de Todo o Mal
My Parents Configured Their Living Room
onGameStart
6 reasons Jubilee could be a Rubyist's new best friend

More from Jesse Warden (7)

PDF
System webpack-jspm
PDF
Angular 2 overview
PDF
Technical debt in space jesse warden - 100yss 2015
KEY
Mobile Gaming: Corona SDK & Adobe AIR RIA Unleashed 2011
KEY
Getting Complex Designs into Flex - FITC 2011
PDF
How to Launch a Small Software Product
PPT
Robotlegs on Top of Gaia
System webpack-jspm
Angular 2 overview
Technical debt in space jesse warden - 100yss 2015
Mobile Gaming: Corona SDK & Adobe AIR RIA Unleashed 2011
Getting Complex Designs into Flex - FITC 2011
How to Launch a Small Software Product
Robotlegs on Top of Gaia

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Encapsulation theory and applications.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Advanced methodologies resolving dimensionality complications for autism neur...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Refactoring RIA Unleashed 2011

Editor's Notes