Welcome, Review of Software Development Methods/Tools

advertisement
CS210
Intermediate Computing
with Data Structures (Java)
Saaid Baraty
sbaraty@cs.umb.edu
S-3-90
1
Outline of Today's Class
• Looking at the course syllabus and
requirements.
• About this course.
• Software Engineering and Software
Quality.
• Data Structures and Their importance in
Software Engineering.
• UML Diagram.
2
Welcome to CS210
• What are the values of this course?
– This course provides the knowledge for you to
understand and use data structures, especially
the Java Collections API, for writing more
effective and efficient computer programs.
– Also, you will write many programs in Java.
This sharpens your Java programming skills.
3
Software Engineering
• Software engineering is the study of
techniques, theory and principles to
develop high quality software.
• Software qualities:
– Correctness
– Reliability
– Robustness
– Usability
– Maintainability
– Re-usability/Extendability
4
Software Development Methods
• Classical “Waterfall” Development Steps
Edit and save
source code
Errors
Build source code
to create program
Errors
Run program and
evaluate results
5
Errors
• A program can have three types of errors:
• The IDE editor and/or compiler will find syntax errors and
other basic problems (compile-time errors)
– If compile-time errors exist, an executable version of the program
is not created
• A problem can occur during program execution, such as
trying to divide by zero, which causes a program to
terminate abnormally (run-time errors)
• A program may run, but produce incorrect results,
perhaps using an incorrect formula (logical errors)
6
Data Structures
• Data structures refer to the structures or
organizations we use to store or retrieve
data in memory.
7
Data Structures and Program
Efficiency
The choice of the data structure that we use
in our program can dramatically affect the
efficiency (in terms of running time ) of our
program.
8
Data Structure Example
We have a program that accepts a number
as input and tells us if the number exists in
the following set of numbers stored in
memory:
{ 2, 10, 9, 11, 100, -6, 21 }
What data structure should we use to store
the numbers for obtaining the highest
9
efficiency?
Option 1
An unordered list:
{ 2, 10, 9, 11, 100, -6, 21 }
2

10
9
11 100 -6 21
pros and cons
10
Option 2
An ordered list:
{ 2, 10, 9, 11, 100, -6, 21 }
-6

2
9
10 11 21 100
pros and cons
11
Option 3
A binary tree
{ 2, 10, 9, 11, 100, -6, 21 }
2
-6
10
9
11
100

pros and cons
21
12
Unified Modeling Language (UML)
• UML is a graphical tool to visualize and
analyze the requirements and do design of
an object-oriented solution to a problem.
• A good reference is UML Distilled, 3rd Ed.,
Martin Fowler, Addison-Wesley/Pearson
13
Unified Modeling Language (UML)
• Advantage of UML – It is graphical
– Allows you to visualize the problem / solution
– Organizes your detailed information
• Disadvantage of UML – It is graphical
– Can be done with pencil and paper – tedious!
– Commercial UML S/W tools are expensive!
• Example: Rational ROSE (IBM acquired Rational)
14
Class Diagrams
• Classify the Objects in the Use Cases
• Define name of each class
• Define each class’s attributes
– Constants
– Variables
• Define each class’s behaviors
– Methods
• Show relationships between classes
– Depends on, Inherits, etc.
15
UML Diagram for a Class
CreditCard
- myCardData : CardData
+ read( ) : CardData
• Class name: CreditCard
• Attribute name: myCardData
• Method name: read()
16
Class Diagram Showing
Inheritance
BankAccount
balance
getBalance()
CheckingAccount
SavingAccount
monthlyFee
interest
getFee()
getInterest()
17
Software Development Tools
• Download/install the software development
tools on your own PC if you wish to do your
project assignments at home
– Sun Software Development Kit (SDK)
– Integrated Development Environment (IDE) or
you can use the command prompt (terminal)
• Use the PCs in the Healey Library labs as
they already have these tools installed
18
Using Sun Java SDK Alone
• Example DOS Commands and Parameters
C:\ > edit HelloWorld.java
(Create/edit “source file” in an external window)
C:\ > javac HelloWorld.java (creates .class file)
C:\ > java -classpath … HelloWorld
Hello World
C:\ > exit
19
Software Development Tools
• We can use a combination of the an IDE and
the Sun Java SDK
Graphical User Interface
Eclipse IDE
Edit
Build
Run
Source
File(s)
(.java)
Compiler
(javac)
Programmer
Class
File(s)
(.class)
Virtual
Machine
(java)
Parts of Sun Java SDK
20
Program
executes
Download