Fall '23 Week 3

Resources

Edited Transcript

Hello and welcome to the Announcements video for CC 410 in Fall 2023 on week three. So this week you should be wrapping up the second module, which is the first restaurant milestone, which is on object oriented programming. There’s a short example that you should do working with the short Little Sunday Shop. That’s kind of fun. Don’t forget on that one, you need to actually create the second class yourself. It’s not covered in the video, so make sure you get that done. And then the first restaurant milestone should be due, so hopefully you’re getting that done as well. Also, if you haven’t scheduled the first meeting for the final project, make sure you do that this week. You definitely want to meet with me on Zoom so we can chat about the final project and make sure everything’s set up there. So if you haven’t done that, please make sure you do that.

This week. We’re going to have a module talking about documentation, introducing the concepts of unit testing, and talking a little bit about UML diagrams. There’s an example project that talks about documentation and unit testing. And then you’ll do the second restaurant milestone, which is all about including unit tests in your project. So for the second milestone, you should be adding about 400 unit tests to the project. Your number may vary depending on the size of your project and how you do it. You should also be adding documentation comments to your project and creating a UML class diagram. My estimation is this should take anywhere from three to 8 hours to do, depending on your background, and this may involve anywhere from 3500 to 4000 lines of code. However, a lot of those lines of code are unit tests and documentation comments. A lot of that is repetitive code that you can copy, paste and then tweak between the different classes. So don’t try and focus on writing all of this from scratch. Write the parts that you need and then copy paste it and build out the classes. The you should you’re really trying to focus on working smarter, not harder here, because it would take forever to write all this out by hand. So hopefully the milestone makes sense. I give you some tips on various unit tests you might want to include. And as always, feedback is welcome if there’s something unclear in any of the milestones. It.

Some other big hints for this milestone. First and foremost, I encourage you not to look at your source code. What I mean by that is when you’re writing your unit tests, for example, you’ll have a unit test that checks the price of various items on the menu. Don’t look at your source code to figure out what that price is. Look back at the original menu from milestone one. If you have a typo in the price in your source code, you’re going to have that same typo in your unit tests and you’re not actually they’re going to check anything. And so when you’re writing your unit tests, you should go back and look at the actual menu and not your source code. When you write your unit tests, another thing you can do is use global attributes, especially in the unit tests. For example, the unit test to check the price is the same in every class. But at the top you could have a global variable that says this is the price for this class, or this is the price for small, this is the price for medium. And then you can use those global attributes elsewhere there. That way it makes it easy. You can just copy paste all the source code, change those global attributes, and it will run the unit tests. You can also generalize things. There are some unit tests that you can use that are parameterized, but you cannot generalize the ingredients in the entrees. So, for example, on one of the entrees that has ham and cheese as separate ingredients, it’s really hard to generalize that. There are some things you can do with code reflection. I don’t recommend trying to do it, it’s really complex. But things like the toppings and things like some of the sizes, you can use parameterized tests for that. And so this slide gives you kind of an example of what I mean by generalizing your tests. For example, this is a test that checks the price and the calories for an item. These are not correct. This is from an old project, but it gives you the idea of having these global price and calories variables. And then you’ll notice the code below. Really the only thing you have to changes the name of the object and everything else goes really well. So this is generalized. You could copy paste this, do a quick find and replace it’s pretty quick.

So beyond that, after this week we’ll talk a little bit about inheritance. Next week we’re going to refactor some of our code to take advantage of inheritance. We’ll spend some time talking about debugging. And that gets us to the end of September, where you’ll have your next check in on the final project. And then as we go into October, we’ll spend some time on design patterns, test doubles, and then we’ll switch over and talk about user interfaces, web and et cetera. So this project is all about testing, so hopefully you’re able to write lots of good unit tests for your project. If you have any questions, comments or concerns, feel free to let me know. Otherwise, good luck this week and I will talk to you all again next week.