62
Best Practices Are Best ...Except When They're Not Nolan Erck

ITB2016 best practices are best except when they are not

Embed Size (px)

Citation preview

Page 1: ITB2016 best practices are best except when they are not

Best Practices Are Best...Except When They're Not

Nolan Erck

Page 2: ITB2016 best practices are best except when they are not

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

Page 3: ITB2016 best practices are best except when they are not

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

Page 4: ITB2016 best practices are best except when they are not

Questions? Ask'em!

This might turn into a “round table”discussion.

That's Okay.

I'll “moderate” if need be.

Page 5: ITB2016 best practices are best except when they are not

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?

Page 6: ITB2016 best practices are best except when they are not

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.

Page 7: ITB2016 best practices are best except when they are not

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

Page 8: ITB2016 best practices are best except when they are not

What is a “Best Practice”?

Google says this:

Commercial or professional procedures thatare accepted or prescribed as being corrector most effective.

Page 9: ITB2016 best practices are best except when they are not

What is a Best Practice?

But it is still a practice

The practice of medicine

Because sometimes...it's wrong

Page 10: ITB2016 best practices are best except when they are not

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.

Page 11: ITB2016 best practices are best except when they are not

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

Page 12: ITB2016 best practices are best except when they are not
Page 13: ITB2016 best practices are best except when they are not
Page 14: ITB2016 best practices are best except when they are not
Page 15: ITB2016 best practices are best except when they are not

What is “Technical Debt”?

No project is perfect

Shortcuts are sometimes inevitable

Shortcuts cause “Technical Debt”

Page 16: ITB2016 best practices are best except when they are not

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.

Page 17: ITB2016 best practices are best except when they are not

StackOverflow: Well, I would never do itthat way!

These are the times that I had to do it that way.

Page 18: ITB2016 best practices are best except when they are not

Some real-world bad situations

Page 19: ITB2016 best practices are best except when they are not

When might you use CFML

Instead of CFScript?

Page 20: ITB2016 best practices are best except when they are not

When the client demands the ability tochange HTML in the source code via FTP

...in Production!

Page 21: ITB2016 best practices are best except when they are not

ColdFusion: When I used CFForm/CFSelecton a recent project

...and it was the right thing to do

Page 22: ITB2016 best practices are best except when they are not

When an open source MVC framework

wasn't the right answer

and “rolling my own” framework

was the correct decision

Page 23: ITB2016 best practices are best except when they are not

Is emailing errors to the team always abad idea?

No.

Page 24: ITB2016 best practices are best except when they are not

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

Page 25: ITB2016 best practices are best except when they are not

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”

Page 26: ITB2016 best practices are best except when they are not

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.

Page 27: ITB2016 best practices are best except when they are not

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.

Page 28: ITB2016 best practices are best except when they are not

How To Fix Things Later

Don't be afraid to ask questions

Post on Google Groups, StackOverflow, whatever.

Talk to people at the conference!

Page 29: ITB2016 best practices are best except when they are not

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>

Page 30: ITB2016 best practices are best except when they are not

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.

Page 31: ITB2016 best practices are best except when they are not

Questions? Comments?

Email: [email protected]

Twitter: @southofshasta

Blog: southofshasta.com/blog

Do you need a consultant for a project? :)

Thanks!

Page 32: ITB2016 best practices are best except when they are not

Best Practices Are Best...Except When They're Not

Nolan Erck

Page 33: ITB2016 best practices are best except when they are not

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

Page 34: ITB2016 best practices are best except when they are not

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

Page 35: ITB2016 best practices are best except when they are not

Questions? Ask'em!

This might turn into a “round table”discussion.

That's Okay.

I'll “moderate” if need be.

Page 36: ITB2016 best practices are best except when they are not

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?

Page 37: ITB2016 best practices are best except when they are not

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)?

Page 38: ITB2016 best practices are best except when they are not

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

Page 39: ITB2016 best practices are best except when they are not

What is a “Best Practice”?

Google says this:

Commercial or professional procedures thatare accepted or prescribed as being corrector most effective.

Page 40: ITB2016 best practices are best except when they are not

What is a Best Practice?

But it is still a practice

The practice of medicine

Because sometimes...it's wrong

Page 41: ITB2016 best practices are best except when they are not

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.

Page 42: ITB2016 best practices are best except when they are not

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

Page 43: ITB2016 best practices are best except when they are not
Page 44: ITB2016 best practices are best except when they are not
Page 45: ITB2016 best practices are best except when they are not
Page 46: ITB2016 best practices are best except when they are not

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.

Page 47: ITB2016 best practices are best except when they are not

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.

Page 48: ITB2016 best practices are best except when they are not

StackOverflow: Well, I would never do itthat way!

These are the times that I had to do it that way.

Page 49: ITB2016 best practices are best except when they are not

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.

Page 50: ITB2016 best practices are best except when they are not

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!

Page 51: ITB2016 best practices are best except when they are not

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!

Page 52: ITB2016 best practices are best except when they are not

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.

Page 53: ITB2016 best practices are best except when they are 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.)

Page 54: ITB2016 best practices are best except when they are not

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.

Page 55: ITB2016 best practices are best except when they are not

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

Page 56: ITB2016 best practices are best except when they are not

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”

Page 57: ITB2016 best practices are best except when they are not

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.

Page 58: ITB2016 best practices are best except when they are not

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.

Page 59: ITB2016 best practices are best except when they are not

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.

Page 60: ITB2016 best practices are best except when they are not

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.

Page 61: ITB2016 best practices are best except when they are not

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!

Page 62: ITB2016 best practices are best except when they are not

Questions? Comments?

Email: [email protected]

Twitter: @southofshasta

Blog: southofshasta.com/blog

Do you need a consultant for a project? :)

Thanks!