The document discusses various agile technical practices for building software, including common code conventions, collective code ownership, pair programming, revision control, test-driven development, unit testing, refactoring, continuous integration, and continuous delivery. It argues that these practices help create a stable code base that can withstand changes in an agile environment while still following engineering principles of testability, maintainability, integrity, and manageability. Agile engineering involves consistently practicing these techniques rather than treating them as a fixed state.
6. Engineering Principles
● Testability - Repeatable results to ensure expectations
● Maintainability - Designed to last & be extendable
● Integrity - Meets appropriate & intended requirements
● Ethical - Safe and in best interest of users and client
● Manageable - Can be reasonably built and delivered
● Scientific - Based on data, math and provable concepts
● External integration -Well-defined interface w/environment
7. Common Code Conventions
Agree on standards
● Naming Conventions
● Coding standards
● User Interface conventions
● File structures
● Configuration management
● Shared tools & Language
● Error logging
● Security
8. Common Code Conventions - Agile Engineering?
Benefits
● Readability, comprehension
● Shared knowledge
● Fewer decisions = constraints provide freedom
How many times have you grabbed a Standard screwdriver
and needed a Phillips?
The nice thing about standards is that you have so many to
choose from -- Andrew S. Tanenbaum
10. Collective Code Ownership
Any team member can change any piece of code in the system at any time.
Everyone on the team is responsible for the code.
This works better if you have:
● Coding standards
● Shared code repository
● Pair programming
● Continuous integration
● Unit tests
11. Collective Code Ownership - Agile Engineering?
● No hidden code makes the code base maintainable testable, ethical
● Peer pressure urges use of coding standards
● Lessens bottlenecks - not waiting on a specific developer
● Embraces the Kaizen “stop the line” philosophy
● Complex / difficult code will be revised
● Knowledge sharing
● Empowers coders & builds attachment
12. Pair Programming
A dialog between two people trying to simultaneously program and analyze and
design and test and understand how to program better -- assisted and focused on
a computer.
● Two brains working on a single problem
● Sharing knowledge of the development
environment
● Full bandwidth communication - often face-to-face
● Separate roles: one building and one considering
the “meta”
14. Revision Control
Revision Control or Version control is a system that records changes to a file or
set of files over time so that you can recall specific versions later.
● Tracks changes to code
● Branching & merging from multiple developers
● Snapshots of significant milestones
● Allows for experiments
● Debugging
15. Revision Control - Agile Engineering?
● Reduces waste. More efficient than multiple, near-identical copies of code
● Allows for “practice” and Do-overs (Measure twice, cut once)
● Provides complete inspection of code base over time
● Can provide legal and compliance auditing
● Revision control of configuration coupled with CI/CD reduces human error
17. Test-Driven Development
Writing new code only when an automated test has failed.
● Make a list of tests (requirements)
● Implement the most interesting the simplest that you
can (“Red Bar pattern”)
● Write code to make the test pass (“Green Bar pattern)
● Choose the next test from your list.
● Repeat until sufficient
18. Test-Driven Development - Agile Engineering?
● Supports the four elements of simple design
○ Passes all tests (testable)
○ Maximizes clarity (integrity)
○ Minimizes duplication (maintainable)
○ Has fewer elements
● Code is designed for the solution
● Tests can be written from the business point of view
19. Unit Testing
The practice writing tests for small sections of the program, typically methods, to
prove whether it meets design and behaves as intended. Often the tests are in a
framework like an xUnit library.
● Known state of the components that are under test
● Anyone can run the tests against the codebase
● Context setup allows for specific tests not simple within the whole system
20. Unit Testing - Agile Engineering?
● Isolates each part of the program to show that individual parts are correct.
● A unit test documents the strict, written contract that a piece of code must
satisfy. As tests evolve, it is living documentation of the system.
● Finds problems early in the development cycle including bugs in code &
missing specs
● Writing tests forces the authors to consider inputs, outputs, and error
conditions,
● Unit testing allows the programmer to safely refactor code
21. Refactoring
A disciplined technique for restructuring an existing
body of code, altering its internal structure without
changing its external behavior.
● Create known good tests to provide
“observational equivalence”
● Use known refactoring patterns to reduce
complexity. eg:
○ Isolate
○ Extract
○ Inline
○ Extract Interface
22. Refactoring - Agile Engineering?
● Testing tools can “prove” equivalence
● Refactoring patterns facilitate flexible designs
● Reduces cruft / unused code / technical debt
● Minimizes the cost of change
● Refactoring is often required to make legacy code more easily testable
● Practice required
○ Emily Bache: Gilded Rose Kata
○ Lewellyn Falco: Provable Refactorings with Combination Testing
24. Continuous Integration
The practice of merging all developers' working copies to a shared mainline
several times a day
● Branch code for a feature
● Make changes
● Commit changes to the branch
● Automated checking process
● Merge into larger branch
25. Continuous Delivery
The process to automate delivery of the software into
production in a safe & sustainable way. This of course
requires validation of the system before release.
● Integration
● Automated Tests
● Deployment Pipeline
● Production Monitoring
26. CI / CD - Agile Engineering?
● Faster feedback on potential code breakage
● Commits = progress
● Better visibility into the quality of the code changes
● Prevents integration problems "at the end"
● Use with revision control to take snapshots of progress
● Automation Reduces human error
● Activities that used to happen rarely now happen often
● Constant monitoring provides insight into product systems
28. Agile Engineering is a Journey
“If you find yourself in a team who practice continuous integration, short
iterations, pair programming, and test driven development, it is a powerful
indication you are in a team who shares the values of the agile manifesto.
If they did not share those values, they would not follow those practices.”
-- Robert Martin, author of Clean Code
(my underlines for emphasis)
30. Conclusion
● Agile technical practices can help create a stable code base that will provide a
robust environment for the churn and zigs and zags that come with an agile
development environment.
● These are not all the engineering principles for software design, but the ones
that are usually coupled (and sometimes ignored) in agile development teams.
● Agile Engineering is a practice, not a state.
● Have I convinced you that we can follow engineering principles while using
agile practices?
31. The Agile Technical Practices
or
How to Build a Better Deck
Moss Drake PNSQC 2019
@mxmoss
Editor's Notes
a lot of emphasis has been on business agility and the interface between business and development teams.
Within development teams, however, agile has been a mixed bag.
Some teams have experienced increased efficiency and effectiveness while others see agile as biz speak for "no rules."
These are the technical practices mentioned by Kent Beck in XP Programming Explained.
Often it feels like the system we’re maintaining is like the steps on the right.
I was talking with a friend about his new deck and I wondered how it knew how much weight it would hold. He explained he engineered it for a certain weight.
I got a chill from the way he emphasized “engineering”. Yes, that what I want for software.
Agile business / project management / development Does not explicitly require much engineering…
Standards are good, but need to be practiced - used daily.
Also, there’s an assumption that there’s always a better way to do something.
“Naming is a process” - Arlo Belshee - see refactoring
At PNSQC: Tuesday morning David Card talking about Standards Are Necessary But Not Sufficient for Excellent Software
This is more about psychology than engineering, but it helps in the same was as a checklist
We use Pairing in zoom meetings although I prefer face-to-face.
Intense
Not all personalities can work together… be flexible
Some people question using two people working on one task
At PNSQC: Tomorrow afternoon Thomas Desmond on Creating Quality with Mob Programming
Using a tool like github, bitbucket, subversion or MSFT Team Foundation server
We used a locally installed revision control but moved to Github in the past couple years to support distributed development teams.
I really appreciate github’s features. It’s a time machine
You don't have to have a full automation suite to use TDD
But, once you have some tests written to help deliver the functionality,
consider keeping some of them as Unit Tests
At PNSQC: Wednesday Workshop run by James Shore on Test Driven Development without Mocks
Hardest to get right and most daunting
Unit tests are not a goal in themselves
This is the automated checking phase, but it doesn’t happen without good design.
Routines have to be written in a way so that they’re testable, atomic
James Coplien - Why Most Unit Testing is Waste
Unit tests add mass to the code base
- The classes to be tested are code
- The tests are code
- Developers write code.
- Typically, devs insert about 3 system-affecting bugs per 1,000 lines of code.
- Assuming random distribution of bugs in the code base...
- "Tests will hold the code to an incorrect result more often than a genuine bug will cause the code to fail!"
He then explains how to to trim the unit tests to something more valuable & manageable
We had a sudden layoff on our team and I didn't have time to run and maintain intensive build process
We used Jenkins with Github to provide the build pipeline
with Ant and a bunch of batch files to move files as we needed to get them ready for distribution.
Now we can make a distribution build in about 10 minutes and Jenkins tracks the history
At PNSQC: Tuesday morning Andy Peterson will be talking about Moving to Continuous Delivery Culture
Here are some ways you can practice these practices in Portland
AgilePDX User Group - Mob Programming Meetup in Portland monthly
PDX Global Day of Coderetreat Nov 16, 2019