COS 260 DAY 16 Tony Gauvin.

Slides:



Advertisements
Similar presentations
DETAILED DESIGN, IMPLEMENTATIONA AND TESTING Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Advertisements

Comp1004: Building Better Classes I Testing and Debugging Partly based on BlueJ Book – Chapter 6.
Well-behaved objects 4.0 Testing. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Main concepts to.
Well-behaved objects Debugging. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Prevention vs Detection.
Objects First with Java A Practical Introduction using BlueJ
Understanding class definitions Looking inside classes 3.0.
Well-behaved objects Improving your coding skills 1.0.
Testing and Debugging. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling (Reminder) Zuul Assignment Two.
Object interaction Creating cooperating objects 3.0.
Object Interaction 1 Creating cooperating objects.
Object interaction Creating cooperating objects 5.0.
Object interaction Creating cooperating objects 5.0.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
CO320 Introduction to Object- Oriented Programming Michael Kölling 3.0.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Structured COBOL Programming, Stern & Stern, 9th edition
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
1 COS 260 DAY 1 Tony Gauvin. 2 Agenda Class roll call Instructor Introduction Instructor’s Educational Philosophy Contract on Classroom Behavior Syllabus.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
Programming Life Cycle Problem analysisunderstand the problem Requirements definition specify what program will do High- and low-level designhow it meets.
COS 260 DAY 5 Tony Gauvin.
Week81 APCS-AB: Java Unit Testing Information today from “Unit Testing in BlueJ” October 28, 2005.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
OOPDA Intro 5.0. Topics Website and Syllabus Rowan VPN and H:drive BlueJ application and projects Programming Style (Appendix J) Javadoc (Appendix I)
Testing. Have you contacted your project members lately?
1 COS 260 DAY 14 Tony Gauvin. 2 Agenda Questions? 6 th Mini quiz graded  Oct 29 –Chapter 6 Assignment 4 will be posted later Today –First two problems.
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
1 COS 260 DAY 15 Tony Gauvin. 2 Agenda Questions? 6 th Mini quiz Today –Chapter 6 Assignment 4 posted –Due Nov 9 Capstone progress reports are due –Brief.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
1 COS 260 DAY 12 Tony Gauvin. 2 Agenda Questions? 5 th Mini quiz –Chapter 5 40 min Assignment 3 Due Assignment 4 will be posted later (next week) –If.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
1 COS 260 DAY 22 Tony Gauvin. 2 Agenda Questions? 9 th Mini Quiz corrected –Good results Assignment 5 Not corrected yet Assignment 6 Posted (one more)
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability © 2017 Pearson Education, Inc. Hoboken,
Review. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Objects and Classes Objects and Classes –State.
Objektorienterad programmering d2, förel. 6
Objects First with Java
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
COS 260 DAY 1 Tony Gauvin.
Objects First with Java A Practical Introduction using BlueJ
Objects First with Java Creating cooperating objects
Dept of Computer Science University of Maryland College Park
C++ Plus Data Structures
Objektorienterad programmering d2, förel. 6
Introduction to Visual Basic 2008 Programming
Chapter 8 – Software Testing
Testing and Debugging.
Object INTERACTION CITS1001 week 3.
COS 260 DAY 17 Tony Gauvin.
COS 260 DAY 19 Tony Gauvin.
Objects First with Java
Designing and Debugging Batch and Interactive COBOL Programs
COS 260 DAY 13 Tony Gauvin.
COS 260 DAY 6 Tony Gauvin.
COS 260 DAY 11 Tony Gauvin.
COS 260 DAY 2 Tony Gauvin.
COS 260 DAY 15 Tony Gauvin.
Creating cooperating objects
COS 260 DAY 16 Tony Gauvin.
Introduction to Systems Analysis and Design Stefano Moshi Memorial University College System Analysis & Design BIT
Objects First with Java A Practical Introduction using BlueJ
COS 260 DAY 23 Tony Gauvin.
Creating cooperating objects
Objects First with Java Creating cooperating objects
COS 260 DAY 4 Tony Gauvin.
Objects First with Java Creating cooperating objects
COS 260 DAY 23 Tony Gauvin.
Objects First with Java A Practical Introduction using BlueJ
COS 260 DAY 6 Tony Gauvin.
Presentation transcript:

COS 260 DAY 16 Tony Gauvin

Agenda Questions? 6th Mini quiz Graded 7th Mini quiz next class All A’s 7th Mini quiz next class Chapter 7 Assignment 4 posted Due Nov 9 (one week) Capstone progress over due Finish Discussion on Well Behaved objects

Objects First with Java Well-behaved objects 5.0 © David J. Barnes and Michael Kölling

Main concepts to be covered Unit testing JUnit Regression testing Test cases Test classes Assertions Fixtures Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

JUnit JUnit is a Java test framework Test cases are methods that contain tests Test classes contain test methods Assertions are used to assert expected method results Fixtures are used to support multiple tests Code on setup() method Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Adding test method to a test Harness Create testMethod Proceed using unit testing procedures Hit end to stop recording test steps Test new test method Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Well-behaved objects Debugging

Prevention vs Detection (Developer vs Maintainer) We can lessen the likelihood of errors. Use software engineering techniques, like encapsulation. Pay attention to cohesion and coupling. We can improve the chances of detection. Use software engineering practices, like modularization and good documentation. We can develop detection skills. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Debugging techniques Manual walkthroughs Print statements Debuggers NO COMPUTER Print statements Debuggers Built-ins Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Modularization and interfaces Objects First with Java Modularization and interfaces Applications often consist of different modules. E.g. so that different teams can work on them. The interface between modules must be clearly specified. Supports independent concurrent development. Increases the likelihood of successful integration. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Modularization in a calculator Objects First with Java Modularization in a calculator Each module does not need to know implementation details of the other. User controls could be a GUI or a hardware device. Logic could be hardware or software. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Method headers as an interface Objects First with Java Method headers as an interface // Return the value to be displayed. public int getDisplayValue();   // Call when a digit button is pressed. public void numberPressed(int number); // Plus operator is pressed. public void plus(); // Minus operator is pressed. public void minus(); // Call to complete a calculation. public void equals(); // Call to reset the calculator. public void clear(); Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java Debugging It is important to develop code-reading skills. Debugging will often be performed on others’ code. Techniques and tools exist to support the debugging process. Explore through the calculator-engine project. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Objects First with Java Manual walkthroughs Relatively underused. A low-tech approach. More powerful than appreciated. Get away from the computer! ‘Run’ a program by hand. High-level (Step) or low-level (Step into) views. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Tabulating object state Objects First with Java Tabulating object state An object’s behavior is largely determined by its state … … so incorrect behavior is often the result of incorrect state. Tabulate the values of key fields. Document state changes after each method call. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java Verbal walkthroughs Explain to someone else what the code is doing. They might spot the error. The process of explaining might help you to spot it for yourself. Group-based processes exist for conducting formal walkthroughs or inspections. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java Print statements The most popular technique. No special tools required. All programming languages support them. Only effective if the right methods are documented. Output may be voluminous! Turning off and on requires forethought. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling

Choosing a test strategy Objects First with Java Choosing a test strategy Be aware of the available strategies. Choose strategies appropriate to the point of development. Automate whenever possible. Reduces tedium. Reduces human error. Makes (re)testing more likely. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java Debuggers Debuggers are both language- and environment-specific. BlueJ has an integrated debugger. Support breakpoints. Step and Step-into controlled execution. Call sequence (stack). Object state. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling

Objects First with Java Review Errors are a fact of life in programs. Good software development techniques can reduce their occurrence. Testing and debugging skills are essential. Make testing a habit. Automate testing where possible. Continually repeat tests. Practice a range of debugging skills. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling © David J. Barnes and Michael Kölling