©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 1 - 1 Software Engineering Software Development Process.

Slides:



Advertisements
Similar presentations
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 Repetition Statements.
Advertisements

©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Getting Started with Java.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 2 Getting Started with Java Animated Version.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Four Defining Your Own Classes.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Ch2: Getting Started with Java - Objectives After.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java Program development.
Hand Crafting your own program By Eric Davis for CS103.
Informatics 43 – May 7, Restatement of Goals for Testing Want to verify software’s correctness  Need to test  Need to decide on test cases  No.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 3 Sample Development Loan Calculator.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java Structure of.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 13 Inheritance and Polymorphism Animated Version.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes Part 1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java Structure of.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Four: Defining Your Own Classes *Instantiable.
Getting Started with Java
©2004 Brooks/Cole Chapter 1: Getting Started Sections Covered: 1.1Introduction to Programming 1.2Constructing a Java Program 1.3The print() and println()
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2: Getting Started with Java *Components.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 7 Defining Your Own Classes Part 2.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java.
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter Chapter 2 Getting Started with Java.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
Chapter Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Lecture 1 Introduction to Computers and Object-
Chapter 2 Getting Started with Java Part B. Topics Components of a Java Program –classes –methods –comments –import statements Declaring and creating.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1 Introduction to Object-Oriented Programming.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 7 Defining Your Own Classes Part 2.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Why Programmer-Defined Classes Using just the String,
Chapter 6 – Repetition Statements : Objectives After you have read and studied this chapter, you should be able to Implement repetition control in a program.
CS1101: Programming Methodology
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 1: Introduction to Object-Oriented Programming.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
Getting Started with Java Recitation – 1/23/2009 CS 180 Department of Computer Science, Purdue University.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 2 Getting Started with Java Animated Version.
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
CS1101X: Programming Methodology Recitation 1 Java Basics Numerical Data.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Chapter 2 Getting Started with Java. Objectives After you have read and studied this chapter, you should be able to Identify the basic components of Java.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 2 Getting Started with Java Animated Version.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
بسم الله الرحمن الرحيم CPCS203: Programming II. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display., Modifications by Dr.
Chapter 7- Defining Your Own Classes Part 2 : Objectives After you have read and studied this chapter, you should be able to –Describe how objects are.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Inheritance and Polymorphism.
1 Java Review Outline Java Primitives, Program Structure Operators, Control Flow, Loops Classes and Objects Arrays and ArrayList Most of these slides are.
بسم الله الرحمن الرحيم CPCS203: Programming II. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display., Modifications by Dr.
Intro to OOP with Java, C. Thomas Wu
Intro to OOP with Java, C. Thomas Wu Getting Started with Java
About the Presentations
Introduction to OOP with Java 4th Ed, C. Thomas Wu
Defining Your Own Classes
Chapter 2 - Introduction to Java Applications
Getting Started with Java
Computer Programming-1 CSC 111
Intro to OOP with Java, C. Thomas Wu
Presentation transcript:

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Engineering Software Development Process Incremental Development Monogram program

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Analysis What should the program do? Who will use the program? Is the problem solvable?

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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, …

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Inheritance Hierarchy An example of inheritance hierarchy among different types of students. Student Graduate Undergrad Commuting Law Resident Masters Doctoral

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Object Diagrams One box for each object Each object may have data inside it Example of a Loan object

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Problem Statement Problem statement: Write a program that asks for the user’s first, middle, and last names and replies with their initials. Example: input: Andrew Lloyd Weber output: ALW

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Overall Plan Identify the major tasks the program has to perform. We need to know what to develop before we develop! Tasks: –Get the user’s first, middle, and last names –Extract the initials and create the monogram –Output the monogram

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Development Steps We will develop this program in two steps: –Start with the program template and add code to get input 1.Add code to compute and display the monogram

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Step 1 Design The program specification states “get the user’s name” but doesn’t 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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); }

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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)

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Step 2 Design (cont’d) 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 “Aaron Ben Cosner” “Aaron” “Ben Cosner” “Ben” “Cosner” “ABC”

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Step 2 Code /* Chapter 2 Sample Program: Displays the Monogram File: Step 2/Ch2MonogramStep2.java */ import 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):“ );

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Step 2 Code (cont’d) //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.substring(0,1); //Output the result JOptionPane.showMessageDialog(null, "Your monogram is " + monogram); }

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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.

©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter 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