“A robot playing chess while reading rules from a rulebook, digital art”
created by AI using DALL-E
I asked my newest assistant Chat GPT to describe some requirements and some rules for an application. The answer was very good and adequate. Better than most of the Requirement Specs I see.
Many professionals make a huge mess when it comes to differentiating Requirements and Rules in the context of software development. The example I’m going to share here, generated by Chat GPT, may help you to understand that difference.
But first, let’s understand each one of these concepts.
See also How Chat GPT support Business Analyts?
Requirements and Rules
Requirements and business rules are related but distinct concepts.
“Requirement is a useful representation of a need.”
(BABOK Guide v3)
Requirements can be described from different perspectives. If the need is for the organization as a whole, we call it a business requirement. If the need is for a class of people, we call it a stakeholder requirement. If the need is for a software application, hardware, or information technology system that is being analyzed, we call it a solution requirement.
Let’s focus on solution requirements for our example application. They typically describe a specific functionality, performance, or feature that must be provided by the solution to meet stakeholder and business requirements.
“Business rule is a specific, practicable, testable directive that is under the control of the business and that serves as a criterion for guiding behaviour, shaping judgments, or making decisions.”
(BABOK Guide v3)
Business rules are usually business-oriented and are derived from policies, laws, regulations, market practices, contract terms, or other constraints that affect the organization’s business operation or decision-making.
Business rules can influence how solution requirements are implemented, or they can affect how users of a system work, but are typically independent of the solution. This means that, even if there is no application that automates the business process, the rules need to be adhered to. Therefore, they are described independently of their implementation.
Use cases identified by Chat GPT
In order to generate a simple and clear example, I have suggested an application of a chess game. Games have simple processes and their complexity is usually in the rules that need to be defined very clearly.
I started the exercise with Chat GPT by the application’s functional requirements. I really like the Use Cases technique for mapping requirements of this type. Each use case is a coherent unit of functionality made up of a sequence of interactions in which the user accesses the system to complete an objective.
Fabrício: I want to create an application that works like a chess game where the user plays against a virtual player. Help me specify the requirements for this app. Which use cases should I implement?
Chat GPT Assistant: To create a chess game application, there are several requirements that need to be considered. Here are some use cases you might consider:
- Account creation: allow the user to create an account to save game progress, access extra features, and challenge other players online.
- Play against a virtual player: allow the user to play against a virtual player, who must be able to make valid moves and implement chess strategies.
- Play against another player online: allow the user to challenge another player online in a game of chess.
- Game settings: allow the user to choose game settings, such as difficulty level, time per move, and color of their pieces.
- Game Rules: provide the rules of chess and how the game is played.
- Help options: allow the user to ask for suggestions and tips for the next move.
- Play history: allow the user to view the history of plays for the current game.
- Save/Load game: allow the user to save the current game and load a previously saved game.
- Offline mode: allow the user to play the game offline against the computer.
- Game statistics: provide statistics on the games played by the user, such as wins, losses, and draws.
These are just some of the use cases you can implement to create a chess game application. You can add additional features like challenging a friend, 3D board view, online chat, and much more.
As you can see, Chat GPT Assistant is very “creative” and already stimulates me with several ideas that can be further explored. My interest is now in the game itself because that’s where the rules need to be clearly defined.
Use case described by Chat GPT
As I said, the process of a game is relatively simple. The complexity is in the rules. To see how the game works and what the step-by-step process is, I asked Chat GPT to describe the use case where a user plays against the computer.
Fabrício: Use case 2 seems simpler to me. Describe it in a standard use case template.
Chat GPT Assistant: Of course, here is the description of use case 2, “Playing against a virtual player”, in a standard use case template:
Use Case Name: Play against a virtual player
Main Actor: User
Summary: The user plays a game of chess against a virtual player.
Preconditions: The chess application is open and the user has selected “Play against a virtual player”.
Postconditions: The chess game against the virtual player is completed.
- The user selects “Play against a virtual player” in the chess application.
- The application starts a new chess game with a virtual player.
- The user makes a move and the virtual player responds with a valid move.
- The app checks if the user’s move is valid and updates the board.
- The process continues until the game is completed.
- When the game is completed, the application displays the result of the match.
1a. The user ends the match before it is completed.
- The app ends the match and displays a message that the match has been canceled.
2a. The user makes an invalid move.
- The app displays a message stating that the move is invalid and prompts the user to make a valid move.
- The virtual player must be able to make valid moves and implement chess strategies.
- The application must verify that the moves are valid before updating the board.
- The application must record the movements of the match for later display.
- The application must allow the user to save or load a match.
Rules defined by Chat GPT
Finally, we come to the example of the rules. The rules are not part of the requirements and therefore are not described in the Use Case, but in separate documentation.
In step 4 of the basic flow, it is described that “The app checks if the user’s move is valid”. This verification will only be possible if the rules are clearly defined. That’s what I asked Chat GPT for.
Fabrício: List all the business rules for determining whether a move is valid.
Chat GPT Assistant: Of course, here are all the business rules needed to determine whether a move is valid in the game of chess:
- Each piece has a specific move that can be made, according to its movement rules.
- A piece cannot be moved to a square already occupied by another piece of the same player.
- A piece can only capture an opponent’s piece if it is moving according to its movement rules and the opposing piece is located on a square that is a valid destination.
- The pawn can advance one or two squares on its initial move and only one square on subsequent moves.
- The pawn can capture an opponent’s piece diagonally in front of it.
- The rook can move horizontally or vertically any number of squares, as long as there are no other pieces in the way.
- The bishop can move diagonally any number of squares, as long as there are no other pieces in the way.
- The queen can move both horizontally and vertically and also diagonally any number of squares, as long as there are no other pieces in the way.
- The king can move to any adjacent square, but cannot move to a square that is under attack by an opposing piece.
- The king is put in check when it is under attack by an opposing piece.
- A player cannot make a move that puts his own king in check.
- The game ends when a player puts the opponent’s king in checkmate, which means that the king is in check and there are no legal moves available to escape checkmate.
- The game can end in a draw if both players agree to a tie, if there is a board position with repeating moves, or if neither player manages to put the opponent’s king in checkmate.
- Castling is a special move that can be made by the king and one of the rooks, as long as the king is not in check, has not moved before, and has not passed through squares that are under attack by an opposing piece.
- A pawn that reaches the last rank of the board can be promoted to a piece of his choice (except a king or another pawn).
Note that the rules don’t mention the app. The rules of chess concern the pieces, the game, what a player can or can’t do, how the pieces move and capture the opponent’s pieces. The rules exist and must be respected by anyone who wants to play chess, regardless of the existence or not of an app that automates the game.
I’ll have to implement this requirement to check if a move is valid by checking all these business rules before updating the board. If a move violates any of these rules, the application must inform the player that the move is not allowed and request the player to make a different move as defined in alternate flow 2a. If a move is valid, the app should update the board and continue the game at step 5 of the basic flow.
Corporate business rules
The example of the chess game is didactic, but you may wonder what types of situations require the specification of business rules for your business. See some examples suggested here by the Chat GPT Assistant:
Fabrício: List some examples of system requirements that automate business process activities that require the definition of business rules.
Chat GPT Assistant: There are many examples of system requirements that require the definition of business rules to automate business process activities. Here are some examples:
- A sales order management system must apply the company’s pricing and discount policies to calculate the final order value.
- An inventory management system must apply the company’s inventory control rules to manage inventory quantities and ensure no excess or shortage of products.
- An expense management system must apply company reimbursement policies to validate and approve expenses submitted by employees.
- A compliance management system must apply the company’s internal regulations and policies to monitor and ensure compliance with legal and regulatory requirements.
- A risk management system must apply the company’s risk management policies to identify, assess and manage the risks associated with the company’s operations.
- A contract management system must enforce the terms and conditions of contracts to ensure that contractual obligations are met and monitor the performance of suppliers and customers.
- A human resource management system must apply the company’s human resource policies to manage payroll, benefits, vacation, and other employee-related aspects.
These are just a few examples, but the list could be much longer depending on the type of business and the processes being automated.
Rules and requirements are different types of information and must be described, stored, and managed differently. If you didn’t quite understand this difference, I hope this example has helped you to clarify it.
Try to identify who are the rules managers in your organization. If they are not defined, it is important to do so. Organizations without clearly defined business rules do not have standard behavior. And it’s impossible to automate something that hasn’t been standardized.
Your requirements may be completely defined, but without rules in place, you’ll never be able to implement a solution that works.
See also The difference between requirements and business rules with Gladys Lam.
This article also made use of Chat GPT to create the examples presented here. This tool is bringing good opportunities to increase the productivity and quality of the work performed by business analysts.
See below other articles that also talk about this use of Chat GPT:
- Will Artificial Intelligence take my place?
- Interview with Chat GPT
- Chat GPT as a tool for business analysis
- Chat GPT: “This article was produced using Chat GPT, a language model trained by OpenAI.”
- Dall-E: “The image used in this article was generated using the Dall-E imaging tool, developed by OpenAI.”
- The BABOK Guide to the Business Analysis Body of Knowledge cited in the article was developed by IIBA, the International Institute of Business Analysis.