itb2016 best practices are best except when they are not
TRANSCRIPT
Best Practices Are Best...Except When They're Not
Nolan Erck
Obligatory “About Me” Stuff
Chief Consultant / Owner, South Of Shasta
Stuff: ColdFusion, C/C++, PHP, WordPress,Android, jQuery, Ruby, .NET, AngularJS,On-site Training, etc.
SacInteractive Co-Manager
Reformed video game developer
Music junkie
Today's Agenda
What is a “Best Practice”?
An Explanation of “Technical Debt”
Sometimes I've Had to Break The Rules
How To Fix Things Later
Other Resources
Questions? Ask'em!
This might turn into a “round table”discussion.
That's Okay.
I'll “moderate” if need be.
I run a consulting business
Often includes taking over legacy projects.
Can't always rebuild from scratch.
Have to make decisions.
Developers are paid to solve problems
Does the client care how I solve it?
What can I fix, given the resourceconstraints?
I run a consulting business
Some factors to consider:
– Being able to draw a line in the sand.
– Good. Cheap. Quick.● Pick two.
– The 80/20 Rule.
I run a consulting business
Make it work now and make it elegant inversion 2 if need be.
Don't Let Perfect Be The Enemy Of Good
What is a “Best Practice”?
Google says this:
Commercial or professional procedures thatare accepted or prescribed as being corrector most effective.
What is a Best Practice?
But it is still a practice
The practice of medicine
Because sometimes...it's wrong
What is a Best Practice?
● Today's “Best Practice” is tomorrow's “BadIdea”.
● Best Practices sometimes come and goquickly.
● Good Practices might be better than BestPractices sometimes.
What is a Best Practice?
Your mileage may vary – deadlines are real
Client doesn't care what's recommended
Just want it how they want it
StackOverflow: “Well I would never do itTHAT way!”
Reality: sometimes you HAVE to do it
THAT way
What is “Technical Debt”?
No project is perfect
Shortcuts are sometimes inevitable
Shortcuts cause “Technical Debt”
What is “Technical Debt”?
A dam has a leak.
Can stick a finger in the leak.
Eventually you run out of fingers.
Remove the brick and replace it.
StackOverflow: Well, I would never do itthat way!
These are the times that I had to do it that way.
Some real-world bad situations
When might you use CFML
Instead of CFScript?
When the client demands the ability tochange HTML in the source code via FTP
...in Production!
ColdFusion: When I used CFForm/CFSelecton a recent project
...and it was the right thing to do
When an open source MVC framework
wasn't the right answer
and “rolling my own” framework
was the correct decision
Is emailing errors to the team always abad idea?
No.
When the problem isn't in code
So... my hands are completely tied and Ihave to change all of the URL strings thatare passed with "Alter" in them (of whichthere are many) to "altr".
– Poor guy on a Google forum, recently
When the problem isn't in code
Find a stakeholder, outside of IT
Communicate the issue– In a non-technical way
– Users have a lesser experience
– Magic phrase: “Lower click-thru rate”
– Magic phrase: “Lower conversion rate”
How To Fix Things Later
Bootstrap – “works” fine in table-based websites. Minor
side-effects, nothing crazy.
jQuery – can just “sit there” for later.
LESS / SASS – to refactor old CSS.
How To Fix Things Later
Source Control.
Task tracking / ticket systems.
Testing tools.
Tools for automating.
“I don't have time”.
– 30 minutes a day works wonders!Seriously.
How To Fix Things Later
Don't be afraid to ask questions
Post on Google Groups, StackOverflow, whatever.
Talk to people at the conference!
How To Fix Things Later
“But when I post on StackOverflow, I getyelled at for doing it wrong!”
Senior Developer != Great Communicator
<rant>”how to ask questions”</rant>
Other Resources
JoelOnSoftware.com
Ben Nadel's blog
“Secrets of the Rockstar Programmers”
“Head First Java”
“Head First Design Patterns”
Any “Head First” books, really.
Questions? Comments?
Email: [email protected]
Twitter: @southofshasta
Blog: southofshasta.com/blog
Do you need a consultant for a project? :)
Thanks!
Best Practices Are Best...Except When They're Not
Nolan Erck
Obligatory “About Me” Stuff
Chief Consultant / Owner, South Of Shasta
Stuff: ColdFusion, C/C++, PHP, WordPress,Android, jQuery, Ruby, .NET, AngularJS,On-site Training, etc.
SacInteractive Co-Manager
Reformed video game developer
Music junkie
18 years software development
Chief Consultant / Owner, South Of Shasta
Consulting for 7 yearsTeach classes.
Stuff: ColdFusion, C/C++, PHP, WordPress,Android, jQuery, Ruby, .NET, AngularJS, etc.
SacInteractive Co-Manager (formerly Sacramento CFUG)
Reformed video game dev – Lucas, Maxis
Music junkie
Today's Agenda
What is a “Best Practice”?
An Explanation of “Technical Debt”
Sometimes I've Had to Break The Rules
How To Fix Things Later
Other Resources
Questions? Ask'em!
This might turn into a “round table”discussion.
That's Okay.
I'll “moderate” if need be.
I run a consulting business
Often includes taking over legacy projects.
Can't always rebuild from scratch.
Have to make decisions.
Developers are paid to solve problems
Does the client care how I solve it?
What can I fix, given the resourceconstraints?
I run a consulting business
Some factors to consider:
– Being able to draw a line in the sand.
– Good. Cheap. Quick.● Pick two.
– The 80/20 Rule.
Being able to draw a line in the sand.A skill I struggle with.
When is “good enough” truly “good enough” but won'tcome back to bite me (at least not SOON)?
I run a consulting business
Make it work now and make it elegant inversion 2 if need be.
Don't Let Perfect Be The Enemy Of Good
What is a “Best Practice”?
Google says this:
Commercial or professional procedures thatare accepted or prescribed as being corrector most effective.
What is a Best Practice?
But it is still a practice
The practice of medicine
Because sometimes...it's wrong
What is a Best Practice?
● Today's “Best Practice” is tomorrow's “BadIdea”.
● Best Practices sometimes come and goquickly.
● Good Practices might be better than BestPractices sometimes.
What is a Best Practice?
Your mileage may vary – deadlines are real
Client doesn't care what's recommended
Just want it how they want it
StackOverflow: “Well I would never do itTHAT way!”
Reality: sometimes you HAVE to do it
THAT way
What is “Technical Debt”?
No project is perfect
Shortcuts are sometimes inevitable
Shortcuts cause “Technical Debt”
Working on a project, come across a bug/change you need to make.
The “best practice” might involve adding a “big chunk” of code
(relatively speaking). (i.e. updating to a new version of a 3rd partylibrary, making reconfiguring how some old functions work, maybe allof the above.)
The deadline is approaching, or the client is getting antsy (same thing).So you throw a “short cut” into the code – maybe hack a “global”variable or 2 into the code to get it DONE now.
Short term: that might work fine.
Longer term: you've incurred some “technical debt” into the application.Taking a “loan” out at the bank; eventually that loan has to be paid
back.
What is “Technical Debt”?
A dam has a leak.
Can stick a finger in the leak.
Eventually you run out of fingers.
Remove the brick and replace it.
If a dam springs a leak, we can
a) stick our finger in the hole (quick) – technical debt
you eventually run out of fingers!
b) remove the offending brick, rebuild a better, stronger one.
Might take more time, but is better long-term decision.
StackOverflow: Well, I would never do itthat way!
These are the times that I had to do it that way.
Some real-world bad situations
Stuff happens.
The following are true stories from different projectsI've worked on.
In which the “best practice” wasn't a viable option.
When might you use CFML
Instead of CFScript?
Site was under source control (good).Client knew how to hand edit small bits of HTML (links, bold,
underline, new paragraphs of verbiage, etc).Did not want to change his work flow. Refused.This is the guy signing the checks and approving my budgets.You can't always just say “no, that's not a best practice”.Solution: installed Git on the server. Created a link that ran a BAT file, doing a “git commit” for recent
changes.Could run this script periodically on Production.Or client could run it to let me know he was finished changing
things (i.e. just click this link when you're done making edits.)Yes, we are changing code on Production. No I'm not happy about it.And neither are the StackOverflows....but the guy approving the budgets was.(and everything got added to source control...eventually)
Longer term: he needed a WYSIWYG and some changes to theapp, but this worked for now, and we finished the app!
When the client demands the ability tochange HTML in the source code via FTP
...in Production!
Site was under source control (good).Client knew how to hand edit small bits of HTML (links, bold,
underline, new paragraphs of verbiage, etc).Did not want to change his work flow. Refused.This is the guy signing the checks and approving my budgets.You can't always just say “no, that's not a best practice”.Solution: installed Git on the server. Created a link that ran a BAT file, doing a “git commit” for recent
changes.Could run this script periodically on Production.Or client could run it to let me know he was finished changing
things (i.e. just click this link when you're done making edits.)Yes, we are changing code on Production. No I'm not happy about it.And neither are the StackOverflows....but the guy approving the budgets was.(and everything got added to source control...eventually)
Longer term: he needed a WYSIWYG and some changes to theapp, but this worked for now, and we finished the app!
ColdFusion: When I used CFForm/CFSelecton a recent project
...and it was the right thing to do
US Post office
when you’ve got 2 DAYS to train 3 NON-developerson how to maintain a ColdFusion applicaitonalready in place….taht’s already using CFForm,CFSelect etc.
They had ZERO coding experience
But Dreamweaver made sense and “clicked” forthem.
Is it REALLY the best solution to try and teach themOO and Model-Glue in a position like that?Probably not.
When an open source MVC framework
wasn't the right answer
and “rolling my own” framework
was the correct decision
Large scale web app for the semi-conductor industry.Had quickly approaching deadlines (conf's and client
demos).Leadership gave me a budget for 3 junior developers(I “inherited” the team.)2 junior web guys1 retired Fortran / Assembly developer
...but they all knew what XML was and how it worked.Teaching 3 people OO + MVC + Mach-ii would have taken
lots of time.Instead, we wrote a DSL in XML. The junior devs could help “describe” the different pieces of
the app in XML and tell me what they needed thelanguage to do.
I wrote the DSL “engine”(which actually was OO, just not at the level the junior dev's
cared about.)
Is emailing errors to the team always abad idea?
No.
Fusion. Non-technical clientsNO idea what happens on their serverShowing them a bar graph of “bad IIS requests per hour
that hit the ColdFusion connector via HTTP” (or somesuch thing) wouldn’t have added any VALUE to the team
But the team lives and dies by email.So we set up a simple onError() that emailed myself (IT)
and 2 others on the leadership team.
Short term -- immediately increased IT budget to get theserver under better control (it was throwing a LOT oferrors and getting more traffic than they realized).
Longer term -- the non-techie guys (that were in charge ofthe MONEY) started thinking about forward planning, andmaybe it was time to rebuild these apps so the code wasfresher, had better browser/mobile support etc.
When the problem isn't in code
So... my hands are completely tied and Ihave to change all of the URL strings thatare passed with "Alter" in them (of whichthere are many) to "altr".
– Poor guy on a Google forum, recently
When the problem isn't in code
Find a stakeholder, outside of IT
Communicate the issue– In a non-technical way
– Users have a lesser experience
– Magic phrase: “Lower click-thru rate”– Magic phrase: “Lower conversion rate”
How To Fix Things Later
Bootstrap – “works” fine in table-based websites. Minor
side-effects, nothing crazy.
jQuery – can just “sit there” for later.
LESS / SASS – to refactor old CSS.
How To Fix Things Later
Source Control.
Task tracking / ticket systems.
Testing tools.
Tools for automating.
“I don't have time”.
– 30 minutes a day works wonders!Seriously.
Source Control(Subversion, Git, PerfForce, Team Foundation Server, etc)Don't let the Git people fool you – any of them will work.)Task tracking / ticket systemsGreat places to store “todo” lists for later so everyone on
the project can see.Jira, Lighthouse, anything that's NOT “just sending email”Unit Tests...and any other testing (framework) that you can use.Tools for automating parts of the build process.
Grunt, Maven, Ant, whatever.
Don't have to learn them all at once. Pick 1 thing you don't know and try it out.Make a “pet project” outside of work so you have
something fun to expiriment with.
“I don't have time” – 30 minutes a day works wonders!Seriously.
How To Fix Things Later
Don't be afraid to ask questions
Post on Google Groups, StackOverflow, whatever.
Talk to people at the conference!
Don't Be Afraid to Ask QuestionsPost on Google Groups, StackOverflow,
whatever.Talk to people at the conference!Client: brought in to do “pair programming”.
He'd worked there for 15 years, wrote most of theirCF code, but done so by himself mostly. Hadn'tused OO/MVC at all, but at least knew of BenNadel's blog. :)
Semi Rant: these “how to ask smart questions”posts on Google Groups...take them with a grain ofsalt. Authors, please work on wording these in non-snarky tones.
How To Fix Things Later
“But when I post on StackOverflow, I getyelled at for doing it wrong!”
Senior Developer != Great Communicator
<rant>”how to ask questions”</rant>
But sometimes when I post on StackOverflow I getyelled at for doing it wrong!
That's THEIR problem (the yeller) not yours.
Everybody makes mistakes, even THAT guy.
A Senior Developer != A Great Communicator.
Don't be afraid of doing things wrong. That'show we learn.
Other Resources
JoelOnSoftware.com
Ben Nadel's blog
“Secrets of the Rockstar Programmers”
“Head First Java”
“Head First Design Patterns”
Any “Head First” books, really.
JoelOnSoftware.com (his books too)Book: Secrets of the Rockstar ProgrammersBenNadel.com – for CF and JS stuff, asking questions that
get a polite, professional response. (Seriously, Ben is thenicest guy ever.)
“Head First Java”Even if you're NOT a Java developer.Or if you're already a 'senior' developer.Read it anyway. Learn new, clear, different ways of
explaining what code does to non-developers (or justpeople other than yourself that have a different brain thanyou do, and approach problems differently).
Pretty much any “Head First” book for that matter.“Head First Design Patterns”
– Same idea, but for higher level OO concepts.Super easy ways to explain OO designs to non OO folks.I use this book when I teach any intermediate/advancedOO class. It works wonders!
Questions? Comments?
Email: [email protected]
Twitter: @southofshasta
Blog: southofshasta.com/blog
Do you need a consultant for a project? :)
Thanks!