Download CSCI 3333 Data Structures Today`s Objectives

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Stream processing wikipedia , lookup

Object-oriented programming wikipedia , lookup

Software quality wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Corecursion wikipedia , lookup

Data-intensive computing wikipedia , lookup

Transcript
Welcome
 CSCI 3333 Data Structures
•
Section 03 Thurs., 7:00–9:50 p.m.
 Instructor: Charles Moen
•
•
•
•
Email – [email protected]
Web page – http://sce.uhcl.edu/moenc
Office – Delta Building 232
Office hours
– Thurs. 5:00–7:00 p.m.
– If the hall door is locked, phone me at (281) 283-3848
•
Home – 713-880-2924
1
CSCI 3333
 Data Structures
•
Stacks, queues, lists, trees, hash tables
 Algorithms
•
Searching, sorting, recursion, analysis of running
time
 Software Engineering
•
Methods, abstraction, encapsulation, ethics
 Java
•
Use object-oriented programming to implement data
structures
2
17-Jan-2008
Today’s Objectives
 Class roster
 Course overview
•
•
Required textbook, web site, syllabus, schedule
How to succeed
 Main concepts
 Software engineering
 Software engineering ethics
 Reminder
•
The Ethics Paper assignment is posted, and it is due on 31-Jan
3
Course Overview
Required Textbook
M. T. Goodrich and R. Tamassia,
Data Structures and Algorithms in Java.
Hoboken, NJ: John Wiley & Sons, Inc., 2006.
ISBN 0-471-73884-0
Textbook web page:
http://java.datastructures.net/
4
Course Overview
Course Web Pages
 Course page
http://sce.uhcl.edu/moenc/csci3333spring08/index.html
 Schedule
http://sce.uhcl.edu/moenc/csci3333spring08/schedule.html
 Syllabus
http://sce.uhcl.edu/moenc/csci3333spring08/syllabus.html
 Resources
http://sce.uhcl.edu/moenc/csci3333spring08/resources.html
5
Course Overview
How to Succeed
 Expect to spend 10–15 hours per week on this class
 Practice by writing a lot of small programs
•
•
To learn object-oriented programming with Java
To apply those skills to data structures
 Homework assignments
•
•
•
•
Start them early
Hand them in on time
Check the requirements and make sure
nothing is missing
Ensure that your programs compile
and work correctly
 Attend the classes & participate
 Read the book
6
Main Concepts
7
Main Concepts
Data Structure
“ A systematic way of organizing and
accessing data” in a computer’s memory
(Goodrich, 162)
8
Main Concepts
Data Structure
“ A systematic way of organizing and
accessing data” in a computer’s memory
(Goodrich, 162)
We use variables to store
data in a computer’s
memory. Does that mean
that variables are data
structures?
9
Main Concepts
Data Structure
“ A systematic way of organizing and
accessing data” in a computer’s memory
(Goodrich, 162)
We use variables to store
data in a computer’s
memory. Does that mean
that variables are data
structures?
No. When we talk about data structures,
we are referring to programming elements
that can hold a lot of data, like an array.
10
Main Concepts
Data Structure
“ A systematic way of organizing and
accessing data” in a computer’s memory
(Goodrich, 162)
Important things to remember about any data
structure:
1.
How are the data related?
• For example, are they in a sequence?
• This is the “organizing” part
2.
What operations can be performed on the data?
 This is the “accessing” part
11
Main Concepts
Data Structure Example
Stack = data structure that stores data elements which are
inserted or removed in LIFO (last-in first-out) order
How are the data related?
•
Stored in a linear sequence determined by the insertion order
What operations can be performed on the data?
st.push(); st.pop(); st.top(); st.size(); st.isEmpty();
Uses:
•
Backtracking
– Storing addresses in a Web browser’s history
– Implementing an “undo” feature by storing changes
•
•
Reversing data
Parsing
12
Main Concepts
Algorithm
“ A step-by-step procedure for performing
some task in a finite amount of time”
(Goodrich, 162)
13
Main Concepts
Algorithm
“ A step-by-step procedure for performing
some task in a finite amount of time”
(Goodrich, 162)
Pseudocode example of an algorithm:
Algorithm arrayMax(A,n):
Input: An array A storing n >= 1 integers.
Output: The maximum element in A.
currentMax A[0]
for i 1 to n – 1 do
if currentMax < A[i] then
currentMax  A[i]
return currentMax
14
Main Concepts
Our Motivation
 Good data structures and algorithms are
necessary for efficiency and speed in our
applications
Motivation:
When you are a professional programmer, it
is likely that your company will have millions
of records of data. Your job will be to search
that data and find the answer in seconds.
What happens if your algorithms are too
slow?
15
Main Concepts
Algorithms + Data Structures
Algorithms + Data Structures = Programs
Niklaus Wirth, 1975
 Title of Wirth’s book
 One point of view that illustrates the importance of
data structures and algorithms
 OOP takes a slightly different point of view
Portrait of Niklaus Wirth
taken in 1969, by Robert M.
McClure. From Wikipedia.
Niklaus Wirth lecturing in
2005. From Wikipedia.
16
Main Concepts
Data Structures & Algorithms
 Core knowledge in computer science
Donald Knuth, The Art of Computer Programming
From Amazon.com
From Stanford Magazine, May–June 2006
17
Main Concepts
Data Structures as Tools
 Data structures are tools that we use in our
programs
 We will study
•
The most important data structures & algorithms
• How to make them
• How to use them
• How to measure their performance
• How to find readymade tools
18
Software Engineering
19
Software Engineering
Basic Terms
 Engineer
•
A person who makes things work by applying
theories, methods, and tools
(Sommerville, 7)
 Software Engineer
•
An engineer who is concerned with the practical
problems of software production
• Writing code, project management, and developing
theories and methods related to software production
 What is the difference between software
engineering and computer science?
20
Software Engineering
History
 1968 – The “software crisis”
•
•
•
•
•
NATO Software Engineering Conference in
Garmisch, Germany (Randell)
Late projects
High costs
Code was hard to maintain
Ad hoc programming
 Software engineering
•
•
Formal development techniques and processes
Goal is to control costs and complexity
21
Software Engineering
Software Life Cycle
 Software development activities and artifacts
 Software process
•
Series of steps for software development
– Overall life cycle steps, e.g. Rational Unified Process
– Steps in an individual activity, e.g. requirements process
•
There is no standard software process
– But it is important to use a process
•
Goals accomplished by using a software process
1.Repeatable procedure—better able to succeed
consistently
2.Facilitate team interaction
3.Measurable progress—on time and within budget
22
Software Engineering
Software Life Cycle Models
 Abstraction of the software life cycle
 Examples
•
Waterfall model (Royce)
•
Spiral model (Boehm)
•
Unified Process (Booch, Jacobson,
Rumbaugh)
•
What are some others?
23
Software Engineering
Waterfall Model

Each step is completed before the next is started
(Royce, 7)
•
•
•
•
•
•

1
Requirements gathering
Analysis
Design
Implementation
Testing
Operations (daily use of the program)
2
3
4
5
6
Some big drawbacks
•
•
Difficult to make revisions due to unforeseen problems
Focus on paper documents and distrustful customercontractor relationships
24
Software Engineering
Software Life Cycle
Important parts of the software life cycle that are
needed by any model of it
•
Requirements gathering
– From the stakeholders
•
Analysis
– Determine what the program should do, but not specifically how it
will be done
– Build models, e.g. with UML
•
Design
– Program design
– Adjust the models to simplify implementation and improve
execution
•
•
Implementation – coding
Testing
25
Software Engineering
Iterative Models

Iteration = Repetition

Activities are not completed in a strictly linear way

•
Design can start when most requirements are known, and
the design may lead to new requirements
•
During design, some implementation may be done to
establish the feasibility of the design
•
During implementation, some revisions of the design may
be required
•
The tests may be designed during the requirementsgathering activity
The project evolves through improvements and
refinements
26
Software Engineering
Rational Unified Process
 An example of an iterative process
(Jacobson et al.)
27
Software Engineering (Drake, 3–7)
What makes a computer program
good?
It must work correctly.
It should be safe.
It should be efficient.
It should be general-purpose, as much as
possible so that we can use it in many ways.
We need to be able to develop it rapidly.
It should be easy to maintain.
28
Software Engineering
Evolution of Software Design
 It’s difficult to write good, efficient programs in a
reasonable amount of time because programs
are very complex.
 Goal = reduce complexity!
 Approaches improved with time
•
No particular plan (1960s and earlier)
•
Functional design & structured programming
•
Object-oriented design (OOD) (today)
29
Software Engineering (Goodrich, 58)
OOD Goals
 Robustness
•
•
“Capable of handling unexpected inputs”
Correct and safe
 Reusability
•
Code should be reusable in other applications
• Class libraries like the Java Collections Framework
• General purpose code helps rapid development
 Adaptability
•
•
•
Able to evolve over time in response to changes
Loosely connected classes
Easy to maintain
30
Software Engineering (Goodrich, 59)
OOD Principles
 Abstraction
•
•
Distill a complicated system into simple parts (objects) that
can be easily described and understood
e.g., a road map is an abstraction
 Encapsulation
•
•
Data and the operations that can be performed with that data
are kept in the same place – the objects
Simplify a program by dividing it into distinct components or
objects
 Information hiding
•
Internal details of a class are not revealed
– We don’t need to know how it’s done
– We just need to know the “interface”
31
Software Engineering
Data Type
Defined by:


A range of data values
The operations that can be performed on the data
Example:
int data type
•
•
Type of data: integer values from -231 to 231 - 1
Operations supported: arithmetic (+,–,*,/,%),
assignment (=), equality (==, !=), relational
(<,>,<=,>=), increment (++), decrement (––),
etc.
32
Software Engineering
Abstract Data Type
 A specification for a data structure that
tells us
•
The type of data stored
• The operations that are supported
 Specifies what the operations do, but
not how they do it
(Goodrich, p. 60)
33
Software Engineering
Interface
 Specifies operations that are supported
 Specifies what the operations do, but not how
they do it
 We depend on the interface to tell us how to
use a programming feature
•
Example:
API = Application Programming Interface
 An ADT specifies an interface
34
Software Engineering (Goodrich, 80)
Java interface
 There is a language feature called an “interface” in Java
 It is a “collection of method declarations with no data
and no bodies”
 A class that implements an interface must implement all
its methods
 We’ll use an interface to specify an ADT so that the
classes that implement a data structure based on the
ADT will have to implement all its operations
 But the interface does not implement an ADT
35
Software Engineering
Java class
 In Java, we implement an ADT by writing a class
•
A class specifies how the operations are performed
 A class contains
•
Data
– Called “instance variables”
– Usually private
•
Operations
– Operations that can be performed on the data
– Called “methods”
– Usually public
•
The public operations are considered the “interface”
36
Software Engineering
Information Hiding
 Accomplished by keeping the instance variables private
 The user of an object in your program can change its
data, but cannot change it directly
 Data members are manipulated only by accessor
methods
•
•
“Set” methods
“Get” methods
 Advantage
•
•
•
We can control how the data is changed
We can control how the data is stored
Other parts of the program don’t need to know how it’s done,
they just need to know the “interface”
37
Software Engineering Ethics
38
Software Engineering
Ethics
 Ethics = the study of moral choices
that a person makes in relationships
with other people
 It’s about how we use the power that we
have when making decisions that
influence the dignity and well-being of
other people
39
Software Engineering
Computer Ethics
 Computer systems are everywhere
 As software engineers, systems
engineers, or computer scientists we
have “significant opportunities to do
good or to cause harm” (ACM/IEEE-CS)
 Cases:
•
Morris worm
• Therac-25
• Any other examples?
40
Software Engineering
Ethics Training
 Even minimal training in ethics helps us
make better choices (Harris et al.)
 CSCI 4837 Social, Ethical, and
Security-Related Issues in Computing
41
Software Engineering
Codes of Ethics
 Professional organizations—both have
professional codes of ethics
•
ACM
(Association for Computing Machinery)
•
IEEE
http://sce.uhcl.moenc/csci3333spring08/resources.html
42
Software Engineering
An Ethics Test
 When faced with an ethical question, the best
choice may be hard to pick
Example:
You just got a job working for a college computing
lab, and your supervisor asked you to install a new
program on all 30 of the lab’s PCs. You discover that
the school only owns a single copy of the software.
What would you do?
 An ethics test is a framework for making a
decision when you are faced with an ethical
issue
http://sce.cl.uh.edu/moenc/ethicsTest.html
43
Software Engineering
Ethics Paper
 Assignment due on September 6
http://sce.uhcl.edu/moenc/csci3333spring08/EthicsPaper.htm
 Some food for thought:
As an ethical software engineer, why is it
important for you to choose the most efficient
data structures and algorithms in the
programs you write for your clients?
44
References
ACM/IEEE-CS Joint Task Force. (1999). Software Engineering Code of Ethics and Professional
Practice. [Online]. Available:http://www.computer.org/tab/seprof/code.htm
Drake, Peter, Data Structures and Algorithms in Java. Upper Saddle River, NJ: Pearson
Prentice Hall, 2006.
Goodrich, M. T. and R. Tamassia, Data Structures and Algorithms in Java. Hoboken, NJ: John
Wiley & Sons, Inc., 2006.
Harris, J., M. Cummings, and C. Fogliasso, “Ethical Codes and Their Effect on Conduct.”
Journal for Computing Sciences in Colleges, October 2002.
Jacobson, I., G. Booch, J. Rumbaugh, The Unified Software Development Process. Boston:
Addison-Wesley,1999.
Knuth, D. E., The Art of Computer Programming, Second Edition. (Volumes 1–3). Boston:
Addison-Wesley, 1998.
Randell, B., “Software Engineering in 1968,” Proceedings of the 4th International Conference on
Software Engineering. Piscataway, NJ: IEEE Press, 1979.
Royce, W., Software Project Management. Boston: Addison-Wesley, 1998.
Sommerville, I. ,Software Engineering. Harlow, England: Addison-Wesley, 2001.
Wirth, N., Algorithms + Data Structures = Programs. Upper Saddle River, NJ: Prentice Hall,
1976.
45