CP31010: Fundamentals of Software Engineering BGAZM Team: Adrian Zatta Angela McCarthy Anthony Bath Matthew Grasso
Presentation Overview Introduction Software Development Team Background Problem Definition Issues Solutions Threat Model Prototyping Environments Java C# Use Case Analysis Business Rule Integration Use Case Design High Level Design Use Case Implementation Low Level Implementation Code Review Peer Review Closing
Background Townsville Tavern and Brewery Tavern hours Sun-Thurs 10AM – Late Fri-Sat ( *and special events ) 10AM – 3PM Brewery hours Mon-Sun 9AM – 7PM Townsville Tavern and Brewery stocks and sells various alcoholic beverages Brewery also supplies local pubs in the region and exports Australia- wide
Problem Definition Issues Stock and Inventory handled manually Counted at the end of each night, inventory adjusted accordingly Orders: Importing and exporting done manually Takes up time Large cost on business due to excess manual labour and large hours
Problem Definition Solutions Supply Chain Management System Keeps accurate count of stock Inventory adjusted when stock scanned out/in Automated/scheduled ordering of stock Reduces cost – procedures automated Reduces time – removes the need for manual counts
Problem Definition Threat Model ThreatRisk ValueCounter Measures Unauthorised Users4 System kept behind counter, away from public access. System stored on private machine Data Corruption5 System keeps backups to revert to in the event of data corruption. User Errors3 Staff to be trained to ensure errors do not occur. Risk high when system first introduced, but risk will be reduced with time and training. Data Connectivity6 If system cannot connect to database, will instead update a database on local system. Local system will then update main database once connection re-established. Loss of Data/Resources 4 To minimize the risk of loss of data/resources (such as natural disasters, eg. cyclone, fire), all data records are backed up externally from the site. These then can be easily accessed to replace lost data.
Architectural Representation Client Server Client PC (Windows) Client PC (Windows) Client Software (Software requirements) Client Software (Software requirements) Data Storage Unit
Software Requirements Create inventory items Edit inventory items Delete inventory items Display inventory amounts Edit inventory amounts Automatic inventory update Automatic stock ordering.....
Use Case - Create Inventory Item – Goals and Constraints Constraints: The User is at the “Create Inventory Item” UI and has entered details of new item. Goal: The inventory item has been added to the data storage unit.
Use Case View – Create Inventory Item Item details Confirms details Data Access Object Persisten t Storage Create Inventory Item Delete Inventory Item Item details
Use Case – Create Inventory Item Primary Actor: User Secondary Actors: N/A Pre-Condition:The User is at the “Create Inventory Item” UI and has entered details of new item. Goal:The inventory item has been added to the data storage unit. Main Path 1. The User clicks the “Create” button. 2. The system validates the details that were entered. 3. The system confirms the new inventory item does not exist on the data storage unit. 4. The system adds the new inventory item to the data storage unit. 5. System returns to Manage Inventory Display. Extensions 1.1 User clicks “Cancel” and returns to Manage Inventory Display. 2.1 If inventory item details are incorrectly filled in, a message is displayed. 2.2 Return to step 2 of the Main Path. 3.1 If the inventory item already exists, a message is displayed 3.2 Return to step 2 of the Main Path.
Use Case – Create Inventory Item Supporting User Interface
Use Case Analysis, Design and Implementation UIManageInventory Main menu UI for the management of inventory including Creation Editing Deletion Simply extends JFrame and contains 4 Jbuttons and a JLabel (heading, purely aesthetics) Due to the custom nature of the design, layout managers were not utilized instead absolute positioning was implemented
JButton JLabel JFrame
Use Case Analysis, Design and Implementation UICreateInventoryItem This is the UI that was seen two slides ago Again extends JFrame and contains JButton, JTextField and JLabel components Text fields accept user input in the form of a String data type Buttons used for progression (Create) and regression (Back) Singleton pattern used for all UI’s to prevent multiple instances
JButton JTextField JLabel JFrame
Use Case Analysis, Design and Implementation UCCreateInventoryItem Contains the code to implement the Create Inventory Item Use Case that Matthew discussed Implements a Use Case Controller which has a single abstract function run() Adapter pattern utilized for “attaching” use cases to buttons ie UCC-> ActionListener Adapter This allows use cases to be ran when user clicks a button In the case of this use case, it is run when the user clicks “Create” from the Create Inventory Item UI
Use Case Analysis, Design and Implementation InventoryDAO Data Access Object to read and write to data storage unit (DAO Pattern) Contains all the SQL queries in functions createInventoryItem(InventoryItem newItem) Etc (unrelated to this UC) Contains validation rules for length of fields, exists or not, etc
Use Case Analysis, Design and Implementation Datafiles Overview For this use case, there is a single data source User input via keyboard/mouse Validation is used to ensure all fields are filled in and new item doesn’t already exist in DB No output files are generated No initialization files are required
Use Case Analysis, Design and Implementation Dataflow For this use case, there is only one simple direction of data flow: User enters the data via the keyboard into the UI, then clicks the button to allow the item to be created on the data storage unit UI User Data Storage Unit
Use Case Analysis, Design and Implementation Data Storage A MySQL database running on a local server at the client’s business This is to allow for efficient data transfer over a Local Area Network Off-site back-up exists for record-keeping in the case of corruption or loss of data due to disasters
Prototyping Environments Java C# Portability Used across multiple platforms Portability.NET
Software Demonstration
Code Review Class Problem private void makePanel() { tabbedPane = new JTabbedPane(); itemTabbedPane = new JTabbedPane(); createItemTextField = new JTextField(20); deleteItemTextField = new JTextField(20); JPanel createItemPane = new JPanel(); GridLayout experimentLayout = new GridLayout(0,2); createItemPane.setLayout(experimentLayout); JLabel createItemHeader = new JLabel("Create New Item"); JLabel blank = new JLabel(""); createItemButton = new JButton("Create Item"); UCCreateItem ucCreateItem = new UCCreateItem(this); createItemButton.addActionListener(new UCCToALAdapter(ucCreateItem)); createItemPane.add(createItemHeader); createItemPane.add(blank); createItemPane.add(createItemTextField); createItemPane.add(createItemButton);...
Code Review Function Problem public function addInventoryItem() { $theDisplay = new DisplayUI(); $theDisplay->displayAddItemForm(); $this->viewInventory(); } public function submitInventoryItem($iname,$iqty) { $theDisplay = new DisplayUI(); $this->pharseQ( "INSERT INTO inventory (`item_id`, `item_name`, `item_qty`) VALUES (NULL, '". $iname. "', '". $iqty. "')"); echo " Item Submitted \n"; }
Code Review Error Handling $sql="INSERT INTO Customer (Customer_Name, Customer_Password, Customer_ ) VALUES ('$_POST[formusername]','$_POST[formpassword]','$_POST[form ]')"; if (!mysql_query(($sql,$con)) { die('Error: '. mysql_error()); }
Code Review Variable Problem private static Container frame1; frame1 = getContentPane(); frame1.add(BorderLayout.NORTH, new HeaderField()); frame1.add(BorderLayout.WEST, new SideAdd()); frame1.add(BorderLayout.CENTER, new TabField()); jLabel1 = new javax.swing.JLabel(); (unused)
Questions?
Thank you