Fall '21 Week 3

Resources

Edited Transcript

Hello, and welcome to the week three announcements video for CC 410 in Fall 2021, so you should be wrapping up at this point, the second module. So we have object oriented programming and the example. And then you also should be submitting the first milestone for the restaurant project. So hopefully that went well, it was a lot of building classes and objects in your code. I’ll be going through over the next day or so and doing a deep dive into all of your code, giving you some feedback on GitHub, as well as feedback in Canvas on ways that you can improve the code and get better. Also, please refer to the syllabus it does talk a little bit about the grading in this class. The big thing is once I grade it and give you feedback, you won’t be able to resubmit it for more points on that project. But you should try and improve any of those things that I point out for your next milestones. Although generally, I don’t hold you under double jeopardy, where if I take off in one milestone, I won’t take off again in a future milestone for the same problem unless it impacts what you’re doing in that milestone as well. So kind of keep that in mind. But hopefully, you should be able to take this feedback and use it to improve your code, your style and your structure as you go forward.

So this week, we’re working on Module Three, talking all about documentation, testing, and UML diagrams. We’ll have an example around documentation and unit testing. And then the second restaurant milestone is all about adding unit tests to your project. So for updates in this class, don’t forget, you can join our discord channel, there’s a great chance to have discussions there. Hopefully you’re on that channel. But if not, feel free to join. Also on grading, don’t forget that I’ll leave both comments on Canvas with the rubric. But also leave comments in GitHub. And if you have trouble finding the GitHub comments there in the feedback pull request. So in your GitHub repo, you click the pull requests at the top, and then go to the feedback pull request, and it will tell you all about my code comments. Otherwise, hopefully, things are going well. If you have any questions on finding any of these comments, please let me know.

For the second milestone, you’re going to be working on unit tests. Last semester, in the previous milestone, it was around 423 unit tests, I think this one’s going to be similar. So you should be in the range of about 400 to 500 unit tests in total. You’ll also be adding documentation comments to your code. So you can generate the documentation using javadoc or pdoc. You’ll also create a UML class diagram for your project. So a lot of this is not necessarily changing the code, but adding tests and documentation to the code. This one can take anywhere from three to eight hours to complete or maybe even longer, depending on your comfort level. And it’s rather large. When I did this last semester for the project, it was around 3500 to 4000 lines of new code, a lot of that is going to be either in unit tests or documentation comments that can be copy pasted, so it seems like a lot, but if you work your way through it, it makes a lot of sense. As with the previous milestone, I highly recommend going through and doing one of the large restaurant items first. For example, I think the He Man is the pizza that has almost everything on it. So do that one first, get the unit tests for it working. And then you should be able to use a lot of those unit tests to fill out the rest of the pizzas, and so on. Also, please feel free to give me any feedback on these milestones. I try and make the milestone assignments pretty clear what I’m trying to get to without giving you a lot of hints of how to get there. So if anything is unclear, please feel free to send me feedback. I’m always working on ways that I can improve these milestones to make them easier for you to work with and understand.

Some other hints for milestone two, the biggest hint that I will give you is do not look at the source code for your original classes when you’re writing unit tests. I know that that may sound a little counterproductive on the surface. But here’s what I mean. For example, if a pizza is supposed to be $10.95, don’t get that number from your source code, go back to the original menu in milestone one and get the number there and write your unit test using that number. Likewise, if a pizza is supposed to have certain ingredients and toppings, make sure you get that list from the original assignment not from your source code. Otherwise, you’re simply testing that your source code says what it says instead of saying what it should say, I think I’m a pretty decent programmer. But I had over a half dozen errors in my source code for this project the first time I did this. So it’s really worth your effort now to make sure your unit tests are checking and fixing a lot of those errors. Another thing you can do is use global attributes in your code and generalize some of your projects. So I’ll take a look at that. And also, don’t be afraid to generalize some of your unit tests you should be able to parameterize your unit tests across the crusts and sizes. But you won’t be able to do the individual ingredient toppings on the pizza itself. You can do the vegetable toppings, but not some of the meat toppings. So you can look at the enum parameterized tests as ways that you can do that.

When I talk about generalized tests, here’s a quick, kind of a piece of the solution from last semester. For example, if you want to test the price and the calories in a particular item, instead of hard coding those into the test itself, you could create some private variables at the top of your test class and fill in that data there. And so that way, you can actually just copy paste the test methods and change little bits like you can do a global Find and Replace for the Riker to be whatever class. But then when you duplicate this class, all you have to do is change the variables at the top to match the actual price and calories. This can make it a little bit easier to copy paste code between all the different classes. Hopefully, this makes sense if it doesn’t start working on your unit tests, and then come back to this. And I think it will start to make a lot more sense what I’m talking about here.

So looking ahead from this point, the next few modules will talk about inheritance and object oriented programming, which is really big topic. We’ll spend some time in module five talking about debugging. And we’ll also do a quick final project update. Module six, we’ll switch over to do graphical user interfaces, and we’ll talk about Event Driven Programming and etc. And we’ll kind of go from there.

So that’s all we’ve got for this module. It’s a lot of testing your code. Hopefully this is really useful. One of the things I hear a lot from people in industry that have come out of our department is they wish they would have learned more unit testing. And so that’s one of the big reasons we’re focusing a lot on unit testing now in this class and its companion CIS 400 is because it is something really important that you’ll see out in industry. So I wish you the best of luck on this mod– on this milestone. If you have any questions, let me know and otherwise, I will see you next week.