Software Engineering - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Software Engineering

Description:

The McGraw-Hill Companies, Inc. Permission required for reproduction or display. ... Much like building a skyscraper, we need a disciplined approach in developing ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 26
Provided by: csBois
Learn more at: http://cs.boisestate.edu
Category:

less

Transcript and Presenter's Notes

Title: Software Engineering


1
Software Engineering
  • Software Development Process
  • Incremental Development
  • Monogram program

2
Program Development Process
  • Design the program
  • Use a text editor (vim) to write a java file
  • vim MyClass.java
  • Compile the java code to create a class file
  • javac MyClass.java
  • Run the program
  • javac MyClass
  • Create the documentation
  • javadoc MyClass.java

3
Software Engineering
  • Much like building a skyscraper, we need a
    disciplined approach in developing complex
    software applications.
  • Software engineering is the application of a
    systematic and disciplined approach to the
    development, testing, and maintenance of a
    program.

4
Software Life Cycle
  • The sequence of stages from conception to
    operation of a program is called software life
    cycle.
  • Analysis
  • Define the problem
  • Design
  • Work out a solution
  • Here's where you use UML diagrams
  • Coding
  • Testing
  • Operation and Maintenance

5
Analysis
  • What should the program do?
  • Who will use the program?
  • Is the problem solvable?

6
Design
  • This is where you decide how to implement a
    program
  • What classes do you need?
  • Which classes do you need to write?
  • What should the data and methods for each class
    be?
  • Define algorithms for various operations
  • Work out a plan for the order of implementation

7
UML Diagrams
  • UML is a graphical language
  • It can be used to model various aspects of a
    program
  • Use class diagrams to model the structure of the
    application
  • Use object diagrams to provide a snapshot of what
    is happening when a program runs
  • Other types of diagrams model requirements,
    program state, testing,

8
Class Diagram
  • Used to
  • Show the details of one or more classes
  • data, methods
  • Show how different classes are related within a
    program
  • inheritance (is-a), aggregation (has-a), using
  • Illustrate an inheritance hierarchy
  • Class diagrams are static
  • Class diagrams illustrate the structure of an
    application

9
  • Generic class diagram
  • name of class
  • list names of class and instance data values
  • list methods with parameters and return types
  • Example class diagram
  • Contact class represents a person with
    information needed in an address book

10
The Structure of an Application
  • Use a box for each class
  • Use lines to show relationships
  • Arrow for inheritance
  • Line with diamond for aggregation (has-a)
  • Dotted line for uses

11
Inheritance Hierarchy
  • An example of inheritance hierarchy among
    different types of students.

12
Object Diagrams
  • Used to illustrate the state of a program at
    different times while it is running
  • We will use a kind of object diagrams called
    state-of-memory diagrams to illustrate how Java
    uses memory for storing information

13
Object Diagrams
  • One box for each object
  • Each object may have data inside it
  • Example of a Loan object

14
Problem Statement
  • Problem statement
  • Write a program that asks for the users first,
    middle, and last names and replies with their
    initials.

Example input Andrew Lloyd Weber output
ALW
15
Overall Plan
  • Identify the major tasks the program has to
    perform.
  • We need to know what to develop before we
    develop!
  • Tasks
  • Get the users first, middle, and last names
  • Extract the initials and create the monogram
  • Output the monogram

16
Development Steps
  • We will develop this program in two steps
  • Start with the program template and add code to
    get input
  • Add code to compute and display the monogram

17
Step 1 Design
  • The program specification states get the users
    name but doesnt say how.
  • We will consider how in the Step 1 design
  • We will use JOptionPane for input
  • Input Style Choice 1
  • Input first, middle, and last names separately
  • Input Style Choice 2
  • Input the full name at once
  • We choose Style 2 because it is easier and
    quicker for the user to enter the information

18
Step 1 Code
/ Chapter 2 Sample Program Displays the
Monogram File Step1/Ch2Monogram.java / import
javax.swing. class Ch2Monogram public
static void main (String args) String
name name JOptionPane.showInputDialog(null,
"Enter your full name (first,
middle, last)) JOptionPane.showMessageDialog
(null, name)
19
Step 1 Test
  • In the testing phase, we run the program and
    verify that
  • we can enter the name
  • the name we enter is displayed correctly

20
Step 2 Design
  • Our programming skills are limited, so we will
    make the following assumptions
  • input string contains first, middle, and last
    names
  • first, middle, and last names are separated by
    single blank spaces
  • Example
  • John Quincy Adams (okay)
  • John Kennedy (not okay)
  • Harrison, William Henry (not okay)

21
Step 2 Design (contd)
  • Given the valid input, we can compute the
    monogram by
  • breaking the input name into first, middle, and
    last
  • extracting the first character from them
  • concatenating three first characters

22
Step 2 Code
/ Chapter 2 Sample Program Displays the
Monogram File Step 2/Ch2MonogramStep2.java / i
mport javax.swing. class Ch2Monogram
public static void main (String args)
String name, first, middle, last,
space, monogram space "
//Input the full name name
JOptionPane.showInputDialog(null,
"Enter your full name (first, middle, last) )
23
Step 2 Code (contd)
//Extract first, middle, and last names first
name.substring(0, name.indexOf(space)) name
name.substring(name.indexOf(space)1,
name.length()) middle
name.substring(0, name.indexOf(space)) last
name.substring(name.indexOf(space)1,
name.length()) //Compute the
monogram monogram first.substring(0, 1)
middle.substring(0, 1) last.substri
ng(0,1) //Output the result JOptionPane.show
MessageDialog(null, "Your monogram is "
monogram)
24
Step 2 Test
  • In the testing phase, we run the program and
    verify that, for all valid input values, correct
    monograms are displayed.
  • We run the program numerous times. Seeing one
    correct answer is not enough. We have to try out
    many different types of (valid) input values.

25
Program Review
  • The work of a programmer is not done yet.
  • Once the working program is developed, we perform
    a critical review and see if there are any
    missing features or possible improvements
  • One suggestion
  • Improve the initial prompt so the user knows the
    valid input format requires single spaces between
    the first, middle, and last names
Write a Comment
User Comments (0)
About PowerShow.com