Objects First With Java - Chapter 1

Download Report

Transcript Objects First With Java - Chapter 1

COS 260 DAY 1
Tony Gauvin
1
Agenda
•
•
•
•
•
•
•
•
Class roll call
Instructor Introduction
Instructor’s Educational Philosophy
Contract on Classroom Behavior
Syllabus review
Web Resources
General Information about class
Objects and classes
2
Instructor
• Tony Gauvin
–
–
–
–
Associate Professor of E-Commerce
218 Nadeau Hall
(207) 834-7519 or Extension 7519
[email protected]
– Quick Resume
3
Fall Schedule
Tony Gauvin
8:00 AM
8:30 AM
9:00 AM
9:30 AM
10:00 AM
10:30 AM
11:00 AM
11:30 AM
12:00 PM
Fall 2015
Monday
Tuesday
Cos 260
Intro to
Wednesday
Thursday
Friday
Office
Cos 260
Office
Hours
Intro to
Hours
Programming
Programming
CYR 111
CYR 111
9:30-11:50 AM
9:30-11:50 AM
12:30 PM
1:00 PM
1:30 PM
2:00 PM
2:30 PM
3:00 PM
3:30 PM
4:00 PM
4:30 PM
5:00 PM
5:30 PM
6:00 PM
6:30 PM
7:00 PM
7:30 PM
8:00 PM
8:30 PM
9:00 PM
9:30 PM
3/28/2016
ELC 200
ELC 200
Intro to eCommerce
Office
CYR 111
Hours
2:00-3:20 PM
Intro to eCommerce
CYR 111
2:00-3:20 PM
Office hours are listed
Also available by Appointment
207 834 7519
[email protected]
4
Instructional Philosophy
• Out-Come based education
• Would rather discuss than lecture
– Requires student preparation
• Hate grading assignments
– Especially LATE assignments
• Use class interaction, assignments, miniquizzes and Capstone Project to determine
if outcomes are met.
5
Cos 260 Outcomes
This course continues from the preliminary introduction to programming that is a core component of the prerequisite COS 111
Introduction to Computer Science course. Upon completion of this course, participants will have gained knowledge of objectoriented and structured programming paradigm concepts, principles, skills (including data type selection and
implementation), and the ability to:
•
effectively program in depth
–
–
–
–
–
–
•
describe key programming concepts, including:
–
–
–
–
–
•
effectively apply problem solving techniques to the design of computer algorithm(s) for a task
select the appropriate programming language(s) for a task
select and implement data type(s) most appropriate for a task (selected from arrays, records, stacks,
queues, lists, simple trees)
test and debug programs
evaluate the quality and efficiency of a program
identify improvements that can be made to the quality and efficiency of a program's source code
and/or documentation
control structures
recursion
iteration
sorting
searching
explain key social aspects of programming, including:
–
–
–
–
3/28/2016
intellectual property
liability
privacy
ethical behavior
6
6
Class Documents
• Syllabus
• Contract on Classroom behavior
• Class Slides (whenever IT fixes
server)
– http://perleybrook.umfk.maine.edu
/slides/fall2015/COS260/
3/28/2016
7
7
Web Resources
•
Blackboard
–
•
•
•
•
•
•
https://www.courses.maine.edu
Instructor’s Web Site
– http://perleybrook.umfk.maine.edu
Textbook Web Site
– http://www.bluej.org/objects-first/
Java Website (Oracle)
– https://www.oracle.com/java/index.html
– https://www.java.com/en/
BlueJ
– http://www.bluej.org/
JGrasp
– http://www.jgrasp.org/
Other Useful Sites
– Http://www.javaworld.com
8
Bribe List (2015)
•
•
•
•
•
•
•
•
•
•
1947 HD FLH “knucklehead”
2014 Audi R8 (V10+)
1950 Buick RoadMaster
1955 Buick Special
1965 Shelby Cobra S/C 427
2013 M/B SLS AMG GT
2006 Dodge Viper SRT
2015 Harley CVO Limted
2015 50th Ann. Mustang
Current Collection
Ch 1 -9
9
Objects First with Java
A Practical Introduction using BlueJ
David J. Barnes
Michael Kölling
5.0
Take control of your own
learning
•
•
•
•
•
•
Lectures (boring!)
Exercises  take home and in class
Book
Web page
Discussion forums
Practice, practice, practice!
• The only way to learn how to program
is to program!
Objects
Kölling
First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael
11
Course Contents
• Introduction to object-oriented
programming…
• …with a strong software engineering
foundation…
• …aimed at producing and maintaining
large, high-quality software systems.
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
12
Buzzwords
responsibility-driven design
inheritance
iterators
cohesion
encapsulation
overriding
javadoc
collection classes
coupling
interface
mutator methods
polymorphic method calls
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
13
Goals
• Sound knowledge of programming
principles
• Sound knowledge of object-orientation
• Able to critically assess the quality of
a (small) software system
• Able to implement a small software
system in Java
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
14
Book
David J. Barnes & Michael Kölling
Objects First with Java
A Practical Introduction using BlueJ
5th edition,
Pearson Education, 2012
ISBN 0-13-249266-0
978-0-13-249266-9
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
15
Course overview (1)
1.
2.
3.
4.
5.
6.
7.
Objects and classes
Understanding class definitions
Object interaction
Grouping objects
More sophisticated behavior - libraries
Designing classes
Well-behaved objects - testing,
maintaining, debugging
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
16
Course overview (2)
8. Structure using Inheritance
9. Polymorphism
10.Extendable, flexible class structures
11.Building graphical user interfaces
12.Handling errors
13.Designing applications
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
17
Fundamental concepts
•
•
•
•
•
object
class
method
parameter
data type
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
18
Objects and classes
• objects
– represent ‘things’ from the real world,
or from some problem domain (example:
“the red car down there in the car
park”)
• classes
– represent all objects of a kind (example:
“car”)
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
19
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
20
Methods and parameters
• Objects have operations which can
be invoked (Java calls them
methods).
• Methods may have parameters to
pass additional information needed
to execute.
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
21
Other observations
• Many instances can be created from a
single class.
• An object has attributes: values
stored in fields.
• The class defines what fields an
object has, but each object stores its
own set of values (the state of the
object).
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
22
State
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
23
Two circle objects
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
24
Java Data Types
•
•
•
•
Integers  int, byte, short and long
Real numbers  float and double
Logic  boolean
Character  char
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
25
Source code
• Each class has source code (Java
code) associated with it that defines
its details (fields and methods).
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
26
Java Code
•
•
•
•
Person person1 = new person();
person1.makevisible();
person1.moveright();
person1.moveHorizontal(50);
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
27
Return values
• All the methods in the figures project
have void return types; but …
• … methods may return a result via a
return value.
• Such methods have a non-void
return type.
• More on this in the next chapter.
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
28
Terms for Today
•
•
•
•
•
•
Object
Class
Instance
Method
Signature
parameter
•
•
•
•
•
Type
State
Source code
Return value
Compiler
Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling
29