Teaching Software Development by Example - PowerPoint PPT Presentation

About This Presentation
Title:

Teaching Software Development by Example

Description:

The Basic Design Process. Determine functional specification of project. ... Application design, basic UML, inner classes, utility classes. 2 ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 22
Provided by: EMS14
Category:

less

Transcript and Presenter's Notes

Title: Teaching Software Development by Example


1
Teaching Software Development by Example
  • Evelyn Stiller and Cathie LeBlancDept. Computer
    Science and Technology

2
Context for Teaching Design
and Program Evolution
  • The course is called Client-Server Programming.
  • This is the students second programming course.
  • The course is taught using Java.

3
Teaching Students to Design by Example
  • 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
Weekly Topics for Client/Server Programming
Week 1 Overview of the object-oriented paradigm Encapsulation Inheritance Polymorphism Object-oriented problem conceptualization
Week 2 Introduction to UML class diagrams Interobject relationships Distributing event-handling to utility classes
Week 3 Inheritance single and multiple Polymorphism
Week 4 Graphical user interface design principles Using the Java API Advanced layout management
Week 5 Exception handling
5
Weekly Topics for Client/Server Programming
Week 6 Multi-threading applications Animation Data integrity issues resulting from multi-threading
Week 7 Multimedia applications Images Sound
Week 8 Files and streams Object Streaming
Week 9 Network programming through sockets Non-threaded interprocess communication
Week 10 Multi-threaded network programming Design of chat room Design of network-based Battleship game
6
Weekly Topics for Client/Server Programming
Week 11 Principles of client-server application design More UML class diagrams
Week 12 Using data structures Stacks Queues
Week 13 Professional ethics
Week 14 Finalize student projects
Week 15 1. Student Presentation of Client-Server Project
7
The Basic Design Process
  • 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
Introducing the SocketListener Class
  • 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
Using the SocketListener Class
MainApplication sendSocketInput(String,
SocketListener)
implements
creates
ltlt interface gtgt NetworkReader sendSocketInput(Str
ing, SocketListener)
BufferedReader (Java predefined class)
calls sendSocketInput using lines of text read
from BufferedReader
reads text over
ltlt uses gtgt
SocketListener
Thread(Java predefined class)
is-a
10
Model Design Two Person Chat Room
ChatSession sendSocketInput(String,
SocketListener)
Chat4_2Client sendSocketInput(String,
SocketListener)
send messages
send messages
send messages received from server
send messages received from client
Network Reader
NetworkReader
create
SocketListener
SocketListener
connect
Chat4_2Server
Client side
Server side
11
New Application Game2D
  • 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/Server Responsibilities Game2D
  • 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
Classes for Game2D
  • 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
Communication Infrastructure Game2D
Game2D sendSocketInput(String, SocketListener)
Game2DClient sendSocketInput(String,
SocketListener)
send messages
send messages
send messages received from server
send messages received from client
Network Reader
NetworkReader
create
SocketListener
SocketListener
connect
Game2DServer
Client side
Server side
15
Additional Classes Game2D
Cell
Timer
Cell
is-a
set/unset dot
query
prompts
GraphicCell
Game2D Cell sendSocketInput(String,
SocketListener)
renders itself
set/unset dot
query
Game2DClient GraphicCell sendSocketInput(Strin
g, SocketListener)
Client side
Server side
16
Aggregate Game2D Design
Cell
Cell
Timer
is-a
Set/unset dots
query
GraphicCellGame2DClient reference
prompts
Game2D Cell grid sendSocketInput(String,
SocketListener)
render
send messages
query
set/unset dots
Game2DClient GraphicCell grid
sendSocketInput(String, SocketListener)
send messages received from client
send messages
Network Reader
SocketListener
send messages received from server
NetworkReader
send two socket connections
connect
Game2DServer
SocketListener
Client side
Server side
17
Creating Complex Applications by Evolution
  • 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
Evolving the Science Center Application
Week Learning Objectives/Topics Science Center Application Functionality
1 Review 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.
2 Application 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).
3 Inheritance and other interclass relationships Allow recording of information about animal deformities, record predation relationship between animals.
4 Advanced GUI development Refining SCHS GUI to enhance usability.
5 Exception 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
Evolving the Science Center Application
Week Learning Objectives/Topics Science Center Application Functionality
6 Multithreading Involve children with the SCHS, by creating an animal observation game.
7 Using image and sound files to create multimedia applications Make childrens game more appealing by adding images and sounds.
8 Files and streams - data persistence Make SCHS data persistent.
9 Networking Make childrens game collaborative - allow children on separate computers to participate on same game.
10 Client-Server application design Make childrens game more complex with two-way communication between server and client.
20
Evolving the Science Center Application
  • After the 10th 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
Conclusion
  • 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 http//oz.plymouth.edu/e
stiller/
Write a Comment
User Comments (0)
About PowerShow.com