Recipe Management System Phase 1: Design Document
Version 1.0
XYZZY Software
July 2019
Revision History
| Version | Date | Author | Comments |
If any corrections / clarifications are required to this document, please report them to Jacquie Jarvis at j.jarvis@cqu.edu.au
Table of Contents
Revision History 2
1. Introduction 4
2. Requirements 5
3. Architecture 6
4. Database / Data Access Design 7
5. GUI Design 9
6. Class Diagram 11
7. Sequence Diagrams 12
8. Test Plan 13
- Introduction
XYZZY Software has decided to develop a recipe management system for personal use. The system must be developed using Java Technologies (NetBeans, Swing, Java DB) and a phased implementation strategy will be adopted. This document represents the current state of the design for the Phase 1 system.
- Requirements
Because of the simplicity of the functional requirements, the corresponding use cases are not duplicated here, as would be the case in a normal XYZZY design document.
The purpose of the system is to assist people in recipe selection. A 3 phase development process is envisaged, with the incorporation of recipe details being deferred to a later phase. In the first two phases, the selection process will be restricted to main course recipes.
A Java desktop application is to be developed, driven by a simple Swing GUI. Interaction between the database and the application is to be via JDBC. The NetBeans IDE is to be used for development. Java DB must be used as the database.
The initial functional requirements are:
- Start the application and connect to the database
- Close the database connection and stop the application
- Display all recipes for a particular category (meat, fish, vegetarian)
- Display all recipes for a particular category with a preparation time within a specified range
- Display all recipes for a particular category with a combined preparation and cooking time that is within a specified range
- Display the number of recipes that have a specified ingredient as its key ingredient
- Add a new recipe to the database.
- Clear the display
In addition, the application must conform to the MVP architecture.
The database design and sample data are provided in Section 4. Data validation is not required at this stage. However, basic preconditions must be satisfied for each requirement and if these are not satisfied, an appropriate message is to be displayed. These preconditions are specified in Section 8.
- Architecture
An MVP conformant three-layered architecture is to be used for the application. Layers are to be modelled as packages – the package structure for the application is illustrated in Figure 1.
Figure 1. Package structure
- Database / Data Access Design
The SQL script that is to be used to create the database’s RECIPES table is given below.
DROP TABLE RECIPES;
CREATE TABLE RECIPES
(
ID INT NOT NULL GENERATED ALWAYS AS IDENTITY,
RECIPENAME VARCHAR (60) NOT NULL,
CATEGORY VARCHAR (10) NOT NULL,
MAININGREDIENT VARCHAR (10) NOT NULL,
PREPARATIONTIME INT NOT NULL,
COOKINGTIME INT NOT NULL
);
INSERT INTO RECIPES (RECIPENAME,CATEGORY,MAININGREDIENT,PREPARATIONTIME,COOKINGTIME)
VALUES
(‘steak tartare’,’meat’,’steak’,10,0),
(‘roast chicken’,’meat’,’chicken’,15,60),
(‘fish and chips’,’fish’,’fish’,5,10),
(‘grilled steak and salad’,’meat’,’steak’,15,5),
(‘baked beans on toast’,’vegetarian’,’beans’,0,5);
As there is only one table, an ERD is not provided.
Data access will be via JDBC using prepared statements. Java DB must be used as the database.
Normally, in an XYZZY design document, we would specify the queries in this section and relate them to the methods exposed by the RecipesQueries class described in Section 6. However, for this project, we have decided to leave query formulation to the implementers. Note that if you choose to use SQL’s COUNT() method for Requirement 6, the result set returned when the query is executed consists of a single row with a single column that contains an int. To retrieve this value, use code similar to the following:
// execute query here
// resultSet and n have been declared elsewhere
resultSet.next();
n = resultSet.getInt( 1 );
- GUI Design
Developers are free to use the NetBeans GUI Builder or alternatively, they can hand code the complete GUI. An indicative GUI is presented in Figure 2 and Table 1. Developers are free to use this design as is or to do things differently, for example using menus for data entry. Note that because of the simplicity of the GUI in Figure 2, screen shots for the realisation of each requirement are not shown as would normally occur in an XYZZY design document. Rather, the required actions are summarised in Table 2. When outputting lists of recipes, formatting the data as tables with appropriate headings is not required – you can just use Recipe.toString() to display the details of each recipe.
Figure 2. Indicative GUI
| Functionality | Swing Components |
| Output | JTextArea |
| Input | JLabel, JTextField |
| Operations | JButton |
Table 1. Mapping of GUI functionality to Swing component types.
| Requirement | Button | Inputs Required |
| 1 | n/a | n/a |
| 2 | Exit | None |
| 3 | Category | Category |
| 4 | Category and Preparation Time | Category and Preparation times – see below |
| 5 | Category and Combined Time | Category and Combined Times – see below |
| 6 | Main Ingredient | Main Ingredient |
| 7 | Add | All, except for right-most Preparation and Cooking times and Combined Times |
| 8 | Clear | n/a |
Table 2. Mapping of requirements to actions
For Requirements 4 and 5, note that clicking of the corresponding button will result in the invocation of a single method.
If two numbers are specified as input, then they are to be treated as the lower bound (left) and upper bound (right) of an inclusive range. Having the upper bound less than the lower bound is to be treated as an error. Having both numbers the same is not an error – they are the endpoints of a range of length zero.
If one number is specified, then if it is the right input, then the left input is set to 0. If the left input is specified, then the right input is set to the value of the left input.
Validation of inputs is to be done in the RecipesView class.
- Class Diagram
The class diagram for the application is illustrated in Figure 3.
Figure 3. Class diagram
Note: Use the zoom feature in Word to view the details of the class diagram in figure 3 above. You must adhere to the detailed specifications for the classes as shown in figure 3.
The mapping to packages/layers is provided in Section 3. Note that Figure 3 represents a refactoring of the class structure favoured by the NetBeans GUI Builder. Rather than having GUI creation in the GUI class definition (through the provision of a main() method, we have chosen to place GUI creation in a separate main class. If you are using the NetBeans GUI builder, all that this means is that the main() method that the GUI builder generates is moved into the Recipes class. Also note that interaction between the RecipeQueries class and the JBC library classes is not shown. This is normal for class diagrams. Finally, formal UML syntax is not strictly followed. In particular, we feel felt that method signatures as employed in NetBeans are clearer than their UML counterparts.
- Sequence Diagrams
Omitted
- Test Plan
The following tests will be performed prior to acceptance:
| Requirement | Test | Comment |
| 1 | Operation performs correctly given correct preconditions | |
| 1 | Handles no database/incorrect database | Application is to exit |
| 2 | Operation performs correctly | |
| 3 | Operation performs correctly given correct preconditions | |
| 3 | Handles incomplete field entry | |
| 4 | Operation performs correctly given correct preconditions | No data validation checks required. |
| 4 | Handles incomplete field entry | |
| 4 | Input variants as specified in Section 5 are handled correctly | |
| 5 | Operation performs correctly given correct preconditions | No data validation checks required. |
| 5 | Handles incomplete field entry | |
| 5 | Input variants as specified in Section 5 are handled correctly | |
| 6 | Operation performs correctly given correct preconditions | No data validation checks required. |
| 6 | Handles incomplete field entry | |
| 7 | Operation performs correctly given correct preconditions | No data validation checks required. |
| 7 | Handles incomplete field entry | |
| 8 | Display is cleared |
Table 3. Acceptance tests
Note:
- By preconditions, we mean that the required values are available.
- Acceptance tests coincide with class unit tests, so no separate unit testing is required.
- Testing will be conducted with the database specified in Section 4.
The post Recipe Management System Phase 1: Design Document appeared first on My Assignment Online.