Clean Code - Increase your agility through higher quality software
1. Clean Code
Increase your agility through higher
quality software
Eric Reichwaldt
Performance Team Lead
Communication – Restorative – Strategic – Responsibility – Futuristic
3. @shyftsolutions #nebrcode
“We are uncovering better ways of developing software by doing it and helping others
do it. Through this work we have come to value:”
Agile Manifesto
Individuals and Interactions
Working Software
Customer Collaboration
Responding to Change
Processes and Tools
Comprehensive Documentation
Contract Negotiation
Following a Plan
over
over
over
over
“That is, while there is value in the items on the right,
we value the items on the left more” - February
2001
4. @shyftsolutions #nebrcode
Agile Principles
Our highest priority is to satisfy the customer
through early and continuous delivery
of valuable software.
Welcome changing requirements, even late in
development. Agile processes harness change for
the customer's competitive advantage.
Deliver working software frequently, from a
couple of weeks to a couple of months, with a
preference to the shorter timescale.
Business people and developers must work
together daily throughout the project.
Build projects around motivated individuals.
Give them the environment and support they
need,
and trust them to get the job done.
The most efficient and effective method of
conveying information to and within a development
team is face-to-face conversation.
Working software is the primary measure of progress.
Agile processes promote sustainable development.
The sponsors, developers, and users should be able
to maintain a constant pace indefinitely.
Continuous attention to technical excellence
and good design enhances agility.
Simplicity--the art of maximizing the amount
of work not done--is essential.
The best architectures, requirements, and designs
emerge from self-organizing teams.
At regular intervals, the team reflects on how
to become more effective, then tunes and adjusts
its behavior accordingly.
5. @shyftsolutions #nebrcode
Agile Principles
Our highest priority is to satisfy the customer
through early and continuous delivery
of valuable software.
Welcome changing requirements, even late in
development. Agile processes harness change for
the customer's competitive advantage.
Deliver working software frequently, from a
couple of weeks to a couple of months, with a
preference to the shorter timescale.
Business people and developers must work
together daily throughout the project.
Build projects around motivated individuals.
Give them the environment and support they
need,
and trust them to get the job done.
The most efficient and effective method of
conveying information to and within a development
team is face-to-face conversation.
Working software is the primary measure of progress.
Agile processes promote sustainable development.
The sponsors, developers, and users should be able
to maintain a constant pace indefinitely.
Continuous attention to technical excellence
and good design enhances agility.
Simplicity--the art of maximizing the amount
of work not done--is essential.
The best architectures, requirements, and designs
emerge from self-organizing teams.
At regular intervals, the team reflects on how
to become more effective, then tunes and adjusts
its behavior accordingly.
9. @shyftsolutions #nebrcode
“We've seen clean, functional systems
deteriorate pretty quickly once windows start
breaking. There are other factors that can
contribute to software rot…, but neglect
accelerates the rot faster than any other
factor.” - The Pragmatic Programmer
Broken Windows
“Maybe we should be sweating the small stuff.”
10. @shyftsolutions #nebrcode
Build a Solid Foundation
• Single Responsibility Principle
• Open/Closed Principle
• Liskov Substitution Principle
• Interface Segregation Principle
• Dependency Inversion Principle
SOLID Design Principles
13. @shyftsolutions #nebrcode
No one can accurately estimate time for software
Build it the right-way not the fast-way
Aim for approximately right, not precisely wrong
Impatience is driven by uncertainty
Delay decisions until the last responsible moment
Time
17. @shyftsolutions #nebrcode
Extreme Programming
• The customer is always available
• Code must be written to agreed standards
• Code the unit test first
• All production code is pair programmed
• Only one pair integrates code at a time
• Integrate often
• Set up a dedicated integration computer
• Use collective ownership
Support Systems
23. @shyftsolutions #nebrcode
Communication
Every conversation is a chance to get feedback and adjust aim
The more frequent the conversations, the less time needed
All time spent off of the shortest path is waste
<<Spoilers>>The target doesn’t sit still!!
27. @shyftsolutions #nebrcode
A modest proposal
i. Pair up
ii. Work on design and algorithm and identify patterns of
logic
iii. Code and test sub-programs in pair programming
iv. Split up to code anything that is similar to other sub-
programs already paired on
v. Pair up again
vi. Review and perform integration tests
vii. Go back to step (ii) until completion of assignments
Pair Programming
0
1
2
3
4
5
6
7
NumberofDays
Individual Pair
Individual 5.81 3.25 2.52 2.05 1.63 1.31 1.18 1.17
Pair 3.13 2.08 1.76 1.62 1.56 1.43 1.41 1.37
28. Agility in Software
It starts with a commitment to do things better…
It grows by holding each other to higher standards
29. @shyftsolutions #nebrcode
Books
• Martin, R. C., Feathers, M. C., Ottinger,T. R., Langr, J. J., Schuchert, B. L., Grenning, J.W., &
Wampler, K. D. (2015). Clean code: a handbook of agile software craftsmanship. Upper Saddle
River, N.J: Prentice Hall.
• Martin, R. C. (2014). Agile software development: principles, patterns, and practices. Harlow,
UK: Pearson.
Websites
• https://pragprog.com/the-pragmatic-programmer/extracts/software-entropy
• https://www.ted.com/talks/rory_sutherland_perspective_is_everything?language=en
References
Editor's Notes
I'm an intermediate, but passionate software developer who has walked with the giants.
I've spent more time as a Scrum Master, Product Owner, and Manager, and I leverage my programming experience to motivate teams to delivery high-quality solutions, and to work with stakeholders to respect the teams time.
That's the jist of this talk, I'm not going to get into syntax or code patterns, but focus on the art of writing software and some ways teams can work together to build and reinforce good habits.
BG - only been in software officially for about 5 years
Racing – {troubleshooting, maintenance} Have to change your oil and grease the wheel bearings to keep the car moving quickly… shortcuts cost you wins—and money
Construction – {design, up-front planning, optimization, automation} If you have a hundred boards to cut 6 inches off of, you could measure out every board and cut them one at a time at about 40 seconds per board (4000 secs ~ 1 hour and 6 minutes)… or you could take 3 to 5 minutes up front and setup a jig to cut each board at less than 10 seconds per board (1300 secs ~ 21 minutes)
Air Force – {standards, teamwork, leadership} following standards, working as a team, leading and motivating people and continuous improvement
Weather – {communication} learned to be comfortable making estimates, humble enough to say things like “I don’t know”. Accuracy of predictions is based on context
17 Independent leaders in the software industry created the manifesto, made up of four key values and 12 principles
Rooted in software development, less emphasis on planning
So many look to Agile to solve mid-level planning problems without adopting an enterprise culture that fosters it
Also fail to empower developers to operate at the tactical level in a truly Agile manner
These fives principles are not necessarily any more important than others, but drive the majority of this talk
Two teams of 5, one leader, organize by height with tallest person in the center of the room
Anyone have a friend or relative who is an engineer in another field?...
Mechanical engineering, electrical engineering, structural engineering, aeronautical engineering all have robust standards and many certifications or accreditations
We have policies governing data security and vendor certifications, but no true standards around the quality of software—partly because it is so subjective
Software runs everything
Life and death and serious financial consequences are now a factor in many software applications
What does bad software look like?
What does this do to our system over time?
Just because it rolls, it doesn’t mean you should drive it like that
Things always work until they don't
Painting the grass green
A lot of people struggle to admit that something isn't right.
It's OK to say you don't know what is wrong with the software
Stutz story
Have to be honest and open about what is going on. If we always cave to meet deadlines, and sacrfice quality at will, it reinforces the bad behavior
Martin Fowler created extreme programming to build a process to enforce good behavior
People inherently do what is easy-–so we have to make the right thing to do the easy thing
These things have to be built into your teams "norms" and "definition of done"
Ask questions
Avoid fear of "too many cooks in the kitchen", too much communication can be filtered... there is no way to compensate for too little communication