15200: Advanced Programming Practicum - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

15200: Advanced Programming Practicum

Description:

Explore possible afternoon hours from 3:00 to 4:30. Macintosh computers ... and you will be studying linked lists (and loving it! ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 21
Provided by: john1380
Category:

less

Transcript and Presenter's Notes

Title: 15200: Advanced Programming Practicum


1
15-200 Advanced Programming / Practicum
  • Don Slater -- Lecturer
  • School of Computer Science
  • Phone x84370
  • Office Wean Hall 5115
  • dslater_at_andrew.cmu.edu
  • Course Assistants
  • Ben Naman bnaman_at_andrew.cmu.edu
  • Dawn Day dday_at_andrew.cmu.edu

2
15-200 Course Overview
  • Java
  • Object-Oriented Programming (OOP)
  • Algorithm analysis
  • Data Structures
  • Collections
  • Programming larger projects
  • Problem solving skills
  • Time management skills

3
Extras
  • Java Review
  • Evening Sessions on Graphics
  • The Campus

4
Infrastructure
  • Lectures in 7500 (at least to start)
  • 5419 D
  • Recitation at 430 pm
  • Evening open hours from 700 pm to 1030 pm
  • Explore possible afternoon hours from 300 to
    430
  • Macintosh computers
  • May bring your own laptop
  • Wireless network
  • Other places to work
  • From your room
  • Other campus clusters (may or may not have
    Eclipse)
  • Learn to use the andrew network file system

5
How to be Successful in this Course
  • Attend class, attend recitation
  • Do the homework
  • Do the labs (programming assignments)
  • They are designed to help you learn how to use
    the concepts covered in the text and discussed
    during lecture
  • Start the labs early, programming assignments
    ALWAYS take longer than you think they will
  • The material in each session builds on the
    material from the previous session
  • Recognize that 70 of your grade is based on the
    exams

6
Course Web Sites
  • http//www.cmu.edu/blackboard/
  • (log in using andrew id and password)
  • Mirrored at http//www.andrew.cmu.edu/course/15-CS
    AP/
  • Announcements All important updates about the
    course
  • Course Information Syllabus and course policies
  • Staff Information and Communication Contact
    information
  • Assignments Links to labs and homework
  • Course Documents Lectures and demo code
  • External Links Extra support materials

7
Programs and Models
  • Almost all computer programs model some artifact
  • Artifact product of civilization, either
    concrete or abstract, simple or complex
  • Model a simplified representation of something
  • It includes features that are considered
    important
  • Neglects other features not considered important
  • Characteristics of a model
  • Elements of the model represent other, more
    complex things
  • Model elements exhibit consistent behavior
  • Model elements can be grouped into different
    categories, depending on their behaviors
  • Actions external to the model element cause the
    behavior of the model element

8
Object-Oriented Programming
  • The Java programming language using an
    object-oriented programming approach to modeling
  • Each model is defined as a class
  • Java programs use multiple instances of different
    models or classes to solve a problem or perform a
    task
  • These multiple instances are known as objects
  • Object-Oriented Programming (OOP), then, is the
    process of solving problems or performing tasks
    with multiple, interacting objects.

9
Collections
  • There are four broad categories of collections
  • Linear (strings, lists, stacks, queues)
  • Hierarchical (trees or various types)
  • Graphs (directed, undirected, weighted, and
    unweighted)
  • Unordered (sets, bags, maps)
  • Collections are
  • A group of items we wish to treat as a conceptual
    unit
  • Every non-trivial piece of software involves the
    use of collections
  • Arrays are the most common and fundamental type
    of collections
  • Dynamic structures are second
  • But more typically, arrays and dynamic structures
    are used to implement other collections

10
Types of Collections
  • That we are studying
  • Bags
  • Sets
  • Lists
  • Stacks
  • Queues
  • Trees
  • We will discuss briefly
  • Graphs
  • Heaps
  • Priority Queues

11
Multiple Implementations
  • You should have studied arrays
  • and you will be studying linked lists (and loving
    it!)
  • We are learning that all of the other collections
    are generally implemented (put together) using
    either arrays or linked lists
  • Using our understanding of complexity (Big-O) we
    will start thinking about which implementations
    make the most sense
  • We will also see that many of the collections we
    discuss are already implemented as classes in the
    Java API

12
Collections
  • public interface Collection
  • Root interface in the collection hierarchy
  • A Collection represents a group of objects, known
    as elements
  • Characteristics of Collections
  • Some are ordered, some not
  • Some contain duplicates, some not
  • The Java API specifies the behavior of all
    Collections through the interface
  • The SDK does not directly implement Collection
  • It provides more specific implementations as
    sub-interfaces
  • Interface typically used to pass collections
    around for manipulation
  • THIS IS COOL!

13
Collection hierarchy
Collections
Bags
MultiSets
Lists
Sets
SortedSets
ArrayList
LinkedList
TreeSets
HashSets
Actually implemented in Java Class Libraries
14
Collection a Bag
  • A Bag collection is a container that holds a
    collection of things that we place into it (See
    Bag.java, IntArrayBag.java)
  • A Bag can be used by any program to store a
    collection of items for its own use
  • The elements in a bag are unordered
  • Their may be multiple instances of the same value
  • The Bag is actually a MultiSet

15
The conceptual view of a bag collection
16
The operations on a bag collection
(See the Collections Interface)
17
Interfaces
  • Use of the term interface in Java can be
    confusing
  • Dictionary definition, Object-Oriented
    Programming definition, Java reserved word for a
    special type of class
  • Dictionary definition
  • A system of devices, or mechanisms, or behaviors
    that enable two entities to interact with each
    other
  • A vending machine or automobile
  • A diplomat folloing an agrred upon protocol
  • Object-Oriented Programming definition
  • An objects interface those methods and data
    elements that can be used to communicate with and
    / or manipulate an object
  • The public members (constants and methods) of a
    class
  • The API (Application Programmers Interface) is a
    collection of interfaces for the Java Class
    Library

18
Vending Machine class interface
  • public interface VendingMachine
  • public boolean isEmpty()
  • public void refill()
  • public void fill(int numItems)
  • public boolean hasChange()
  • public String displayItems()
  • public boolean insertMoney(double value)
  • public Object selectItem()
  • public double makeChange()
  • public void cancelTransaction()
  • // this is all users need to know (with
    documentation)
  • // about a class in order to use it

19
A Java interface
  • A Java interface is a class that contains only
    constants and method signatures.
  • It does not have any instance variables
  • None of the methods are defined
  • It does not have constructors
  • It cannot be instantiated
  • The designer of an interface specifies the
    behavior of an object that implements the
    interface
  • The user of an interface defines how that
    behavior is to be implemented
  • There is a contract between the designer of the
    interface and the user of the interface in which
    all the behaviors will be implemented according
    to the specification of the designer
  • All classes that implement an interface have the
    same behavior, but may be defined differently
    (with different data structures, for example)

20
Comparable interface
  • The Comparable interface is defined by the API
  • There is exactly one method compareTo(Object)
    that will be implemented by any class that
    implements Comparable
  • A class may define is own compareTo() method
    without implementing Comparable
  • But by implementing Comparable, a contract is
    signed indicating to users of the class that
    compareTo(Object) will behave in a reasonable
    way, according to specifications
  • See Comparable demo
Write a Comment
User Comments (0)
About PowerShow.com