diff --git a/tiddlers/content/labs/lab03/_Labs_03_Displaying the Main Menu.md b/tiddlers/content/labs/lab03/_Labs_03_Displaying the Main Menu.md index 3062f3a..54d96da 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Displaying the Main Menu.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Displaying the Main Menu.md @@ -14,4 +14,4 @@ Test the system by running the `Main` class. You should see the `MainMenu` appear. The <> button should quit the application. -Now would be a good time to commit. \ No newline at end of file +Now would be a good time to commit. Remember to reference the issue that relates to creating the Main Menu in your commit message. \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Displaying the Products.md b/tiddlers/content/labs/lab03/_Labs_03_Displaying the Products.md index f6af084..3c2b44e 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Displaying the Products.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Displaying the Products.md @@ -1,10 +1,10 @@ -New we need to make the `ProductViewer` display the products that have been saved in the DAO. +Now we need to make the `ProductViewer` display the products that have been saved in the DAO. 1. In the source view, add a field to `ProductViewer` that is an instance of your DAO class. -1. Now we need to get the product objects out of the DAO and put them into the `JList`. +1. We need to get the product objects out of the DAO and put them into the `JList`. - Since Swing components use the Model-View-Controller mechanism we need to create a *model* (not to be confused with *modal* --- they are two entirely different concepts) that will hold the data and then tell the list component about the model. + Since Swing components use the Model-View-Controller mechanism, we need to create a *model* (not to be confused with *modal* --- they are two entirely different concepts) that will hold the data and then tell the list component about the model. The default model classes in Swing are outdated and clunky, so we have written one that is a bit easier to work with: diff --git a/tiddlers/content/labs/lab03/_Labs_03_Frames & Dialogs.md b/tiddlers/content/labs/lab03/_Labs_03_Frames & Dialogs.md index f4edd76..33bf2cb 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Frames & Dialogs.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Frames & Dialogs.md @@ -8,4 +8,4 @@ Generally you have one frame that is the main window for the system and all other windows that are created are modal dialogs. This helps make the system significantly easier to create since we don't have to worry about bugs that can occur when the user has access to many dialogs at once. -In our system, the `MainMenu` frame that you should have created as a project task last week is the primary window, and all other windows will be modal dialogs. \ No newline at end of file +In our system, the `MainMenu` frame that you created as a project task last week is the primary window, and all other windows will be modal dialogs. \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Introduction.md b/tiddlers/content/labs/lab03/_Labs_03_Introduction.md index 382948d..2585ce5 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Introduction.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Introduction.md @@ -1,3 +1 @@ -In this lab we will be adding a dialog that allows the user to create and store a new product, and adding another dialog for viewing all of the products that have been entered so far. - -You might have noticed that we have added a [reference](#/Reference) section to this document. This section contains example code that you will find useful. We will continue to add to this throughout the semester, so keep an eye on it. Lab instructions will regularly refer you to this section from now on. +In this lab we will be completing the dialog that allows the user to create and store a new product, and adding another dialog for viewing all of the products that have been entered so far. diff --git a/tiddlers/content/labs/lab03/_Labs_03_Link the Product Editor to the Main Menu.md b/tiddlers/content/labs/lab03/_Labs_03_Link the Product Editor to the Main Menu.md index e1ccea3..b12f9f5 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Link the Product Editor to the Main Menu.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Link the Product Editor to the Main Menu.md @@ -4,7 +4,7 @@ 1. While you are there, add another issue reminding yourself to link the <> button to the product viewer dialog. -1. Since the product viewer dialog doesn't exist yet, add another issue reminding yourself to create that dialog. You should be treating the issue tracker as a 'to do' list. Provide sufficient detail in your issue descriptions that you will understand it what an issue refers to in 3 weeks time (which is long enough for you to have completely forgotten the context for the issue). +1. Since the product viewer dialog doesn't exist yet, add another issue reminding yourself to create that dialog. You should be treating the issue tracker as a 'to do' list. Provide sufficient detail in your issue descriptions that you will understand what an issue refers to in 3 weeks time (which is long enough for you to have completely forgotten the context for the issue). 1. Refer to the [Swing/Displaying Dialogs](#/Reference/Swing/Displaying%20Dialogs) section in the reference for the code that you need to display a dialog. diff --git a/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md b/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md index 97c3431..bf99085 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md @@ -1,9 +1,7 @@ -Milestone 1 is due next Monday (27th July) at 5:00pm - -To be fair to those students who have lab streams after the deadline, no help will be given for milestone 1 during the Monday lab sessions next week --- we will only be helping the students in the Monday streams with lab 4. +Milestone 1 is due next Monday (27th July) at 9:00am By the time you have completed this lab and the additional project tasks described in the [Project Tasks](#/Labs/03/Project%20Tasks) section you will have completed the requirements for milestone 1. -Refer to the project document (section 4.1) to verify that your project includes all of the requirements for milestone 1. +Refer to the project document (section [4.4.1](https://isgb.otago.ac.nz/info202/shared/project/raw/master/output/info202_project.html#%2FMilestones%201%20%26%202%2FMilestone%201)) to verify that your project includes all of the requirements for milestone 1. The submission instructions are on Blackboard at < Project > Submission Instructions">>. Please follow those instructions carefully. \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md.meta b/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md.meta index 360fc18..ac64bb0 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md.meta +++ b/tiddlers/content/labs/lab03/_Labs_03_Milestone 1 is Due on Monday Next Week.md.meta @@ -1,4 +1,4 @@ section: 1 -tags: lab03 +tags: lab03 lab title: /Labs/03/Milestone 1 is Due on Monday Next Week type: text/x-markdown \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md b/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md index 7ae3336..e73ad6c 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md @@ -8,7 +8,7 @@ Return the new field in the `getCategories` method. - * Use a new `SimpleListModel` object to get the data into the category combobox on the `ProductEditor` dialog. It is the same process that you used to get the products into the product view dialog. + * Use a new `SimpleListModel` object to get the data into the category combobox on the `ProductEditor` dialog. It is the same process that you used to get the products into the product viewer dialog. 1. Add a new DAO test to your existing test class to test that your new method returns categories correctly. @@ -20,21 +20,19 @@ * A sequence diagram for the 'view all products' use case. It should show the flow of interactions from the user clicking the button on the menu, through to the dialog being displayed, and the products being loaded into the list. - Create a new folder in the root of your project named <>. You can use < New File > Other > Folder">> to add the folder to your project. Create the diagrams inside this folder. + Create a new folder in the root of your project named <>. Save your `puml` files in this folder. - If you have the PlantUML plugin installed in NetBeans then you can use that to create the files. If not, you can use < New File > Other > Empty File">>, and use the file extension `.puml`. Each of the diagrams should be created in a separate file. + You can use VS Code in the lab, or your own version (assuming you have the PlantUML plugin installed) to create the diagrams. If you have not taken INFO201 then refer to [lab 1](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#/Labs/Lab%2001/Software%20Installation:%5B%5B/Labs/Lab%2001/Software%20Installation%5D%5D%20%5B%5B/Labs/Lab%2001/Plugin%20Configuration%5D%5D) of INFO201 for instructions on installing and configuring VS Code and the PlantUML plugin. - You were shown how to create sequence diagrams in INFO201. If you need a refresher or you have not taken INFO201 then there is a section in the reference document ([PlantUML/Sequence Diagrams](#/Reference/PlantUML/Sequence%20Diagrams)) that contains a quick tutorial on creating these diagrams. You can also look at lecture 13 from INFO201 (available on the INFO202 Blackboard under < Revision material > INFO 201">>). - - The NetBeans PlantUML plugin in the labs (both the Linux lab and the student desktop) should work fine. - - The plugin that you have on your own personal computers from last semester is a little bit buggy, so you may prefer to use one of the following online editors, and copy and paste between the online editor and the file in your NetBeans project. This is also true if you don't have the plugin installed at all. + If you don't have VS Code installed then you may prefer to use one of the following online editors and copy and paste between the online editor and the file in your project (via a different text editor): * https://plantuml-editor.kkeisuke.com/ * https://www.planttext.com/ * https://sujoyu.github.io/plantuml-previewer/ * http://www.plantuml.com/plantuml/ - Make sure that your diagrams are pushed to GitBucket. You don't have to do anything special here --- just commit the project, and push as per usual. + You were shown how to create sequence diagrams in INFO201. If you need a refresher or you have not taken INFO201 then there is a [sequence diagram review exercise](#/Review/Diagrams/Sequence%20Diagrams) that contains a quick tutorial. You can also look at lecture 13 from INFO201 (available on the INFO202 Blackboard under < Revision material > INFO 201">>). + + Make sure that your diagrams are committed pushed to GitBucket. You don't have to do anything special here --- just commit the project, and push as per usual. You should be able to see and view your diagrams via the GitBucket user interface. 1. Don't forget to complete all four domain classes. The complete domain model including the methods, and relationships is part of milestone 1. \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md.meta b/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md.meta index eb311e0..40ea92f 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md.meta +++ b/tiddlers/content/labs/lab03/_Labs_03_Project Tasks.md.meta @@ -1,4 +1,4 @@ section: 7 -tags: lab03 +tags: lab03 lab title: /Labs/03/Project Tasks type: text/x-markdown \ No newline at end of file diff --git a/tiddlers/content/labs/lab03/_Labs_03_Testing the Product Data Access Class.md b/tiddlers/content/labs/lab03/_Labs_03_Testing the Product Data Access Class.md index 9f51fef..ada0553 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_Testing the Product Data Access Class.md +++ b/tiddlers/content/labs/lab03/_Labs_03_Testing the Product Data Access Class.md @@ -1,41 +1,73 @@ -[Lab 9](https://isgb.otago.ac.nz/infosci/INFO201/labs/raw/master/INFO201_Labs.html#%24%3A%2Flabs%2Flab09%2Ftoc) in INFO201 was a fairly comprehensive overview of automated testing. Rather than go over all of that again, we will point you to the relevant bits of that lab. +[Lab 9](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#%2FLabs%2FLab%2009%2FLab%209%3A%20Testing%20in%20Java) in INFO201 was a fairly comprehensive overview of automated testing. Rather than go over all of that again, we will point you to the relevant bits of that lab. Those of you who have not taken INFO201 (and those of you who have forgotten how to do automated testing) should at least have a quick read through that lab --- automated testing is something that you should know about. 1. Add an issue to GitBucket that describes that you need to create automated tests for the `ProductCollectionsDAO` class. -1. We need to modify the build script to include the libraries for testing. Replace the contents of your `build.gradle` file with the following (delete everything in that file and replace it with the code below): +1. We need to modify the build script to include the libraries for testing. It is time that we fixed up the outdated Gradle code that NetBeans generated when the project was created, so replace the entire contents of your `build.gradle` file with the following (delete everything in that file and replace it with the code below): - ```java - plugins { - id 'application' - id 'jacoco' - } + ```gradle + plugins { + id 'application' + id 'jacoco' + } - repositories { - jcenter() - } + repositories { + mavenCentral() + } - dependencies { - def junitVer = '5.6.2' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVer - testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVer - testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2' - } + dependencies { + def junitVer = '5.7.2' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVer + testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVer + testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2' + } - test { - useJUnitPlatform() - } + test { + useJUnitPlatform() + } - run { - standardInput = System.in - } + run { + standardInput = System.in + } - mainClassName = 'Main' + task openProjectFolder { + group = "Directories" + description = "Open the project root in the system file manager." + doFirst { + println('Opening: ' + file(projectDir)) + java.awt.Desktop.getDesktop().open(file(projectDir)); + } + } + + def ignored=""" + .gradle + build + *.zip + *.tgz + """ + + task createGitIgnore { + group = "Git" + description = "Create the project's .gitignore file." + doLast { + def file = new File(projectDir, ".gitignore") + if ( !file.exists() ) { + println('Creating .gitignore') + file.text = ignored + } else { + println('.gitignore already exists') + } + } + } + + + mainClassName = 'Main' ```` + 1. Save the `build.gradle` file and rebuild the project using < Build">>. You should see Gradle downloading the necessary libraries by clicking the <> notification at the bottom right of the NetBeans status bar. You will need to wait for that process to complete --- there aren't many libraries so it should be fairly quick. -1. Generate the test classes as shown in section [2.3](https://isgb.otago.ac.nz/infosci/INFO201/labs/raw/master/INFO201_Labs.html#%24%3A%2Flabs%2Flab09%2Ffirst_experiments_create_test_class) of INFO201, lab 9. +1. Generate the test classes as shown in section [2.3](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#%2FLabs%2FLab%2009%2FCreate%20the%20test%20class) of INFO201, lab 9. You will be using your DAO class rather than the `Calculator` class that is described in that section. @@ -49,9 +81,9 @@ You should see that all three tests fail. -1. Implement and test each test, one by one. Remove the `fail` call when you think you have finished a test. Section [3](https://isgb.otago.ac.nz/infosci/INFO201/labs/raw/master/INFO201_Labs.html#:%24%3A%2Flabs%2Flab09%2Finvoicing_domain_classes%20%24%3A%2Flabs%2Flab09%2Finvoicing_test_invoice%20%24%3A%2Flabs%2Flab09%2Finvoicing_test_data_persistence) of the INFO201 lab has a fairly similar example --- swap `Invoice` for `ProductCollectionsDAO` and `InvoiceItem` for `Product` and you are most of the way there. +1. Implement and test each test, one by one. Remove the `fail` call when you think you have finished a test. Section [3](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#%2FLabs%2FLab%2009%2FMore%20comprehensive%20example:%5B%5B%2FLabs%2FLab%2009%2FMore%20comprehensive%20example%5D%5D%20%5B%5B%2FLabs%2FLab%2009%2FTesting%20Invoice%5D%5D%20%5B%5B%2FLabs%2FLab%2009%2FTesting%20with%20persistent%20data%5D%5D) of the INFO201 lab has a fairly similar example --- swap `Invoice` for `ProductCollectionsDAO` and `InvoiceItem` for `Product` and you are most of the way there. - Since the DAO collection is static you will need to use the `tearDown` method to remove all of the test products from the DAO (refer to section [3.3.2.1](https://isgb.otago.ac.nz/infosci/INFO201/labs/raw/master/INFO201_Labs.html#%24%3A%2Flabs%2Flab09%2Finvoicing_test_data_persistence) of INFO201 lab 9 for an explanation). + Since the DAO collection is static you will need to use the `tearDown` method to remove all of the test products from the DAO (refer to section [3.3.2.1](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#%2FLabs%2FLab%2009%2FTesting%20with%20persistent%20data) of INFO201 lab 9 for an explanation). Create three products in the `setUp`, but only save two of them in the DAO object. This gives you some data to test the `removeProduct` and `getProducts` methods with. The third product that has not been saved can be used to test your `saveProduct` method. diff --git a/tiddlers/content/labs/lab03/_Labs_03_The Product Data Access Class.md b/tiddlers/content/labs/lab03/_Labs_03_The Product Data Access Class.md index c13d4db..51fc47c 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_The Product Data Access Class.md +++ b/tiddlers/content/labs/lab03/_Labs_03_The Product Data Access Class.md @@ -14,7 +14,7 @@ 1. Create a class in the `dao` package. Name the class `ProductCollectionsDAO` since it is a DAO class that will store products using collections. -1. We need a place to store the product objects. The best way to do this is to use a `private`, `static`, `ArrayList` field. The field will hold the products, so name it appropriately (use a plural to indicate that the field holds many products). +1. We need a place to store the product objects. The quickest way to do this is to use a `private`, `static`, `ArrayList` field. The field will hold the products, so name it appropriately (use a plural to indicate that the field holds many products). Don't forget to initialise the field (unless you enjoy debugging null-pointer exceptions). @@ -34,7 +34,7 @@ If not, fix it now. -1. Did you remember specify the 'type' of the collections? +1. Did you remember to specify the 'type' of the collections? You should be using the angle bracket notation to specify what type of objects your collections are expecting to hold. diff --git a/tiddlers/content/labs/lab03/_Labs_03_The Product Viewer Dialog.md b/tiddlers/content/labs/lab03/_Labs_03_The Product Viewer Dialog.md index 06a74d8..5c92ad2 100644 --- a/tiddlers/content/labs/lab03/_Labs_03_The Product Viewer Dialog.md +++ b/tiddlers/content/labs/lab03/_Labs_03_The Product Viewer Dialog.md @@ -1,4 +1,4 @@ -We need a dialog that allows a user to view the products that have been entered into the system. Take a quick look at the mock-up of this dialog in the product specification document (section 1.1.2.3) so that you know what you are aiming for. +We need a dialog that allows a user to view the products that have been entered into the system. Take a quick look at the mock-up of this dialog in the product specification document (section [4.1.2.3](https://isgb.otago.ac.nz/info202/shared/project/raw/master/output/info202_project.html#%2FMilestones%201%20%26%202%2FViewing%20Products)) so that you know what you are aiming for. 1. Add a new issue to GitBucket. We are about to start work on the dialog that allows the user to view the products, so name/describe the issue appropriately.