Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

JFo 2 1 SG

Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

1

Java Foundations
2-1
The Software Development Process

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.

2
Objectives
• This lesson covers the following objectives:
−Understand the Spiral Model of development
−Recognize tasks and subtasks of the Spiral Model
−Recognize what happens when steps are ignored
−Identify software features
−Understand how features are gradually implemented

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 3
respective owners.

3
Exercise 1, Part 1
• Your buddy, Clinton, has plans for the weekend
• Check out his email and think about what steps would
be necessary to make these plans happen:
Hey buddy,

There's a special Computer History exhibit at the City Museum


this month. A few of us are thinking of going Friday at 5:00
PM. Would you want to join? I think the subway would be the
best way to get there.

Clinton

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 4
respective owners.

4
Exercise 1, Part 2
• Complete the chart by writing at least one item for
each section
Requirements Designing a Plan
• What is Clinton's email asking? • What do you need to consider before going
out?

Testing Implementing the Plan


• How do you know the plan worked? • What actions do you take?

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 5
respective owners.

5
Friday at the Museum
• You may have written something similar to this:
Requirements Designing a Plan
• What is Clinton's email asking? • What do you need to consider before
- Be at the City Museum at 5:00 PM on going out?
Friday. - Find a time to meet at the campus subway
station before 5:00 PM.
- Look up subway and street maps.

Testing Implementing the Plan


• How do you know the plan worked? • What actions do you take?
- Did you get off at the right stop? - Take the red-line train to South Station.
- Are the streets and buildings named what - Walk east for 3 blocks.
you expect?
- Do you see any computers?

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 6
respective owners.

6
Introducing the Spiral Model of Development
• Developing software requires a similar thought process
• This is represented by the Spiral Model
• There are other models, but the Spiral Model best
reflects what you'll be doing in this course

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 7
respective owners.

7
Requirements
• Carefully read any instructions:
−What should your program do?
−What problems is it trying to solve?
−What features must your program have?

Requirements

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 8
respective owners.

8
Design
• Plan your approach:
−Are there data or behaviors your program must model?
−Will certain parts of your program need to be finished before
work can begin on other parts?

Requirements Design

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 9
respective owners.

9
Develop
• Start coding:
−Create a simplified version of your program
−Focus on a small number of simple or important features

Requirements Design

Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 10
respective owners.

10
Test
• Test your code:
−Does the program give the results that you expect?
−Can you find scenarios that produce unwanted results?
−Depending on their impact, these bugs may need fixing

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 11
respective owners.

11
Requirements Iteration
• Check the requirements again:
−Does the program's behavior match the requirements?
−Are there additional requirements or features to build?
−Should some requirements change?

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 12
respective owners.

12
Design Iteration
• Plan your changes:
−How should you model additional features?
−Should the existing design change to better support
expanding current features or adding new features?

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 13
respective owners.

13
Development Iteration
• Continue developing:
−Add new features
−Modify or enhance existing features, if necessary

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 14
respective owners.

14
More Testing
• Continue testing:
−Does new code work as you expect?
−Will old code still work properly?
−Depending on the severity, bugs may need fixing

Requirements Design

Test Develop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 15
respective owners.

15
Developing, Testing, and Fixing
• The process of developing, testing, and fixing bugs is
sometimes frustrating:
−Code often doesn't work
−Unexpected bugs reveal themselves
−Solutions seem difficult and elusive

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 16
respective owners.

16
Programming Is like Solving Puzzles
• It may take time…
−Thinking
−Experimenting
−Researching and iterating
• But it feels very rewarding to…
−See your code finally working (or behaving
slightly better)
−Watch your program evolve and become more robust
−Find yourself becoming more skillful
−Mischievously find ways to produce bugs

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 17
respective owners.

17
How to Research
• Are you still confused after tinkering? There are many
resources to help you make progress:
• Lecture notes and completed small exercises
− Do they use commands or techniques you're looking for?
• Oracle's Java documentation
− They outline available Java commands
− https://docs.oracle.com/en/java/javase/17/docs/api/java.base/mo
dule-summary.html
• Internet
− Other people may have asked questions similar to yours.
− You may uncover helpful examples or promising new commands
− But your solutions should be your own, not copied code

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 18
respective owners.

The hyperlink in the slide to Oracle’s Java Documentation is for Java SE 17. If you are using a
later version, change the 17 in the URL to the release number of your JDK.

18
Exercise 2, Part 1
• Here is Clinton's email again, in case you need it for
this exercise

Hey buddy,

There's a special Computer History exhibit at the City Museum


this month. A few of us are thinking of going Friday at 5:00
PM. Would you want to join? I think the subway would be the
best way to get there.

Clinton

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 19
respective owners.

19
Exercise 2, Part 2
• Complete this chart
−Imagine what might happen to your night at the museum if a
particular step were forgotten:
Requirements Designing a Plan

Testing Implementing the Plan

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 20
respective owners.

20
Forgotten Friday
• You may have written something similar to this:
Requirements Designing a Plan

- You do something else on Friday - Everyone is on the train but nobody


knows where they're going
- You ride the train for hours but never
reach the museum

Testing Implementing the Plan

- You walk past the museum - Despite a wonderful plan, nobody


- You arrive at the wrong building goes to the museum
- The museum is closed - Clinton is sad

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 21
respective owners.

21
Forgetting Steps in the Spiral Model
• Similarly, bad things can happen when a particular step
of the Spiral Model is forgotten
Requirements Design
- The program works, but doesn't solve the - Code is messy
right problem - Bugs are difficult to fix
- Features are missing - Features are difficult to enhance

Testing Development
- The program keeps crashing - There is no program
- The program gives incorrect results
- Users are frustrated
- Users can't stop laughing

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 22
respective owners.

Sometimes buggy programs are very funny.

22
What Is a Software Feature?
• Think of a feature as:
−Something that a program can do
−Something that you can do with a program
• Examples:
−Printing text
−Playing a sound ROAR! I'm an enemy! I'll
−Calculating a value bite you!
−Dragging and dropping an icon
−Posting a high score to an online leaderboard
−A new type of enemy in a videogame

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 23
respective owners.

23
Implementing a Feature
• Some features are easier to implement:
−You can code them in a few simple lines
−For example, printing text to your IDE's output window
• Some features are difficult to implement
−They rely on a combination of other features
−For example, being able to "drag and drop" an icon

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 24
respective owners.

24
Implementing "Drag and Drop"
• A "drag and drop" feature requires several smaller
features:
−Adding a graphic to the screen
−Finding the mouse position
−Detecting a mouse click
−Detecting a mouse release
−Changing the position of the graphic
• Implementing just one of these items can feel like a big
accomplishment

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 25
respective owners.

25
Case Study: Java Puzzle Ball
• This game is written entirely in Java FX
• It's designed to teach programming concepts
• We've saved all the old versions of this game so that
you can explore how features were gradually
implemented!

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 26
respective owners.

Java FX will be covered in more detail later in the course.

26
The Game's Development Process
• These are the steps we tried to take:
−Brainstorm and prototype game ideas
−Document goals and requirements for the best idea
−Break requirements into tasks/features and add them to a
schedule
−Develop
−Test
−Iterate and reevaluate requirements

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 27
respective owners.

27
Exercise 3, Part 1
• Download OldGameVersions.zip, unzip, and play
these recordings of different versions of the game
during its development:
−August 16, 2013 (08-16-13.mp4)
−August 22, 2013 (08-22-13.mp4)
−September 27, 2013 (09-27-13.mp4)
−October 16, 2013 (10-16-13.mp4)
−November 21, 2013 (11-21-13.mp4)

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 28
respective owners.

28
Exercise 3, Part 2
• Spend a couple minutes reviewing each version
• Note any new features, bugs, or changes between
versions

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 29
respective owners.

29
August 16, 2013
• Goals of this version:
−Have the developer learn Java FX
−Implement a few basic features
• Notable features:
−Display images on screen
−Detect mouse events
−Rotate BlueBumpers
−Drag and drop an icon into slots (N, E)

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 30
respective owners.

30
August 22, 2013
• One week later:
−This version still isn't a game
−But it's looking more impressive
• Notable features:
−User Interface (UI) wheels and icons positioned on the right
−A RedBumper
−Colorized attachments
−More icons to drag and drop

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 31
respective owners.

31
September 27, 2013
• About one month later:
−This version could be called a game
−The goal is to deflect the ball to Duke
−A different developer created the code

Duke
JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 32
respective owners.

Wheels snap every 45 degrees because the code responsible for ball movement wasn't
designed to calculate only eight possible collision/angle scenarios.

32
September 27, 2013
• Notable features:
−A Play button and a goal (Duke)
−A ball that can move and be deflected
−More shapes that can be attached
−Yellow lines (for collision detection)
−Wheels that snap to the nearest 45-degree increment

Duke
JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 33
respective owners.

Wheels snap every 45 degrees because the code responsible for ball movement wasn't
designed to calculate only eight possible collision/angle scenarios.

33
October 16, 2013
• A few weeks later, we created additional game modes
(Inheritance & Geometry Test)
• There is a pop-up for choosing levels
−Because we didn't know how to unload/swap between levels
−You have to close the program to load a different level
−Levels are for testing features, and aren't quite puzzles for
players

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 34
respective owners.

34
October 16, 2013
• More notable features:
−Level geometry
−A GreenBumper and GreenWheel
−Level-building instructions are read from a text file (but you
couldn't have known that)

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 35
respective owners.

35
November 21, 2013
• Over one month later:
−We figured out how to unload levels!
−Only a single file is necessary to run the game
• Use the Options button to choose levels
−It's a temporary solution until we learned to create menus
−Levels are actual puzzles instead of tech demos

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 36
respective owners.

36
November 21, 2013
• More notable features:
−Fancy new background art
−More levels
−Slots are labeled ABCD instead of NESW (People thought their
solutions were wrong if the N slot didn’t face north)

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 37
respective owners.

37
The Current Version
• Development continued several more months into
2014 and updates were made in 2020
• You'll notice new features and changes in the latest
version
• https://objectstorage.ca-toronto-
1.oraclecloud.com/n/yzr73ksbiwdp/b/Games/o/JavaPu
zzleBall/index.html

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 38
respective owners.

There were features that never made it into the game, either because we didn't have time or
we thought they would be a bad idea; for example, puzzles with more than one ball (super
difficult multi-threading puzzles). There are also a few bugs with the current version.

We'll encounter Java Puzzle Ball next in Lesson 3 of this section.

38
Spiral Model Summary
Requirements Design
• What the program should do • How to model data and
• What problem the program is behaviors
trying to solve • What order to implement
features

Test Develop
• Find bugs • Add simple versions of
• Fix bugs new features
• Enhance existing
features

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 39
respective owners.

39
Summary
• In this lesson, you should have learned how to:
−Understand the Spiral Model of development
−Recognize tasks and subtasks of the Spiral Model
−Recognize what happens when steps are ignored
−Identify software features
−Understand how features are gradually implemented

JFo 2-1 Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered
The Software Development Process trademarks of Oracle and/or its affiliates. Other names may be trademarks of their 40
respective owners.

40
41

You might also like