SE1011 Week 8, Class 3 Today Designing Code SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 1.

Slides:



Advertisements
Similar presentations
SE2811 Week 8 Monday (last drop day) The Command Pattern Lambda Expressions SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr.
Advertisements

Week 9, Class 3: Model-View-Controller Final Project Worth 2 labs Happens-Before ( SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 8, Class 2 Today Tree terminology Non-Binary and Non-Search Trees Tree Traversals (Remaining slides not yet shown) Tomorrow: Quiz Implementing.
Week 2 - Wednesday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
CS2910 Week 1, Class 3 Today Lab 1 – Additional Assignment Working Ahead Primitives in Java SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder.
SE1011 Week 2, Class 3 Today Compiling and running Another example using Scanner Compile-time and Run-time errors Review for exam SE-1011 Slide design:
SE3910 Week 1, Class 3 Today – Introductions Safety Review Policy The course Tomorrow Lab 1, S365 (Purchase Beaglebone black kit BEFORE) Thursday Class.
Week 6, Class 1 & 2: Decorators Return Exam Questions about lab due tomorrow in class? Threads Locking on null object invokeLater & the squares example.
CS2910 Week 1, Class 2 Today Announce Prof. Michael Vieau’s S-341 6p Thurs Wk 2 Assignment for tomorrow Data Encoding, Part 1 Parsing Data Muddiest Point.
CS2910 Week 1, Class 1 Today Introductions Class/Lab Layout Safety Review - Note about Lab Safety Review Announce Prof. Michael Vieau’s S-341 6p Thurs.
CS-2852 Data Structures Week 5, Class 1 – Testing and Stacks Return Exams & Labs  Package-level access  UML connectors for instance variables Announcement:
HOW TO FILL OUT A PARSCORE FORM Genius 40% of ALL Students make errors on their ParScore Forms DON’T BE AN ERROR VICTIM!
CS-2852 Data Structures Week 5, Class 2 – Testing and Stacks Announcement: Lab Demos - 2/3 & 4 on Friday Testing  Definitions, Example  (tentative) Testing.
SE3910 Week 1, Class 2 Today – Introductions Safety Review Policy The course Tomorrow Lab 1, S365 (Purchase Beaglebone black kit BEFORE) Thursday Class.
Week 3, Day 2: Threads Questions about Threads “Multithreading” in Swing Lab tomorrow: Quiz Lab 3: Threading! SE-2811 Slide design: Dr. Mark L. Hornick.
CS2910 Week 2, Class 1 Today Data Encoding, Part 1 Parsing Data Python Muddiest Point Lab 2 – Bring text In Class, Thursday: Quiz Week 6, Monday: Midterm.
CS2852 Week 3, Class 2 Today Stacks Queues SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
CS2910 Week 5, Class 2 Today DNS Muddy Points More HTTP Headers Review for Midterm Exam This coming Monday: Midterm Exam SE-2811 Slide design: Dr. Mark.
SE1011 Week 6, Class 1 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) Muddiest Point Next Half Exam: Week 7, Monday SE-1011 Slide.
SE1011 Week 6, Class 2 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) UML class diagrams Muddiest Point Next Half Exam: Week 7, Monday.
CS2910 Week 2, Class 1 Today Return Lab 1 Muddiest Points Quiz Parsing Data in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 6, Class 1 Today The run-time stack Writing and proving recursive methods SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2852 Week 5, Class 2 Today Queue Applications Circular Queue Implementation Testing SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
SE1011 Week 6, Class 2 Today Return Half Exam 2 (cont.) Object Oriented Programming (cont.) UML class diagrams Muddiest Point Next Half Exam: Week 7, Monday.
SE1011 Week 3, Class 2 Today Sit down by someone you don't know Learn their name Find out who came farther to get to MSOE at the start of the quarter Designing.
SE1011 Week 5, Class 1 Today More Java API tools Packages Object Oriented Programming Muddiest Point Tomorrow: Lab 5 – In-lab demo requirements now up.
CS2852 Week 7, Class 1 Today Binary Search Tree Implementing add Implementing find Return Quiz 4 (second attempt) Both sections are graded SE-2811 Slide.
Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick.
CE1901 Week 6, Class 3 Week 6 Mini-Exam Review Muddiest Point Timing Diagrams (See this slide and Outcomes on course webpage – link now available)Outcomes.
CS2852 Week 6, Class 2 Today Class exercise: Implementing a recursive method Binary Search Trees Tomorrow: Quiz at start of lab Implementing a recursive.
SE1011 Week 8, Class 2 Today Return Half Exam 3 (I have it with me) Object Oriented Programming Details Null references (as acting objects and arguments)
CS2910 Week 4, Class 1 Today Encoding in Python – Review Quiz – Encoding in Python Introduction to HTTP SE-2811 Slide design: Dr. Mark L. Hornick Content:
Week 5, Day 3: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design:
Week 5, Day 2: Decorator Decorators Muddiest Point Tomorrow: Quiz on lab reading: web.msoe.edu/hasker/se2811/labs/5/ SE-2811 Slide design:
CS2852 Week 3, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
SE1011 Week 8, Class 1 Today Return Half Exam 3 (I have it with me) Object Oriented Programming Details References as arguments Overloaded methods Garbage.
CE1901 Week 6, Class 3 Week 6 Mini-Exam Review Muddiest Point Timing Diagrams (See this slide and Outcomes on course webpage – link now available)Outcomes.
CS2852 Week 2, Class 2 Today Big-O runtime analysis Linked Lists Muddiest Point Lab Quiz Includes writing a method from ArrayList class (See next slide)
Week 7, Class 1: The Command Pattern (cont.) Get Ready for Poll Everywhere Labs 2 & 3 returned Lab 7 due this evening at 11pm Quiz tomorrow at start of.
CS2910 Week 4, Class 2 Today Sit by someone you have not yet worked with this quarter. Learn his/her name if unknown. Turn on your laptop and start Wireshark.
import java.util.Scanner; class myCode { public static void main(String[] args) { Scanner input= new Scanner(System.in); int num1; System.out.println(“Enter.
Slide design: Dr. Mark L. Hornick
CS2910 Week 7, Class 1 Today Capturing SMTP with Thunderbird Tomorrow Extra office hour at 11 am (right after lab) Friday Office hour cancelled SE-2811.
SE1011 Week 7, Class 3 Today Return Half Exam 3 (I have it with me) Object Oriented Programming Details References as arguments Overloaded methods Garbage.
SE1011 Week 9, Class 3 Today Arrays with Loops! Homework SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 1.
Week 6, Class 3: Composite Swing composites File composites Computer composites SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS2910 Week 6, Lab Today Dictionaries in Python SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
SE3910 Week 8, Class 2 Week 4 Lab: Please return your graded Lab 4 to me so I can enter it in my gradebook Week 7, Class 2 (Wednesday) Half-Exam 2 Done.
SE3910 Week 1, Class 1 Today – Introductions The students (informally) The instructor Safety Review Policy The course Tomorrow (If you are in that section)
Variable scope. Variable Scope Variables do not live forever. Failing to take that into account leads to problems. Let's look at an example. Let's write.
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Week 2, Day 1: The Factory Method Pattern
Week 6, Class 2: Observer Pattern
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1021 Software Engineering II
CS2911 Week 3, Class 3 (And wk4-c1)
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
Slide design: Dr. Mark L. Hornick
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1021 Software Engineering II
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder
Slide design: Dr. Mark L. Hornick
Presentation transcript:

SE1011 Week 8, Class 3 Today Designing Code SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 1

Muddiest Point having multiple classes and the exact use of each one. Plus that, how can I figure which classes to create? designing and using classes How to debug a program that requires user input.debugging P.S. I didn't mean for my jokes to undermine your feedback tool <3 Should we use main() only as a "starter" to the "object" of the main program?static and main More on what can or can't be passed to a methodparameters Why did we have to use a method for main?static and main why we couldnt use main for the actual gamestatic and main 2 Discussed at start. Discussed during this class. [Instructor answer to the question]

Muddiest Point How do you know when to do this before you've completed writing the duplicate code? designing classes should we be doing more work in other classes vs in the driver.static and main why make another class, when you can keep the variables in the main class? static and main; designing classes Nothing today I think I have a good understanding of everything right now. Still not clear what "static" *means* and what the alternative is.static should we not use main from now on?static and main 3 Discussed at start. Discussed during this class. [Instructor answer to the question]

Old Muddy Points Does || work the same way as && as a short circuit operator? So if(true || ) will it go on or will it crash?short-circuit || SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 4 Discussed at start. Discussed during this class. [Instructor answer to the question]

What is a static method? a method which can be called without an instance of the class, for example: line = JOptionPane.showInputDialog("..."); unlike normal methods: Scanner in = new Scanner(System.in); line = in.nextLine(); a method without a this reference SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 5

Version 1.0 (Start of last class) class8_2_Elevens_start 6 main(…) Die ref playerDie Die numSides int in main(…) playerRoll1 = playerDie1.roll(); playerTotal = playerRoll1 + playerRoll2; //HERE 6 int playerRoll1 2 int playerRoll2 7 int playerTotal 9

Version 1.1 (Middle of class) 7 main(…) Die ref playerDie reRollOneDie Die ref playerDie int playerRoll1 2 int playerRoll2 7 int playerTotal Lab7 in reRollOneDie(…) int playerRoll = playerDie.roll(); if(numDie == 1) { playerRoll1 = playerRoll; } else { playerRoll2 = playerRoll; } playerTotal = playerRoll1 + playerRoll2; // HERE Die numSides int 6 numDie 1 Lab7 ref this int playerRoll 2 in main(…) reRollOneDie(playerDie1, 1);

Version 1.2 (End of class) class8_2_Elevens 8 main(…) Die ref playerDie in theGame(…) reRollOneDie(playerDie1, 1); reRollOneDie Die ref playerDie int playerRoll1 2 int playerRoll2 7 int playerTotal Lab7 in reRollOneDie(…) int playerRoll = playerDie.roll(); if(numDie == 1) { playerRoll1 = playerRoll; } else { playerRoll2 = playerRoll; } playerTotal = playerRoll1 + playerRoll2; // HERE Die numSides int 6 numDie 1 Lab7 ref this int playerRoll 2 Lab7 ref this playGame(…) Lab7 ref theGame 85700

Version 2.0 (This class) class8_2_Elevens 9 main(…) in theGame(…) human.reRollOneDie(1); reRollOneDie Die ref playerDie int playerRoll1 2 int playerRoll Player in Player's reRollOneDie(…) … int playerRoll = dieToReroll.roll(); if(numDie == 1) { playerRoll1 = playerRoll; } else { playerRoll2 = playerRoll; } // HERE Die numSides int 6 numDie 1 Player ref this int playerRoll 2 Player ref human Die ref playerDie

SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 10

Acknowledgement This course is based on the text Introduction to Programming with Java by Dean & Dean, 2 nd Edition SE-1011 Slide design: Dr. Mark L. Hornick Instructor: Dr. Yoder 11