1. IntroductionXYZZY 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 2 system. 2. RequirementsBecause 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 functional requirements for the Phase 1 system were as follows:1. Start the application and connect to the database2. Close the database connection and stop the application3. Display all recipes for a particular category (meat, fish, vegetarian)4. Display all recipes for a particular category with a preparation time within a specified range5. Display all recipes for a particular category with a combined preparation and cooking time that is within a specified range6. Display the number of recipes that have a specified ingredient as its key ingredient7. Add a new recipe to the database.8. Clear the displayIn addition, the application had to conform to the MVP architecture. In Phase 2, the application is to be refactored to conform to the MVC architecture. Also, an additional requirement has been added:9. The output from the queries that return recipes is to be browsable and browsing is to be cyclic.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.

3. ArchitectureAn 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 4. Database / Data Access DesignThe 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:

5. GUI DesignDevelopers 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. The required actions for each requirement are summarised in Table 2.Figure 2. Indicative GUI

Functionality Swing ComponentsOutput JTextAreaInput JLabel, JTextFieldOperations JButtonTable 1. Mapping of GUI functionality to Swing component types.Requirement Button Inputs Required1 n/a n/a2 Exit None3 Category Category4 Category and Preparation Time Category and Preparation times – see below5 Category and Combined Time Category and Combined Times – see below6 Main Ingredient Main Ingredient7 Add All, except for right-most Preparation and Cooking times and Combined Times8 Clear n/a9 Previous, Next n/aTable 2. Mapping of requirements to actionsFor 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.Note that in this version, if a query returns a list of recipes, then that list is to be browsable using the previous and next buttons with output appearing in the appropriate input text fields, as in the Address Book case study. The text area is still used but only for the display of error messages, status messages and the output of non-query commands, such as Add. Example screen shots are shown below:

Figure 6. Example display after new recipe added. 6. Class DiagramThe class diagram for the application is illustrated in Figure 3.Figure 3. Class diagramThe 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 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. 7. Sequence DiagramsOmitted

8 Display is cleared Note that only the view is cleared9 Browsing is cyclicTable 3. Acceptance testsNote:1. By preconditions, we mean that the required values are available.2. Acceptance tests coincide with class unit tests, so no separate unit testing is required.3. Testing will be conducted with the database specified in Section 4.

Disclaimer

AustraliaBestTutors.com provides assignment and homework help for guidance and reference purpose only. These papers are not to be submitted as it is. These papers are intended to be used for research and reference purposes only.