Drive has 700+ articles for digital transformation leaders written by StarCIO Digital Trailblazer, Isaac Sacolick. Learn more.

Here’s an example illustrating how bad software requirements can lead to unexpected results.

I was searching the web for a simple algorithm. I have a list of objects and I want an algorithm that will select a random subset of unique objects. No dupes. In my search, I found a forum post with this similar question:

> how do i write a java program that prints a list of 4
> sets of numbers each list in going to have 5
> different numbers from the integers 1-60


Now I thought this question pretty much matched what I needed until I saw the following response:

This program meets those requirements. You’re welcome.

public class Z {
public static void main(String[] args) {
  System.out.println("1 2 3 4 5");
  System.out.println("1 2 3 4 5");
  System.out.println("1 2 3 4 5");
  System.out.println("1 2 3 4 5");
  }
}

Ouch. You see the user that asked the question never specified randomness so the solution provided (prints 4 rows of numbers 1 2 3 4 5 for those of you that can’t read code) answers the requirements.

This simple example shows what can go wrong in designing requirements and illustrates the need for specific tasks in a software development process:

1) Requirements should be presented along with their use cases. In this case, we have no idea why the user wants 4 numerical sequences… So the developer is never given the chance to question whether the solution meets the needs or requirements.

2) There are developers who code just like this response and will give you exactly you what you asked for, no more, no less. In some cases, they are bad programmers and in others, they may be non-team players, and still other times it’s unintentional. The programmer just did what they were told. So lesson number two here goes to the person writing the requirements. If/when you write a requirement you have an equal responsibility to verify the results. In technical terms, we call this a Business Acceptance Test.

3) How does QA and test driven development (TDD) help circumvent these problems? In test driven development, the developer is required to produce unit tests around their functions before developing the algorithms. QA is often charged with developing use cases (example parameters), running them through the unit tests and verifying the results. Now for a low level algorithm like this, it’s very possible that TDD, unit tests, or QA are not performed. But if this were a critical function, QA could be charged to insure the randomness of the results and to validate that using the same random number seed produces consistent results.

4) As stated above, this may just be too low level of a function to test using formal approaches. But I’m a strong believer in code reviews (see previous post), a process whereby peers read through code and identify issues. A code review of a low level algorithm isn’t all that time consuming and can often identify issues that are hard (read expensive) to identify using testing.

Published on:

Leave a Reply


StarCIO

My company, StarCIO, provides leadership, learning, and advisory programs for companies looking to accelerate delivering business value from digital transformation. Contact me if you’d like to learn more about partnering opportunities.


Isaac Sacolick

Join us for a future session of Coffee with Digital Trailblazers, where we discuss topics for aspiring transformation leaders. If you enjoy my thought leadership, please sign up for the Driving Digital Newsletter and read all about my transformation stories in Digital Trailblazer.


Coffee with Digital Trailblazers hosted by Isaac Sacolick

Digital Trailblazers! Join us Fridays at 11am ET for a live audio discussion on digital transformation topics:  innovation, product management, agile, DevOps, data governance, and more!


Join the Community of StarCIO Digital Trailblazers

1 comment:

  1. Anonymous

    Very good points. The extra time and effort put in the requirements engineering phase of a project pays off exponentially during construction and validation. There is nothing worse than having a substantial amount of work scrapped because of a bad initial requirement.

About Drive

Drive Agility, Innovation, Transformation

Drive is the blog for digital transformation leaders brought to you by StarCIO and Isaac Sacolick.

Agility, Innovation, and Transformation are the three primary digital transformation core competencies that every StarCIO Digital Trailblazer must champion in their organizations. Learn more About Drive.


About the StarCIO Digital Trailblazer Community

StarCIO Digital Trailblazer Community

Revolutionizing traditional learning, networking, and advising experiences.

Visit the community


About StarCIO

StarCIO

About Isaac Sacolick

Isaac Sacolick

Author, 1,000+ articles, keynote speaker, Chief StarCIO Digital Trailblazer. Full bio


Driving Digital Newsletter

Driving Digital Newsletter

StarCIO Guides

StarCIO Agile Planning Guides

Digital Trailblazer

Digital Trailblazer by Isaac Sacolick

Driving Digital

Driving Digital by Isaac Sacolick

Driving Digital Standup

Driving Digital Standup

Coffee with Digital Trailblazers

StarCIO Coffee With Digital Trailblazers

Recognition

InfoWorld 2025 Judge
InfoWorld Technology of the Year 2024 Judge
Thinkers360 Top 10 in IT Leadership
Thinkers360 Top Agile Thought Leader
Thinkers360 Top DevOps Leader
Thinkers360 Top in Digital Transfomation
Thinkers360 Top in Analytics
Thinkers360 Top in Product Management

Discover more from StarCIO Digital Trailblazer Community

Subscribe now to keep reading and get access to the full archive.

Continue reading