Presentation is loading. Please wait.

Presentation is loading. Please wait.

DAAD project “Joint Course on OOP using Java” Humboldt University Berlin, University of Novi Sad, ‘Polytehnica’ University of Timisoara, University of.

Similar presentations


Presentation on theme: "DAAD project “Joint Course on OOP using Java” Humboldt University Berlin, University of Novi Sad, ‘Polytehnica’ University of Timisoara, University of."— Presentation transcript:

1 DAAD project “Joint Course on OOP using Java” Humboldt University Berlin, University of Novi Sad, ‘Polytehnica’ University of Timisoara, University of Plovdiv, University of Belgrade Author: Dušan Tošić Version: Sep. 2, 2005 Java case studies: game playing A simple software development process from specification, to design, implementation, and test

2 DAAD project „Joint Course on OOP using Java“ © 2 Points of this development Java sample game Create a simple game by using Java Illustrate a methodology how to develop a Java- applet step by step. Demonstrate the importance of software engineering principles for simple Java programs development Inspired by the lecture K. Bothe “Mouse in a Maze ” Using Java API For the lecturer only

3 DAAD project „Joint Course on OOP using Java“ © 3 Course materials  Lecture slides: about 20 slides takes 2 lecture hours (to complete the whole process)  Assignments: modify presented program make new games using presented example. For the lecturer only

4 DAAD project „Joint Course on OOP using Java“ © 4 Global description of the task: “Lost cat” Task: Develop a program, to simulate the finding of a lost cat by using information ‘closer- further’. Next steps? First step?

5 DAAD project „Joint Course on OOP using Java“ © 5 Facts concerning software development phases Most errors of software systems result from misunderstanding the problem to be solved. Software development consists only of a small part of programming: Requirements analysis: 20 % Design:15 % Implementation: 20 % Test: 45 % This slide is taken from K. Bothe

6 DAAD project „Joint Course on OOP using Java“ © 6 Learning goals  This example should illustrate the importance of a complete and correct requirements specification for the project success.  Before implementing, try to apply all previous phases in SW development.  Start with the implementation when all classes and methods are known.

7 DAAD project „Joint Course on OOP using Java“ © 7 Development process of ‚Lost cat‘ Requirements analysis Design Implementation and test

8 DAAD project „Joint Course on OOP using Java“ © 8 Requirements analysis: ‚Lost cat‘ Task: Develop an applet (using GUI), to simulate the searching a lost cat. The position of cat is randomly chosen. The searching is simulated by mouse-clicks. Open questions ?

9 DAAD project „Joint Course on OOP using Java“ © 9 Open questions  How to mark a visited position?  How to keep the visited positions?  How to present information „you are closer (further) to the cat“?  When the cat is found?  What will happen when the cat is found?  What is the environment where we look for?

10 DAAD project „Joint Course on OOP using Java“ © 10 Requirements specification (1,2) We point out the position of a lost cat by mouse-click in current position of the mouse pointer. We will mark the chosen position in some way. The different kinds of flags, can be used, but we decide to use the simplest one: the filled circle. visited position We will keep the visited positions in an array. (Data structures like: vectors, linked lists, … could be used too.) By using this array we will draw the circles.

11 DAAD project „Joint Course on OOP using Java“ © 11 Requirements Specification (3) We will use two ways to inform the player about position of the cat: by text-messages by flags (circles) The different colors of flags determine whether the chosen position is closer or further (related to previous position) from the cat. The following colors are used: start position closer further found cat

12 DAAD project „Joint Course on OOP using Java“ © 12 Requirements Specification (4,5) If the point (xc, yc) is position of the cat and (x,y) position of the mouse pointer, we will suppose that the cat is found if: (|xc-x|<10) & (|yc-y|<10) (We may measure the distance on some other way.) When the cat is found, the picture of the cat will fill the window of applet. The follow picture is used :

13 DAAD project „Joint Course on OOP using Java“ © 13 Requirements Specification (6) We can use any color for the background of our applet. Moreover, it is more convenient to simulate nature environment in some way. We deside to use the following picture to simulate the nature environment

14 DAAD project „Joint Course on OOP using Java“ © 14 Development process of ‚Lost cat‘ Requirements analysis Design Implementation and test

15 DAAD project „Joint Course on OOP using Java“ © 15 Design: develop the software architecture  SW architecture description languages: UML- industry standard.  Main problem: How to find classes? „Finding a proper class structure may be more challenging then implementing the Java program code“ (K. Bothe).

16 DAAD project „Joint Course on OOP using Java“ © 16 Software architecture Our task is not so complicated (it is a simple student’s assignment!) Thus, the structure of our program should not be complicated. Moreover, we have to define:  Which components exist?  Which relations are between them? We will have a main class (CatGame) and an auxiliary class (Mouse)

17 DAAD project „Joint Course on OOP using Java“ © 17 UML diagram CatGame paint() Graphics Applet Mouse MouseAdapter

18 DAAD project „Joint Course on OOP using Java“ © 18 The main class CatGame... init() addCircle() update(Graphics g ) paint(Graphics g)

19 DAAD project „Joint Course on OOP using Java“ © 19 Development process of ‚Mouse in a Maze‘ Requirements analysis Design Implementation and test

20 DAAD project „Joint Course on OOP using Java“ © 20 Implementation phase We use 3 steps in the implementation (In fact 3 applets are developed. Each applet is independently tested): 1.Circle 2.Circles 3.CatGame

21 DAAD project „Joint Course on OOP using Java“ © 21 Testing  The applets Circle and Circles are very simple for the testing.  The applet CatGame is more complicated. We should complete game to see the picture of the cat.  We should to adjust all parameters to fit everything in the window of applet Demonstration

22 DAAD project „Joint Course on OOP using Java“ © 22 Critics of the implementation  The structure of classes should be better organized.  UML diagrams could be presented with more details.  Program should be more secure (the private variable should be used) ...


Download ppt "DAAD project “Joint Course on OOP using Java” Humboldt University Berlin, University of Novi Sad, ‘Polytehnica’ University of Timisoara, University of."

Similar presentations


Ads by Google