Download presentation
Presentation is loading. Please wait.
Published byMarcia Fitzgerald Modified over 9 years ago
1
SIMPLE PROBLEM SOLVING in Java: a Problem Set Framework Viera K. Proulx Richard Rasala Jason Jay Rodrigues http://www.ccs.neu.edu/jpt CCSCNE 2002 Conference Worcester State College, Worcester, MA April, 19, 2002 http://www.ccs.neu.edu/jpt
2
CCSCNE 2002 Proulx, Rasala, Rodrigues 2 Outline l Motivation l Goals l JPT background l The Problem Set Framework l The architecture l Uses of PSF l This is all you need to know
3
CCSCNE 2002 Proulx, Rasala, Rodrigues 3 Motivation We wanted to be able to l write small functions – without classes l explore classes –constructors, member functions –copy vs. assignment vs. clone l test classes as they are built l run several different applications easily
4
CCSCNE 2002 Proulx, Rasala, Rodrigues 4 Goals Create a framework that would give us l access to the console l access to the graphics window l one action button per function we want to test l automatic action button definition and labeling l synchronization of the button responses l ability to add other classes to the project
5
CCSCNE 2002 Proulx, Rasala, Rodrigues 5 JPT Background Toolkit to support fast GUI building in Java Support for Model – View communication Support for Action – Control binding Support for robust input stream parsing Support for graphics Support for layout control Support for event – action – adapters Platform for showcase labs
6
CCSCNE 2002 Proulx, Rasala, Rodrigues 6 JPT Background Actions – installed in one statement Console –parsed error-checked input –color coded input, output, error stream –scrollable, can save to a file, resize font Graphics – buffered panel with mouse action adapter GUI components, layout control, more...
7
CCSCNE 2002 Proulx, Rasala, Rodrigues 7 The Problem Set Framework l Two classes – application and framework l Application builds GUI, buttons, console l Framework contains user’s test functions l Mutual reference – allows two-way access –The test functions access the graphics window and console supplied by the application –The GUI buttons created by the application use the code in the test functions for their actions
8
CCSCNE 2002 Proulx, Rasala, Rodrigues 8 The Problem Set Framework Each test function runs in its own thread: ThreadedAction class defined l All functions synchronized l Use reflection to –extract function names –create button labels –define corresponding actions l Catch the exception messages – forward to the user
9
CCSCNE 2002 Proulx, Rasala, Rodrigues 9 The Architecture and Design User side: ProblemSetClass l Modify the ProblemSetClass –define the test functions using the pattern public synchronized void TestFunction(){...} –define additional utility functions – if you wish –define objects that all test functions can share – if you wish –use text I/O – via System or (JPT) console –use graphics (Java2D Graphics) – in the BufferedPanel l Add any classes that you want to test to the project Use GeneralDialog for additional interactions
10
CCSCNE 2002 Proulx, Rasala, Rodrigues 10 The Architecture and Design System side: ProblemSetApplication –define and install the BufferedPanel in the main frame and activate the (JPT) console –use reflection to get a list of all methods that are declared as: public synchronized void TestFunction(); –create a ThreadedAction and button for each –use method names for button labels –add the Clear Window button and the Exit button
11
CCSCNE 2002 Proulx, Rasala, Rodrigues 11 Uses of PSF l Simple algorithmics and problem sets l Tutorials on OO concepts –constructors and the reference model –inheritance –abstract classes –static –interfaces –casting l Data structure exercises – with display
12
CCSCNE 2002 Proulx, Rasala, Rodrigues 12 Uses of PSF l In lecture demonstrations and live exploration of new concepts l Unit testing for a new class or classes –to be used both by students and developers l Demo platform –several different applications may be grouped in one PSF and launched without the need for separate projects or separate compilations
13
CCSCNE 2002 Proulx, Rasala, Rodrigues 13 This Is All You Need To Know Project includes two classes and jpt.jar Modify only the file ProblemSetClass.java l Insert functions to run – make sure that the method header has the form public synchronized void TestFunction( ){...} l Add utility functions using a different header l Add additional classes as needed l Compile and run the PSF application
14
CCSCNE 2002 Proulx, Rasala, Rodrigues 14 This Is All You Need To Know We cannot and do not want to live without it l We use the PSF in nearly every lecture l Students run regression tests on their work l Tutorial examples on classes and objects are given to students in PSF format l We use the PSF test bed to develop new JPT features
15
SIMPLE PROBLEM SOLVING in Java: a Problem Set Framework Viera K. Proulx vkp@ccs.neu.edu Richard Rasala rasala@ccs.neu.edu Jason Jay Rodrigues jjayr@ccs.neu.edu http://www.ccs.neu.edu/jpt Partially supported by the NSF grant DUE-9950829 http://www.ccs.neu.edu/jpt
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.