Thursday, September 12, 2013

Orders of Complexity

From Chapter 2: The Mythical Man-Month

Excerpt
...testing is usually the most mis-scheduled part of programming...Failure to allow enough time for system test, in particular, is peculiarly disastrous. Since the delay comes at the end of the schedule, no one is aware of schedule trouble until almost the delivery date. Bad news, late and without warning, is unsettling
to customers and to managers. (page 20)

From A Spiral Model of Software Development and Enhancement1

"Stop the life cycle-! want to get off!"
"Life-cycle Concept Considered Harmful."
"The waterfall model is dead."
"No, it isn't, but it should be."
On to Brooks third, and last, 'fallacious thought mode': Unwarranted optimism lead to inadequate test schedules.

As a remedy he suggests the development schedule be allocated as follows:
  • 30% Planning should represent ~30% of the schedule
  • 20% Programming
  • 50% Testing
This may be one area where Brook's commentary is dated or at least peculiar to the development of a new compute platform. Three objections come to mind: 1) the implied use of the waterfall development model , 2) the suggested length of the schedule, and 3) underestimation of the testing challenge. I'll try to tackle each in turn.

Waterfall development

The idea behind the waterfall model is simple. First you do analysis (i.e. requirements), then you do design, then you do implementation, then you do test. After that you deployment and keep the system alive and healthy with maintenance.

On the surface, the waterfall model is very desirable. It's easy to comprehend. Budgeting and scheduling are straight forward. Progress is obvious. Best of all, the approach lends itself to the currently-fashionable, CMMI-fueled metrics craze--especially EVM. (see Is it done yet?.)

The only problem with the waterfall model is that it doesn't work. Software development simply does not function that way. There's too much to discover in the doing. It was the waterfall model that gave rise to that famously captious platitude, "The last 10% of the schedule takes 90% of the time."2

In 1986, Barry Boehm published highly influential article1 that suggested a spiral model for software development.3 In a nutshell, you might think of spiral as a bunch of mini waterfalls wrapped in a waterfall. The point is that the analysis, design, implementation and test is integrated in a repeating cycle. This allows the inevitable discoveries to be incorporated into the development process. Boehm's article changed things forever in the software community--I do not personally know a skilled software developer who currently prefers the waterfall model to one of the spiral models.

From a budgeting and scheduling perspective, spiral models do not isolate test as a distinct phase. A good team will incorporate testing every part of design and implementation effort as well as dedicated test phase prior to delivery. Testing is just part of the development mélange. There will not be a testing milestone that culls out 50% of the schedule. Developers who work for managers that insist on milestones that represent a 50% test schedule will need to keep up on those handwaving exercises.

Schedule length
Starting and completing a development cycle is expensive. A good programming team will develop momentum, so it is advisable to provide a programming phase that gives the team a chance to work up a head of steam and make substantial progress. However, the programming phase (and ultimate product release) should not so long that the customer requirements change or the sponsorship interest waffles. For major release of a infrastructure or embedded application, I discovered a 16-week programming phase a sweet spot for a 6-month release cycle.4

For the sake of argument, assume a 16-week programming phase. Using Brook's recommendations the breakdown would look like this: 24 weeks of planning, 16 weeks of development and 40 weeks of testing. That would be an overall schedule of 80 weeks! Heck, the Empire state building was build in less time than that. If my experience is indicative, a development effort that goes a year and a half without a major release is doomed. Why? Platforms change, security requirements change and customer requirement change and, most importantly, the sponsor's priorities change. In other words, a schedule with based on the '50% test rule' is unrealistic.

Testing Challenge
To first order, there are two types of testing: tests that check if a product meets requirements and tests that check if the product performs correctly. The former is know as validation; the latter is known as verification (V&V in the common parlance). I do not know of a single case where a non-trivial software product was completely validated or verified.

Consider what's entailed.

Validation requires the testers develop tests that prove a requirement is met. For example a typical requirement may say that that 'the system shall authenticate a user.' Simple enough, but imagine all the unstated possibilities. What institutional infrastructures should be supported? Is it authentication with using LDAP? Active Directory? An custom adaptation layer? In theory, functional requirements and design specifications will spell out all the ambiguities; in practice they the never will. As a result, the process of test design is interpretive and begs two key questions: Is the interpretation correct? What is omitted?

There's a greater test challenge. The tester is asked to determine if the program can enter an illegal state. From a purely software perspective, the test might check to see if the program runs out of resources, corrupts memory, or violates a process deadline5. Checking all the possible system states is simply impossible with current practice.

For space systems, there a much greater challenge, the tester would need to check that the software will never put the entire system into an illegal physical state, i.e. a state that causes mission failure. For example the tests should check that the software will not allow for a power failure, uncontrollable tumbling of the spacecraft, or ramming an instrument platform into a solar array. There are a very large number of permutations in the antecedent conditions that might lead to an illegal system state. If that wasn't a big enough challenge, the space system must be tested in simulated conditions and the simulations themselves are subject to the same test challenges.

In other words, no matter what the schedule allocation, complete testing a space system is impossible. As a practical matter, testers focus on a few well-defined operational scenarios and ensure the system works in just those limited conditions. Given the highly constrained NASA software budgets testing is really just a best-effort.

For the current generation of space systems, our development methods, scheduling and test practices are good enough. But these practices severely limit what can be accomplished. Autonomy is primitive. Operations expensive. Reliability suspect. However, if we are going to build smart systems with capabilities that can accomplish complex operational goals, we will need to develop methods for handling additional orders of complexity.


1. Boehm B., A Spiral Model of Software Development and Enhancement. ACM SIGSOFT Software Engineering Notes. Volume 11 Issue 4, August 1986. Pages 14-24

2. Sometimes coined as the ninety-ninety rule.

3. 'Spiral' was just the start. Since then there has been a string of refinements: Objectory, Rational Unified Process, Team Software Process, Extreme Programing and Agile. Each with a different emphasis; each offering a panacea. Over the years, I never met an experienced developer who preferred the waterfall to these later developments.

4. Shorter release cycle are very desirable minor upgrades on well understood systems. However, if system failure can cause mission failure, more rigor is required. A topic for another day.

5. For a real-time system, meeting a process deadline is necessary for program correctness.

Thursday, September 5, 2013

Where does the time go?

From Chapter 2: The Mythical Man-Month

Excerpt
Since software construction is inherently a systems effort—an exercise in complex interrelationships—communication effort is great, and it quickly dominates the decrease in individual task time brought about by partitioning. (page 19)

Gantt Chart of Typical 16-week schedule
Brooks is wrapping up his discussion of the second 'fallacious thought mode' with a zinger. Think of it; communication "dominates the decrease in individual task time." How does that happen? Who knows where the time goes?1

Only a wee bit of wistful contemplation is needed to find a culprit: meetings. Just to put things in perspective, I genned-up a little table of the meetings that made up the routine part of the our lives as NASA software developers. Perhaps it's of interest.


Meeting TypePurposeFrequencyTimePrep Needed
Development-related Meetings
Development Team TagupsDevelopment status, plans and technical issuesDaily/Weekly15->30mNo
Project Team MeetingsProject-level coordination across development teamsWeekly1hOccasional
Technical Interchange meetingsTwo or more development teams meet to coordinate effortsAd hoc1hr->3dYes
Task Technical Reviews
Requirement reviewDiscuss and approve documented requirements. Focus: Process compliance, selected requirementsBuild Lifecycle2->4hYes
Architecture reviewDiscuss and approve documented architecture. Focus: Process compliance, selected topicsBuild Lifecycle2->4hYes
Design ReviewDiscussion and approve documented design. Focus: Process compliance, selected design considerationsBuild Lifecycle2->4hYes
Development kickoff reviewsReview the viability of the plan for a build cycle. Focus: Process compliance, development readinessBuild Lifecycle2->4hYes
Test readiness reviewDiscuss and approve readiness of product for testing. Focus: Process complianceBuild Lifecycle1->2hYes
Delivery and Deployment reviewDiscuss and approve product delivery. Focus: Process complianceBuild Lifecycle1->2hYes
Programmatic-related meetings
Monthly Management ReviewsStatus report Monthly3hYes
Budget MeetingsDiscuss and defend development and maintenance budgetsSeasonal1hYes
Change Board (CCB)Approve requirement and/or design changesWeekly1hYes
Risk BoardDiscuss and diposition risksMonthly1hYes
Programmatic Staff MeetingsWeekly update on Insitutional mandates, budgets, and status.Weekly1hNo
Quiet hoursIndividual meeting with managementMonthlyOccasional
All Hands MeetingsSenior management addresses entire staffAd hoc1hNo
Software-related Project Lifecycle Reviews
Preliminary Design ReviewsDiscussion of requirements and initial design. Approval to proceed to full designProject Lifecycle1dYes
Critical Design ReviewDiscussion of design. Approval to proceed start developmentProject Lifecycle1dYes
Test readiness reviewDiscuss and approve readiness of product for testing. Focus: Process complianceBuild Lifecycle4hYes
Delivery reviewDiscuss and approve product deliveryBuild Lifecycle2hYes
Institutionally-related Meetings
Group MeetingsLine organization meetings (think homeroom)Monthly1hNo
Section Staff MeetingsCarefully crafted commentsWeekly2hNo
Quiet hoursIndividual meeting with managementMonthly1hNo
All Hands MeetingsSenior management addresses entire staffAd hoc1hNo

Bear in mind that a single team may support multiple tasks and multiple projects. Team members often present the same material in different meetings. Also, note all the required preparation; it's significant.

By the way, the developers who support these meetings are also supposed to program. Daunting eh?! There are no ivory towers on the NASA grounds, and precious little time to think deep thoughts. Bear in mind that not everyone goes to every meeting. However, the more senior the engineer, the more meetings must be attended, the less time there is for careful thought.2

Are all those meetings necessary? I believe so. Here's a few reasons why:
  • Meetings can be an efficient way to exchange information and coordinate activities.
  • In a matrix managed organization, every developer has several managers. At a minimum there's a line manager and a program manager.2 More than likely, there are multiple line managers and program managers with skin in the game.
  • Every manager must meet with the team. Even on the face of it, to do otherwise would be considered negligent.
  • Management perception of status is capricious. Misinformation is readily spread. If it crops ups, it must be guarded against.
  • Failure is not an Option. Delegation is risk. The culture-of-consensus is a meeting culture.
Even if no one is added to meet the 'unmeetable' milestone, communication in a large organization will quickly soak up development time. The build-in communication aides and high-level of integration in the new breed of software process tools (e.g. IBM Rational Jazz, or the plethora of agile support tools) should help, but only for a while. If the past is any indicator, the added automation will become a liability as additional artifacts become the stuff of meetings. Efficiency is elusive; culture forces are resistant.

Is there hope? Yes, but only with leadership that has a stomach for risk. Regrettably survival usual means a stomach ectomy.

1. Who Knows Where the Time Goes is an 60's anthem written by Sandy Denny of Fairport Convention.   Here's a link to a beautifully performed cover song by Judy Collins.

2. For a top-notch engineer, I estimate that as much a 50% to 75% of work week can be taken up with meetings.

3. Line refers to institutional organization. e.g. business unit, division, section and group. Line managers are responsible for hiring the staff projects need and ensures that staff complies with institutional rules. Program management refers to management of funds. Program managers are responsible for delivering products on time and on schedule.

Tuesday, September 3, 2013

Chocolaty Little Finger Prints

From Chapter 2: The Mythical Man-Month

Excerpt
When a task cannot be partitioned because of sequential constraints, the application of more effort has no effect on the schedule. The bearing of a child takes nine months, no matter how many women are assigned. Many software tasks have this characteristic because of the sequential nature of debugging.
(page 16)
 
This quote should probably be in Barlett's. Brooks is referring to the not-so-special case where partitioning work is impossible. He has a lot more to say about debugging in subsequent chapters.

Brook's text is based on his experience building an operating system for the then new IBM 360. All new hardware; all new software. There's a strong analogy to the job of developing hardware and software for a new spacecraft. Debugging can be nasty. Is it a bug in the software? The COTS operating system? The lastest-greatest version of the VHDL-Verilog that's been loaded in that fancy FPGA? Some weird combo that no one ever thought about and only shows up once in a blue moon?

Seems like there's a nasty, intractable bug in every project. The only hope of getting to the bottom of the problem is to stop the presses and start the analysis on a non-moving target. Hence, the credible claim: debugging is sequential.

The 360 team had it's work cut out. They had to produce a new OS for the newly minted processors and instruction sets; a far tougher problem than that faced by the current generation of spacecraft developers who use established instruction sets and COTS operating systems.1 What's more the 360 team was writing tests on keypunch cards and running them in batch mode.2.

To say the least, contemporary debugging practices are vastly improved. We have interactive debugging, sophisticated make utilities, powerful configuration management tools , test harness tools, and shelves full of run-time verification tools. This affords some parallelization of debugging, but when final integration rolls around, the work is serial.

And it's not just debugging. There are antecedents in the sequence that simply happen; they cannot be skipped, even if they are not in the published schedule. Here's a few examples:
  • Antecedent: No planned requirement development or approval phase. Subsequent: programmers will invent the requirements they need for code development.
  • Antecedent: No planned architecture or design phase. Subsequent: The architecture will emerge as each programmer independently designs the functional pieces
  • Antecedent: No established development process for maintaining separate code branches. Subsequent: Programmers will merge their code branches on the trunk leading to entanglements, broken builds, and integration parties.3
  • Antecedent: No strictly enforced code freeze. Subsequent: Programmers change code that is under test compromising the test process.
The last antecedent is particularly challenging. Programmers will program. Here's a typical scenario. The code is 'finished.' The Integration and Test (I&T) team starts testing. A bug is discovered. A fix is needed. The programmer opens the code for repair and, while the code is open, adds a few extras. No one knows what, if any impact, the extras will have. In other words, a thoughtful I&T lead would ask, "Is the previous testing still valid?" A question that jeopardizes both the cost and the schedule. (This guy better be on good terms with management.)

The best I&T Leads will strive to ensure that the code under test is not changed. A talented colleague once put it this way, "I don't want to see any of the programmer's chocolaty little finger prints on the code we're testing."3

In my experience, releasing untested or under-tested code is common place. As a practical matter, that's a lofty goal--the necessities of the moment almost always carry the day. I have no direct experience developing code where human lives might be at risk (e.g. airplanes, cars, or nuclear plants), but testing was commonly short changed in NASA's under-funded software development culture. Even our most high-handed reviews conveniently skipped lightly over these profoundly inconvenient technical details. Our rigorous institutional process had, for the most part, merely formalized a system of looking in the obvious places and recording those findings on paper. A colleague once compared the review process to looking for a lost key under a street light because that's what you can see. I would only add that the results would also be captured in PowerPoint and displayed to 30 colleagues.

Today's conventions for managing the serial character of software development is sufficient for today's systems. We get by. Same for the our approach to testing. But, the current practice is wholly inadequate for building the large, complex software-intensive systems imagined in movies and books.

Interestingly, I don't believe these kinds of topics are the focus of serious research. Progress will be slow.


1. The current generation of deep-space missions use the
RAD750, a radiation hardened version of the processor that was introduced in 1997 and powered the multi-colored iMacs. The most commonly used COTS OS is VxWorks.
2. IBM System/360 Operation System: Programmer's Guide to Debugging
3. An entanglement occurs when source code files are mutually dependent and inconsistent. Consistency can only be restored by repairing all files at the same time. A broken build occurs when the source code will not compile and link. An integration party occurs when the whole team must stop development and work on restoring the build.
4. "...chocolatey little finger prints" is a phrase borrowed from Stephen Harrington, a witty and respected colleague from my Cx days.

Monday, September 2, 2013

Six good things about retirement

1. No deadlines*
 
2. No document review
 
3. No export review
 
4. Dog Lake


5. Lyell Creek (headed for Donohue Pass)

6.Bristlecone Pine ( 4,000 year-old)

* At least none that can be missed.