1 / 8

The Evil of If Statements

The Evil of If Statements. As you arrive… Email your assigned UTA to set up a design review meeting if you haven’t already! If you don’t have an assigned UTA – plan to talk with me before/after class. What We Will Do Today.

teresa
Télécharger la présentation

The Evil of If Statements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Evil of If Statements As you arrive… Email your assigned UTA to set up a design review meeting if you haven’t already! If you don’t have an assigned UTA – plan to talk with me before/after class.

  2. What We Will Do Today • You will remove some ugly code using subclasses in the exercise from last time • You will be aware of 2 Different Perspectives on Object Orient Design, as exemplified by our 2 papers on Friday • You will be able to identify problematic if statements, and you’ll be ready to apply those insights to Project 1.

  3. Exercise from last time • Snarf the code if you haven’t already • Use subclasses (a la the shapes in the open/closed principle paper) to refactorbetIsMade and placeBet Game.java • If you have trouble, check out the HINTS.txt file for 3 levels of hints • If you still have trouble, raise your hand • When you’ve got it working, submit your code via Ambient (it’s in the eclipse menu “Ambient->Submit a Project for Grading”)

  4. What We Will Do Today • You will remove some ugly code using subclasses in the exercise from last time • You will be aware of 2 Different Perspectives on Object Orient Design, as exemplified by our 2 papers on Friday • You will be able to identify problematic if statements, and you’ll be ready to apply those insights to Project 1.

  5. 2 (Complementary) Perspectives You code should be like clay: simple, malleable, and doing exactly what it is intended to do and no more. Every part of it should be clean and free of dependencies because you don’t know what will be changed. You code should be like a perfectly milled steel machine, designed with expansion in mind. New parts should fit in seamlessly, and it should be impossible to fit them in wrong. Focus on making it easy to extend your design in specific ways.

  6. Picassa • Signoff on Part 1: 1/26 • Signoff on Parts 2 and 3: 2/7

  7. What We Will Do Today • You will remove some ugly code using subclasses in the exercise from last time • You will be aware of 2 Different Perspectives: code as clay perspective, code as expandable machine perspective • You will be able to identify problematic if statements, and you’ll be ready to apply those insights to Project 1.

  8. If statements are evil

More Related