Presentation is loading. Please wait.

Presentation is loading. Please wait.

Teaching Software Development by Example Evelyn Stiller and Cathie LeBlanc Dept. Computer Science and Technology.

Similar presentations


Presentation on theme: "Teaching Software Development by Example Evelyn Stiller and Cathie LeBlanc Dept. Computer Science and Technology."— Presentation transcript:

1 Teaching Software Development by Example Evelyn Stiller and Cathie LeBlanc Dept. Computer Science and Technology

2 The course is called Client-Server Programming. This is the students’ second programming course. The course is taught using Java.

3 Students learn to design simple two-player client-server applications in the following manner: –Introduce a reusable socket listener class. –Show students a simple client-server application design. –Model adapting the above design to another, similar application. –Ask students to adapt the design to their own project. –This approach has greatly improved the students’ success in completing their client-server projects.

4 Week 11.Overview of the object-oriented paradigm 2.Encapsulation 3.Inheritance 4.Polymorphism 5.Object-oriented problem conceptualization Week 21.Introduction to UML class diagrams 2.Interobject relationships 3.Distributing event-handling to utility classes Week 31.Inheritance: single and multiple 2.Polymorphism Week 41.Graphical user interface design principles 2.Using the Java API 3.Advanced layout management Week 51.Exception handling

5 Week 61.Multi-threading applications 2.Animation 3.Data integrity issues resulting from multi- threading Week 71.Multimedia applications 2.Images 3.Sound Week 81.Files and streams 2.Object Streaming Week 91.Network programming through sockets 2.Non-threaded interprocess communication Week 101.Multi-threaded network programming 2.Design of chat room 3.Design of network-based Battleship game

6 Week 111.Principles of client-server application design 2.More UML class diagrams Week 121.Using data structures 2.Stacks 3.Queues Week 131.Professional ethics Week 141.Finalize student projects Week 151. Student Presentation of Client-Server Project

7 Determine functional specification of project. Divide the overall functionality into client and server responsibilities. Determine which classes are required for the client and which are for the server. Determine inter-class relationships.

8 The SocketListener class is a reusable class for reading text over Sockets. This class is threaded so that the main application using this class does not block upon issuing a readLine() over the BufferedReader. Uses the interface NetworkReader to force implementing classes to define the method sendSocketInput(String, SocketListener)

9 MainApplication sendSocketInput(String, SocketListener) > NetworkReader sendSocketInput(String, SocketListener) SocketListener Thread (Java predefined class) BufferedReader (Java predefined class) > is-a implements creates reads text over calls sendSocketInput using lines of text read from BufferedReader

10 Chat4_2Client sendSocketInput(String, SocketListener) ChatSession sendSocketInput(String, SocketListener) Chat4_2Server SocketListener {Client side}{Server side} NetworkReader send messages received from server send messages received from client connect send messages create

11 Players interact with each other through a graphic user interface that consists of a two-dimensional array of squares in which colored dots randomly appear. Players of the game click on dots of their designated color removing dots and gaining points. One player will lose when two neighboring dots of his/her color are set.

12 Client –Present user with two-dimensional grid –Render server-selected dots on grid –Allow user to remove dots with mouse click in the cell containing the dot –Communicate dot removal to server Server –Allow two players to connect –Assign a color to each player –Periodically generate randomly placed dots and communicate this to both clients –Communicate one client's dot removal to other client –Determine winner and loser

13 user – external entity grid – potential class but we will implement it as a two-dimensional array rather than create another class dot – attribute of another class cell – potential class server – already a class in our application player – external entity (synonym for user) mouse click – already a class predefined in Java client – already a class in our application winner – synonym for player loser – synonym for player Categorize each noun –potential class –attribute for another class –pronoun –synonym for another noun –transient noun –external entity

14 Game2DClient sendSocketInput(String, SocketListener) Game2D sendSocketInput(String, SocketListener) Game2DServer SocketListener {Client side}{Server side} NetworkReader send messages received from server send messages received from client connect send messages create

15 {Client side}{Server side} Game2DClient GraphicCell[][] sendSocketInput(String, SocketListener) GraphicCell Cell is-a renders itself query set/unset dot Game2D Cell[][] sendSocketInput(String, SocketListener) Cell Timer query set/unset dot prompts

16 Game2DClient GraphicCell grid[ ][ ] sendSocketInput(String, SocketListener) Game2D Cell grid[ ][ ] sendSocketInput(String, SocketListener) Game2DServerSocketListener {Client side}{Server side} NetworkReader send messages received from server send messages received from client connect send messages send two socket connections Timer Cell GraphicCell Game2DClient reference Cell query Set/unset dots prompts is-a queryset/unset dots render

17 Students start with a simple application which reviews Java concepts Each week a new concept is learned and new functionality embodying this concept is added to the application. The application grows in complexity in manageable steps.

18 WeekLearning Objectives/TopicsScience Center Application Functionality 1Review basic Java Programming. Create basic GUI to allow user entry creating an array of objects. Allow Science Center staff to record counts of various animal species on science center lands. 2Application design, basic UML, inner classes, utility classes Add attributes to animal counts, and add fields to data entry GUI (requires use of a utility class). 3Inheritance and other interclass relationships Allow recording of information about animal deformities, record predation relationship between animals. 4Advanced GUI developmentRefining SCHS GUI to enhance usability. 5Exception Handling - Create data out-of-bounds exception. Create numeric only text fields. Make prototype robust to user entry mistakes. Allow SC staff to maintain a history of animal counts.

19 WeekLearning Objectives/TopicsScience Center Application Functionality 6MultithreadingInvolve children with the SCHS, by creating an animal observation game. 7Using image and sound files to create multimedia applications Make children’s game more appealing by adding images and sounds. 8Files and streams - data persistenceMake SCHS data persistent. 9NetworkingMake children’s game collaborative - allow children on separate computers to participate on same game. 10Client-Server application designMake children’s game more complex with two-way communication between server and client.

20 After the 10 th week students initiate their own client-server project. They are required to specify overall functionality. Determine client and server responsibilities. Determine classes. Develop a design by adapting the communication infrastructure of the 2-person chat application. Develop their application incrementally.

21 Students are able to successfully develop relatively complex applications in their second programming course. Students gain experience developing simple client-server applications. Students learn to adapt design solutions to new applications. Students feel comfortable working with UML as a result of their experience. Slides are available at:


Download ppt "Teaching Software Development by Example Evelyn Stiller and Cathie LeBlanc Dept. Computer Science and Technology."

Similar presentations


Ads by Google