SlideShare a Scribd company logo
1 of 14
GOOD++
Practices for maintainable software from the trenches
RitchieAnnand
Who the heck are you?
 I’ve been coding since 1981
 My biggest project ran from 1993-2012
 Took it from single-user desktop to web with
minimal migrations of solutions
 Worked with numerous authentication, database,
communication and plugin technologies
 When a project runs for 16 years, there’s no
running from your mistakes!
 NO ESCAPE! AAAA!
 These significantly improved the project
Improve your development
with these weird tips!
 Prefer enumerations
 Trigger on three
 Fail fast
 Hide expertise
 Question oddities
 Pass secrets
 Create contracts
 Provide context
 Believe your eyes
 Sidestep horrors
Local developers make their
code future-proof using
these weird old tricks!
Consultants hate them… or
something!
Prefer enumerations
 Constructors and methods can devolve into
boolean-fests sometimes
new Shadow(shape, true, true, false, true,
false);
 Enumerations are faster for reading and
preventing accidents in parameters
new Shadow(shape, ShadowBlur.NO,
ShapeActive.ACTIVE, ShadowAtmosphere.NO,
ShadowColorAffected.YES, shadowDebugMode);
|
Trigger on three
 For uncomplicated things
 If you need to duplicate a call, just do it
 Transforming to share code vs duplicating code
 If you have three or more, refactor it out
 You should see some commonalities with three
 For complicated things
 Refactor it now
 Not just for you, but to stave off copy-paste in the
future
./
Fail fast
 Explode on unexpected states
 Defect detectors
 Lock state detectors
 Reduces the number of states to worry about
 Avoids
 Creeping alternate paths
 Invalid cases laying in wait
 Brain overload when debugging
..-
!
Hide expertise
 Wrap domain-specific knowledge in a system
 Not everyone knows all about graphics, threading,
matrix math, databases or scheduling
 The nasty details should be hidden from the
calling code
 Exposed nasty details can stop you from switching
or even upgrading technologies
 Spreading knowledge around is good for
developers but bad for code
 You may be surprised at how much you forget
...
Question oddities
 The fact that code exists only guarantees
 “I work most of the time with the values actually
given to me, if indeed I am actually called”
 No guarantee of robustness
 No guarantee of correctness
 No guarantee of good practices
 Stands on its own merits
 “What is it doing that for?”
 “How did this ever work?”
....|
???
Pass secrets
 Associated classes and an ignorant middle
 The middle should be ignorant of the specifics
 Casting when dealing with a known object is just
fine
 For example
 Properties and property editors
 Engine configuration and engines
 Data requests and databases
 Graphic scenes and graphic engines
...../
Create contracts
 Interfaces constrain you to good practices
 Hiding implementation
 Easy substitution
 Allow easier interception, delegation, chaining
 Allow easier test objects
 Base class implementation
 Inheriting shields against interface additions
 Gives default implementations
 Does not complicate delegation and testing
......-
Provide context
 Context objects for setup and processing
 Parameter lists are not polymorphic; classes are
 Context objects can handle the defaults instead of
cascading methods
int myMethod(boolean a)
int myMethod(boolean a, String b)
int myMethod(boolean a, String b, Matrix4f c)
 Can help resist global variables or awkward
fetches
.......
Believe your eyes (and logs)
 Errors that happen do have causes
 We may mentally skip over functions that look
“built-in” or “fundamental”
 Code may not be as protected or well-timed as we
might believe
 Insisting that it’s impossible is ultimately unhelpful
 Provoke race conditions with delays
 Reducing possible states is key
 Beta test fast fails if possible
........|
Sidestep horrors
 An alternative to total rewrites or suffering
 Refactor where you can
 Encapsulate new things the right way (and then
call them the old way if necessary)
 Add calls to or placeholders for alternate methods
 Add code applicable to a new system x old class
 Inversion of control: look up code elsewhere
 Expert level: aspects and APIs
........./
Qanda
 The mysterious land of Qanda
 This Qandaian ritual of question and answers
shall begin!

More Related Content

Similar to Good++

The "Evils" of Optimization
The "Evils" of OptimizationThe "Evils" of Optimization
The "Evils" of Optimization
BlackRabbitCoder
 
4.Security Assessment And Testing
4.Security Assessment And Testing4.Security Assessment And Testing
4.Security Assessment And Testing
phanleson
 
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
Nick Galbreath
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)
guestebde
 
Cracking the coding interview u penn - sept 30 2010
Cracking the coding interview   u penn - sept 30 2010Cracking the coding interview   u penn - sept 30 2010
Cracking the coding interview u penn - sept 30 2010
careercup
 
BsidesLVPresso2016_JZeditsv6
BsidesLVPresso2016_JZeditsv6BsidesLVPresso2016_JZeditsv6
BsidesLVPresso2016_JZeditsv6
Rod Soto
 

Similar to Good++ (20)

The "Evils" of Optimization
The "Evils" of OptimizationThe "Evils" of Optimization
The "Evils" of Optimization
 
4.Security Assessment And Testing
4.Security Assessment And Testing4.Security Assessment And Testing
4.Security Assessment And Testing
 
Availability in a cloud native world v1.6 (Feb 2019)
Availability in a cloud native world v1.6 (Feb 2019)Availability in a cloud native world v1.6 (Feb 2019)
Availability in a cloud native world v1.6 (Feb 2019)
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons Learned
 
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
Fraud Engineering, from Merchant Risk Council Annual Meeting 2012
 
10 Ways To Improve Your Code( Neal Ford)
10  Ways To  Improve  Your  Code( Neal  Ford)10  Ways To  Improve  Your  Code( Neal  Ford)
10 Ways To Improve Your Code( Neal Ford)
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
Software Security : From school to reality and back!
Software Security : From school to reality and back!Software Security : From school to reality and back!
Software Security : From school to reality and back!
 
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
Session - Debugging memory stomps and other atrocities - Stefan Reinalter - T...
 
Matlab for a computational PhD
Matlab for a computational PhDMatlab for a computational PhD
Matlab for a computational PhD
 
Is your Automation Infrastructure ‘Well Architected’?
Is your Automation Infrastructure ‘Well Architected’?Is your Automation Infrastructure ‘Well Architected’?
Is your Automation Infrastructure ‘Well Architected’?
 
Hexagonal Symfony - SymfonyCon Amsterdam 2019
Hexagonal Symfony - SymfonyCon Amsterdam 2019Hexagonal Symfony - SymfonyCon Amsterdam 2019
Hexagonal Symfony - SymfonyCon Amsterdam 2019
 
Performance By Design
Performance By DesignPerformance By Design
Performance By Design
 
100% Code Coverage in Real World Software
100% Code Coverage in Real World Software100% Code Coverage in Real World Software
100% Code Coverage in Real World Software
 
Security for AWS : Journey to Least Privilege (update)
Security for AWS : Journey to Least Privilege (update)Security for AWS : Journey to Least Privilege (update)
Security for AWS : Journey to Least Privilege (update)
 
Security for AWS: Journey to Least Privilege
Security for AWS: Journey to Least PrivilegeSecurity for AWS: Journey to Least Privilege
Security for AWS: Journey to Least Privilege
 
Cracking the coding interview u penn - sept 30 2010
Cracking the coding interview   u penn - sept 30 2010Cracking the coding interview   u penn - sept 30 2010
Cracking the coding interview u penn - sept 30 2010
 
BsidesLVPresso2016_JZeditsv6
BsidesLVPresso2016_JZeditsv6BsidesLVPresso2016_JZeditsv6
BsidesLVPresso2016_JZeditsv6
 
PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning" PyData 2015 Keynote: "A Systems View of Machine Learning"
PyData 2015 Keynote: "A Systems View of Machine Learning"
 
How to Build a Pure Evil Magento Module
How to Build a Pure Evil Magento ModuleHow to Build a Pure Evil Magento Module
How to Build a Pure Evil Magento Module
 

Recently uploaded

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Good++

  • 1. GOOD++ Practices for maintainable software from the trenches RitchieAnnand
  • 2. Who the heck are you?  I’ve been coding since 1981  My biggest project ran from 1993-2012  Took it from single-user desktop to web with minimal migrations of solutions  Worked with numerous authentication, database, communication and plugin technologies  When a project runs for 16 years, there’s no running from your mistakes!  NO ESCAPE! AAAA!  These significantly improved the project
  • 3. Improve your development with these weird tips!  Prefer enumerations  Trigger on three  Fail fast  Hide expertise  Question oddities  Pass secrets  Create contracts  Provide context  Believe your eyes  Sidestep horrors Local developers make their code future-proof using these weird old tricks! Consultants hate them… or something!
  • 4. Prefer enumerations  Constructors and methods can devolve into boolean-fests sometimes new Shadow(shape, true, true, false, true, false);  Enumerations are faster for reading and preventing accidents in parameters new Shadow(shape, ShadowBlur.NO, ShapeActive.ACTIVE, ShadowAtmosphere.NO, ShadowColorAffected.YES, shadowDebugMode); |
  • 5. Trigger on three  For uncomplicated things  If you need to duplicate a call, just do it  Transforming to share code vs duplicating code  If you have three or more, refactor it out  You should see some commonalities with three  For complicated things  Refactor it now  Not just for you, but to stave off copy-paste in the future ./
  • 6. Fail fast  Explode on unexpected states  Defect detectors  Lock state detectors  Reduces the number of states to worry about  Avoids  Creeping alternate paths  Invalid cases laying in wait  Brain overload when debugging ..- !
  • 7. Hide expertise  Wrap domain-specific knowledge in a system  Not everyone knows all about graphics, threading, matrix math, databases or scheduling  The nasty details should be hidden from the calling code  Exposed nasty details can stop you from switching or even upgrading technologies  Spreading knowledge around is good for developers but bad for code  You may be surprised at how much you forget ...
  • 8. Question oddities  The fact that code exists only guarantees  “I work most of the time with the values actually given to me, if indeed I am actually called”  No guarantee of robustness  No guarantee of correctness  No guarantee of good practices  Stands on its own merits  “What is it doing that for?”  “How did this ever work?” ....| ???
  • 9. Pass secrets  Associated classes and an ignorant middle  The middle should be ignorant of the specifics  Casting when dealing with a known object is just fine  For example  Properties and property editors  Engine configuration and engines  Data requests and databases  Graphic scenes and graphic engines ...../
  • 10. Create contracts  Interfaces constrain you to good practices  Hiding implementation  Easy substitution  Allow easier interception, delegation, chaining  Allow easier test objects  Base class implementation  Inheriting shields against interface additions  Gives default implementations  Does not complicate delegation and testing ......-
  • 11. Provide context  Context objects for setup and processing  Parameter lists are not polymorphic; classes are  Context objects can handle the defaults instead of cascading methods int myMethod(boolean a) int myMethod(boolean a, String b) int myMethod(boolean a, String b, Matrix4f c)  Can help resist global variables or awkward fetches .......
  • 12. Believe your eyes (and logs)  Errors that happen do have causes  We may mentally skip over functions that look “built-in” or “fundamental”  Code may not be as protected or well-timed as we might believe  Insisting that it’s impossible is ultimately unhelpful  Provoke race conditions with delays  Reducing possible states is key  Beta test fast fails if possible ........|
  • 13. Sidestep horrors  An alternative to total rewrites or suffering  Refactor where you can  Encapsulate new things the right way (and then call them the old way if necessary)  Add calls to or placeholders for alternate methods  Add code applicable to a new system x old class  Inversion of control: look up code elsewhere  Expert level: aspects and APIs ........./
  • 14. Qanda  The mysterious land of Qanda  This Qandaian ritual of question and answers shall begin!