ECE 448/528 – Application Software Design Lecture 02 Software Engineering and SaaS Professor Jia Wang Department of Electrical and Computer Engineering Illinois Institute of Technology January 12, 2022 1/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Outline Software Engineering and SaaS Course Project Introduction 2/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Reading Assignment I This lecture: Project Instruction, Guide to System Setup and Work Flow I Next lecture: Java Overview 3/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Outline Software Engineering and SaaS Course Project Introduction 4/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Software I What is the difference between software and programs written for (other) course projects? I More features? Better quality? Higher performance? I Software is designed in a way so it can be improved and reused. I Software engineering practices attempt to define a process to reduce the overall risk. 5/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT The Waterfall Model I A conventional process of software development. Stage 1. Requirements Analysis and Definition Stage 2. System and Software Design Stage 3. Programming and Unit Testing Stage 4. Integration and System Testing Stage 5. Operation and Maintenance I Waterfall: never go back and revise previous stages I Advantages I Detailed planning for time/personnel/budget within the constraints I Goals are well-defined within each stage 6/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT The Waterfall Model: Challenges I I Requirements analysis and definition assumes that clients know what they want. I Not quite true as clients usually learn how software can actually help them during the development process. I System and software design assumes that some expert can make a feasible plan. I There may not be an expert if you are building something new or if you cannot afford one. I Integration and system testing assumes the developers can resolve issues quickly among themselves. I Communication is required but expensive, especially when people leave or enter the team. 7/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT The Waterfall Model: Challenges II I Demo is only possible after integration and system testing. I Too late and very risky if delay happens. I Operation and maintenance could be difficult. I As bugs may come from OS and supporting libraries, upgrading may break the whole system. I May need to support multiple versions of software as end users may not want to upgrade. I Overall not flexible for the rapidly changing world nowadays. 8/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Application Software I In order to address the issues with the waterfall model, it is important to look into its product first. I Software, in particular application software. I Typical application software: spreadsheet, games, photo editor, finance, and so on. I Things in common: for the end users, intuitive to use without much training. I Trends I Run from anywhere. I Access data from anywhere. I Connect with other people. 9/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Software as a Service (SaaS) I Cloud computing for end users. I The server (backend) I Run on the cloud. I Managed by professional to support application features that end users are not able to/not willing to maintain. I The client (frontend) I Run on devices owned by end users. I As web or mobile applications. 10/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT SaaS is Helpful I Development I Since the server will run in a chosen environment, there is less concern of supporting different versions of OS, database, etc. I A centralized server usually makes communication and sharing between end users much easier. I Operation and Maintenance I Easy client update: web applications are delivered instantaneously, while mobile applications can be delivered overnight. I Allow to roll out new features to a small group of clients for testing first. I The server can be updated without being noticed by the clients. I Overall, Saas enables one to deliver software that changes very frequently in order to meet demands from customers. I But how could one make such software? 11/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Agile Software Development I A set of software development methods that teams may choose to satisfy their needs for a specific project. I Our choices: I Iterative and incremental development (IID) I Test-driven development (TDD) I Continuous integration (CI) 12/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Iterative and Incremental Development (IID) I An incremental/iterative cycle: build a small portion or make a small revision. I The whole system can be assembled and improved across multiple cycles. I Progress can be demonstrated at the end of each cycle. I Incorporate new customer requirements arise from previous cycles in the next cycle. I Utilize new understandings learned from previous cycles in the next cycle. I Allow us to make progress without knowing much of the project. I Within each incremental/iterative cycle, the waterfall model can be applied. I Changes are limited – much less risky than applying it to the whole system 13/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Test-Driven Development (TDD) I Unit testing: for a small unit, e.g. a class I Serve as an executable specification of your code, more precise and consistent than documents in plain English. I Integration testing: for the whole system I A good chance to demo to clients and to communicate with them to understand their requirements. I Acceptance testing: determine whether requirements are met. I Test-driven development I Tests are created before writing the code. I The whole system is decomposed into testable pieces. I We require unit testing with reasonable coverage and grade your project by acceptance testing. 14/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Continuous Integration (CI) I Manual unit testing is tedious. I Need to run many tests and wait. I Manual integration testing is difficult. I Especially if the team is big or the production environment differs from the development environment. I However, frequent testings are always desired to guarantee good quality. I Continuous integration: enable automated and frequent testing in production environment. I As frequent as anyone like while requiring little to no effort from developers. The only constraint is the available computational resource for testing. I A CI system usually depends on a revision control system, which provides additional benefits of storing all versions of your source code. I We use Git as the revision control system and utilize a CI system to test your projects against grading test cases. 15/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Outline Software Engineering and SaaS Course Project Introduction 16/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Smart Hub for Internet of Things I An application that allows end users to monitor and control their IoT devices. I We will focus on the software part. You may take ECE 442 if you are interested in IoT hardware. I Open source solutions like Home Assistant exist but we would like to build our own to learn application software development. I Goals I End users can use the application on most devices. I End users may choose to send device information to the cloud so the devices can be access from almost anywhere, or I End users may choose to keep device information local for privacy reasons. I In such case, the application should work without Internet connections. I The application can manage any IoT devices and may interoperate with other software. 17/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT The IoT Hub I Our solution based on SaaS. I The server backend (Project 4 and 5) I Communicate with IoT devices I Run in the cloud, or on-premises for privacy reasons. I The client (Project 6) I Communicate with the server backend. I Does not communicate with individual devices directly. I A frontend web application. I Work in a browser. No need to install. I No need to develop apps for different mobile platforms. I Open protocols I Use MQTT middleware to support communication between the server and the IoT devices. I The server provides RESTful services for the client and other software to monitor and control devices. 18/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT The IoT Simulator I There should be IoT devices for our IoT hub to work with. I Actual IoT devices are not prefered. I Not practical for our course work. I May lead to a server that only works with one kind of IoT devices but not all. I Build a simulator of our own to simulate desired IoT devices. I Only support open protocols that many IoT devices support. I For simplicity, let’s just build a simulator for smart plugs that can be switched on or off and can measure the power. I Moreover, the simulator will have its own web application that can work without the IoT hub. I Project 1-3: a good practice to warm us up with Java, networking, and HTML pages. I Is it possible to extend the simulator into firmware of actual smart plugs? 19/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Extensions I Project 7: optional for ECE 448 but mandatory for ECE 528. I Improve our IoT hub with advanced features. I Secure communications via TLS/HTTPS. I Alexa integration. I Data persistence via databases. I Visualize real-time power consumption. I Or features with similar complexity of your own choice. I An open-ended project with details to be released later. 20/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Hints for Project 1 I src/main/java/ece448/iot_sim/PlugSim.java I See what member variables and methods are provided. I Think what they are supposed to do. I src/test/java/ece448/iot_sim/PlugSimTests.java I Add unit tests here. I src/main/java/ece448/grading/GradeP1.java I This contains the grading test cases. I You are not supposed to modify this file. I But you may learn more about the class PlugSim here. 21/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT Practicing TDD for Project 1 1. Create more unit tests in PlugSimTest.java I Using testInit and testSwitchOn as examples. I Each unit test is a method annotated with @Test. I Create a PlugSim object and call some of its methods. I Use assertFalse or assertTrue to verify the results. I Feel free to choose meaningful method names. 2. Modify PlugSim.java to make unit tests pass. I Locate // P1: add your code here and add code there. I Run grading test cases using gradle grade_p1. I For any failing grading test case, refer to GradeP1.java to understand why. I Create more unit tests to isolate the issue and then make them pass (refer to the items 1. and 2. above). I See if the grading test case passes now. I These are simplified but typical red, green, refactor cycles that many developers use daily to move their projects forward. 22/22 ECE 448/528 – Application Software Design, Spring 2022, Dept. of ECE, IIT