59
Holistic Program Quality and Technical Debt by Nathan Strutz for CF.Objective() 2011

Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Holistic Program Quality and Technical Debtby Nathan Strutzfor CF.Objective() 2011

Page 2: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Are you bored yet?

Page 3: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

My day job...

Photo © Boeing

Page 4: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Hackers, we have a problem

The "Software Crisis" from the early days of computing, now 40+ years in

Software projects are over budget, late, inefficient, don't meet requirements, code is unmaintainable and resulting software is just plain bad

Sometimes, never delivered

Page 5: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Measuring software

Speed & load times

Lines of code

Number of files, by type

Size on disk

Customer requirements

Code Coverage

Cyclomatic Complexity

Page 6: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Programming is hard

"Software is not governed by Moore's Law; more like Murphy's Law."

Douglas Crockford

"Every time I think I am making progress, I come to realize that I only have more confusion over the 'right' way to implement something."

Ben Nadel

"OO Almost Destroyed My Business!"Marc Funaro

Page 7: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

What is quality?

There's no real, single, conclusive definition

It's like chasing wind

It's like herding cats

It's like trying to slam a revolving door

It's like being the best at make-believe

Hmmmmm, the best at make-believe?

Page 8: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

... the best at make believe

Image © Adobe?

Page 9: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

What is quality?

How do you measure quality? How do you define it?

Completeness, Conciseness, Consistency, Debugability, Efficiency, Extensibility, Maintainability, Portability, Reliability, Security, Structuredness, Testability, Understandability and Usability to name a few

Quality has to cover the entire system, end to end

Page 10: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

You need to travel all paths at once

Page 11: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

This is your job, this is your life

You aren't paid to take up space and write poor software

Doing it right will pay your salary

Doing it right will be good for your team

Your code is the representation of yourself to your teamIf you are virtual, your code is your physical self

Doing it right will pay yourself back

Page 12: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

So, What is Quality?

Page 13: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Completeness

Does it do everything it needs to do?

Page 14: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Conciseness

Does it do only what it needs to?

Page 15: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Consistency

Is it predictable in UI and in API?

Page 16: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Debugability

Is it easy to fix complicated things?

Page 17: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Efficiency

Does it feel like it's quick enough?

Page 18: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Extensibility

Is it architected well enough to grow?

Page 19: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Maintainability

Is it easy to find and fix things?

Page 20: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Portability

Is it easy to switch client software?Is it easy to move servers?

Page 21: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Reliability

Is it available?

Page 22: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Security

Really good security programming is really good programming

Page 23: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Security Detour

photo by Alex C. Balla, flickr.com/bluepoint951

Page 24: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Security detour

Mediocre security is the same as insecurity!

Security == Simplicity

Bugs cause security problems. Complexity causes bugs. Simplicity removes bugs.

But software is still complex

Page 25: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Security detour,owasp.org ten for 2010http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project

InjectionCross-Site Scripting (XSS)Broken Authentication and Session ManagementInsecure Direct Object ReferencesCross-Site Request Forgery (CSRF)Security MisconfigurationInsecure Cryptographic StorageFailure to Restrict URL AccessInsufficient Transport Layer ProtectionUnvalidated Redirects and Forwards

Page 26: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Structuredness

Is it organized in an obvious way?

Page 27: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Testability

Is it easy to add tests to?

Page 28: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Understandability

Do you know what the system does? Do you know how it does it?

Page 29: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Usability

Does it feel good?

Photo by Doc Searls, flickr.com/docsearls

Page 30: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

I'd like to talk to you about your debt

Photo by Wally Gobetz, flickr.com/wallyg

Page 31: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Ward Cunningham said it best

Because he said it first(1992)

Photo by Alex Hung, flickr.com/alexhung

Page 32: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Time == Money

your time is an investmentyour knowledge is an investment

your work is an investment

Page 33: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

What Classifies as Technical Debt?

Not enough time for planning Poor planning, or no planning

Intentional Unintentional

Make something static when it should be dynamic

Leave features unfinished

Legacy code that no one wants to maintain

Discover later how application should have worked

Keep adding features, never refactor

Legacy code that no one can maintain

Page 34: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Everybody borrows a little

No one knows the end product from the first few lines

"...while you're programming, you are learning. It's often the case that it can take a year of programming on a project before you understand what the best design approach should have been." Martin Fowler

If those wrong turns aren't cleaned up, you have created some technical debt

Page 35: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Interest Payments

Interest is paid every time you work in a system that has technical debt

It's the time it takes to work around the string and duct tape

Interest is charged on the top

The amount of debt determines how bad your interest payments are

In a bad system, you may be paying over 50% to interest

Page 36: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

When do you have a problem?On the surface

Growing dislike for the system admitted by the developers

Small bugs that never seem to get fixed

A bad UI is a clue to a rotten core

Don't meet requirements like UI guidelines or security

Running old versions of a framework or application server

Lack of active developer knowledge

Unused features

Page 37: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

When do you have a problem?In the code

Lots of TODO and FIXME style commentsCode that can't be refactoredCode is too sloppy to make sense ofPoor variable namingFiles over 500 lines of code, functions over 200 linesCFCs / classes with over 50 functionsObjects not well encapsulatedNo objects / CFCs whatsoeverNo intelligible structureNo formal tests, no automated testingNo automated build processNo software releases for 6 monthsOOP done wrong

Page 38: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that
Page 39: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

When are you in over your head?

Deep contempt for the system admitted by developers

All knowledgeable developers have disavowed and moved to remote locations

Frameworks or engines 10+ years old

No software releases in 5 years

Bug fixes take months

Lots of "Sorry", "OMG", "WTF" and "$%#&*!!" comments

Analysis revealing pure spaghetti code

Page 40: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that
Page 41: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Declaring bankruptcy

Page 42: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Declaring bankruptcy

Rewrite. Throw it all away and start over

Consider losing an hour's worth of work

Consider a year or a decade's worth

You may create new problems, new kinds of bugs, and features will be lost

Scary!

Page 43: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Declaring bankruptcy

Page 44: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Declaring bankruptcy

You can write better software in less time, now that you know what the system does and how it works

Do it right this timeBest practicesRefactorable codeGo OOBuild for testability

Page 45: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

A personal story

Page 46: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Avoiding technical debt

Page 47: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

How do you avoid technical debt?

Two perspectives

Micro, Easiest win: Make your code readable!IndentationCommentingNaming

MacroArchitecturePlanningLoose Coupling

Page 48: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Separate layers, keep them that way

Javascript in HTML

HTML in Javascript

CSS in Javascript

CSS in HTML

Javascript in CSS

Model-View-Controller

Page 49: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Write lessPhoto by Tom Magliery, flickr.com/mag3737

Page 50: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Features Have Cost

Development timeobvious

Deploymentalways longer than you think

Maintenancemore features means more to maintainmore bloat

Load costdownloading time, bandwidth, CPU & memory usage

User confusionTraining Potential to introduce bugs

Page 51: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Test aroundImage thanks to geekandpoke.typepad.com

Page 52: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Increase knowledgeable staff

Page 53: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Refactoring as a way of life

Page 54: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Junk stuff

Page 55: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Aggressive code management

Page 56: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Document by automation

Page 57: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Make debt visiblePhoto by James Jordan, flickr.com/jamesjordan

Page 58: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Conclusion

The problems with software quality can be overcome, but it is a long, hard road

It's your job to write good software

Secure programming is good programming

Take calculated technical debt risks

It can take years to find the right approach

Watch for the warning signs

Make your code readable

Page 59: Holistic Program Quality and Technical Debt (CF.Objective ... › techblog › assets › Holistic... · Declaring bankruptcy You can write better software in less time, now that

Thanks

Bob, Marc & Emily.

You.

Nathan [email protected]@nathanstrutzfacebook, flickr, etc., etc.www.dopefly.com