150 likes | 248 Views
Review Topics:1583-2120. GUI’s. GUI construction: basic structure of the architecture of a GUI. The M-V-C architecture: goal. Structure. Applications with two or more guis. Exceptions. definition raising handling kinds of exceptions: checked exceptions, unchecked exceptions.
E N D
Review Topics:1583-2120 CSCI-2125 Spring 2003
GUI’s • GUI construction: basic structure of the architecture of a GUI. • The M-V-C architecture: goal. Structure. • Applications with two or more guis. CSCI-2125 Spring 2003
Exceptions • definition • raising • handling • kinds of exceptions: checked exceptions, unchecked exceptions. • Built-in exceptions. • Important correctness issue with the possibility of exceptions: inconsistent object state. CSCI-2125 Spring 2003
Recursion • functional recursion • structural : object recursion CSCI-2125 Spring 2003
Lists • List class: best specification provided in book. • Formation of specific XXXList classes • Sorting • generalized sort: parameters • Searching • generalized searching. CSCI-2125 Spring 2003
Reading from book • Chapter 21 • You should be able to do any of the exercises in that chapter. CSCI-2125 Spring 2003
Abstraction • Interfaces, abstract classes. • Inheritance and composition • Measures for class definition correctness: • cohesion, coupling. • Pre-conditions, post-conditions, class invariants. Programming by contract. • Software development cycle: iterative cycle to specify-design-implement-test. CSCI-2125 Spring 2003
Testing of software • unit testing; functional testing. • JUnit. CSCI-2125 Spring 2003
Algorithm correctness • relationship between code and class invariants • state change on the face of possible exceptions • loop invariants CSCI-2125 Spring 2003
Java I/O • The package ooj.basicIO • BasicFileReader • BasicFileWriter CSCI-2125 Spring 2003
Problems • Class problem: calculator CSCI-2125 Spring 2003
Homework problemDue: Jan 27th • Write a program that allows a user to get a fortune cookie. • The program has a whole bunch of cookies and selects one at random for delivery. • The cookies are locked. The user must provide a 3-digit key that opens the repository of cookies to get one. Each digit is entered one at a time. • Besides getting cookies, when the program is running the user can: • Add cookies to the repository. • Remove cookies from the repository. • Find all cookies with a given string. • Change the combination of the repository. User is queried for current combination and new combination. • To maintain the repository of cookies user should be asked for key as well. • Program maintains a list of all cookies generated while executing. User opens this view only when desired. CSCI-2125 Spring 2003
Homework problem • When user enters data, program must properly react for illegal or invalid data. • If a user attempts to open/change repository 3 times in a row and fails, program should shut down with appropriate error message. • User interface is a gui interface with buttons or menus that allows user to access the functionality of the program. A panel is produced with the cookie and a dismiss button. Cookies that are palindromes must be displayed with special effects or with an extra message indicating so. • Program development: all model classes should be tested via the development of an automatic tester. • List of cookies is maintained in a text file that program reads at the start of execution and writes to at the end of execution. • Initial combination is 987. CSCI-2125 Spring 2003
What to submit • Each model class with a tester. • both source code and binary for entire program in a diskette. • A printed copy of all source files. • Place program in a directory with your last name. In that directory have a directory called cookies. Inside that directory you will have a java class containing the main under the name Generator. The package statement of that class is package yourLastName.cookies; • To compile a class with such package: javac yourLastName/cookies/Generator.java • For execution enter: javayourLastName.cookies.Generator CSCI-2125 Spring 2003
On palindromes • Strings that read the same forwards and backwards, disregarding punctuation and white text if any. • Examples: • Madam • A dog, a plan, a canal: pagoda! (adogaplanacanalpagoda) • Ah, Satan sees Natasha (ahsatanseesnatasha) • Use recursion to determine if a string is a palindrome. CSCI-2125 Spring 2003