mcs 220: concepts of programming (focus on object-oriented programming) class hour:

48
MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour: Section 1: MW 2:15PM - 3:30PM. Hyer Hall 210 Section 2: MW 3:45PM - 5:00PM. Hyer Hall 210

Upload: kyra-cline

Post on 31-Dec-2015

33 views

Category:

Documents


1 download

DESCRIPTION

MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour: Section 1: MW 2:15PM - 3:30PM. Hyer Hall 210 Section 2: MW 3:45PM - 5:00PM. Hyer Hall 210. A little bit about the instructor. Assistant professor at UWW since August 2005. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

MCS 220: Concepts of Programming(focus on Object-Oriented Programming)

Class Hour:Section 1: MW 2:15PM - 3:30PM. Hyer Hall 210Section 2: MW 3:45PM - 5:00PM. Hyer Hall 210

Page 2: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

A little bit about the instructor

• Graduated from the University of Connecticut (05 Class), Ph.D in Computer Science and Engineering

• Bachelor of Science from Hanoi University of Technology (86-91)

• Master of Computer Science from UW-Milwaukee (96-99)

Assistant professor at UWW since August 2005

Page 3: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

A little bit about the instructor

• Research Experience:– User Modeling, Information Retrieval,

Decision Theory, Collaborative Filtering, Human Factors

• Teaching Experience:– MCS 220, COMPSCI 172, 181, 271,381 at

UWW– Introductory courses at UOP and Devry– TA for Computer Architecture, OO

Design, Compiler, Artificial Intelligence

Page 4: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Contact information

[email protected](fastest way to contact me)

McCutchan Hall 424Office Hours: 8:30am –

10:30am, 1pm-2pm MW or by appointment

262 472 5170

Page 5: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Course Objectives

• Able to design a real-world application using Object-Oriented Design concepts

• Able to implement, write professional documentation, and conduct tests

• Be familiar with professional software development environment (strict deadlines, team work, high standard)

Page 6: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Technology Requirement

• J2SE Software Development Kit (SDK): ): http://java.sun.com/javase/downloads/index.jsp (just download SDK 5.0 or later)

• Eclipse: http://www.eclipse.org/downloads/

Page 7: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Course detail - Topics

Design, implement, document, testing

a real world application

Understand businessRequirement and Design

Implementation focusingOn code reuse

DocumentationTesting

Page 8: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Course detail - Evaluation

GRADABLE POINTS

Labs 120

Mid term Exam 160

6 Projects 420

Final Exam 200

Quizzes 100

Total 1000

Page 9: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Grading (+/-)

Letter Grade

Percentage Letter Grade

Percentage

A 94 to 100% A- 90 to 93%

B+ 87 to 89% B 84 to 86%

B- 80 to 83% C+ 77 to 79%

C 74 to 76% C- 70 to 73%

D+ 67 to 69% D 64 to 66%

D- 60 to 63% F Less than 60%

Page 10: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Quiz

• Quiz is used to measure:- class attendance- class preparation

• Not all material will be covered in a 75-minute class

– Book complements the lectures

Page 11: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Fall 06 grade distribution

MCS 220 Grade Distribution

A

B

C

D

F

Page 12: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Spring 07 grade distribution

MCS 220 Grade Distribution

A

B

C

D

F

Page 13: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Must-have for success

Reading textbook Practicing (labs+projects) Devote time)

+ +

=

Page 14: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Getting started…

Prerequisite: COMPSCI 172,

What do we still remember or know about Java and Object-Oriented Design?

Page 15: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

1. Java is the only object-oriented programming languagea. Trueb. False

Page 16: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

2. The differences between a constant and a variable in Java is:a. a data value for a variable can be changed and a data value for a constant can not be changedb. a data value for a constant can be changed and a data value for a variable can not be changedc. a data value for a constant sometimes can be changed and a data value for a variable sometimes can not be changedd. None of the above

Page 17: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

3. Which of the following statements about a do…while repetition statement is true?

a. The body of a do…while loop is executed only if the terminating condition is true.

b. The body of a do…while loop is executed only once.

c. The body of a do…while loop is always executed at least once.

d. None of the above

Page 18: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

4. Which of the following is the constructor of class ToughQuestion:a. public String ToughQuestion(String question) { ….}b. public ToughQuestion(String question) {…}c. public static void ToughQuestion(String question) {….}d. void ToughQuestion(String question) {….}

Page 19: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

5. Commands to compile and execute a java program are:

a. run and java b. execute and javac c. javac and java d. compile and run

Page 20: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

6. What are the two ways that a Java array can be declared? a. <data type>[ ] <arrayname>;

<data type> <arrayname>;

b. <data type> <arrayname>[ ]; <data type>[ ] <arrayname>;

c. [ ]<data type> <arrayname>; <data type>[ ] <arrayname>;

d. <data type>[ ] <arrayname>; <data type>; <arrayname>[ ]

Page 21: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

7. When would a programmer be forced to pick a linear search over a binary search? (assuming that we can’t do anything on the given array)

a. When the items in the array are in ascending order

b. When the items in the array are unsorted c. When the items in the array are in descending

orderd. None of the above

Page 22: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

8. Which of the following for-loop control results in equivalent numbers of iterations:A and B.C and D.A and B have equivalent iterations and C and D have equivalent iterations.None of the loops have equivalent iterations.

Page 23: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

9. What is the value of result after the following Java statements execute?int a, b, c, d, result;a = 4;b = 12;c = 37;d = 51;result = d + a * c + a % b + a;

207

Page 24: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Assessment

10. Which of the following group(s) does (do) NOT contain any object-oriented programming language:a. Visual Basic, C++b. Pascal, Cc. C++, Javad. Lisp, Fortran

Page 25: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Class Focus

Professional software development

Strict deadlines, high standard, ridiculous demands (some times)

Page 26: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

History

• Programming languages – Low level programming language: CPU

instruction sets.– High level programming languages:

• Compiled (C/C++, Pascal) and interpreted language (Basic)

• Procedural (Pascal, C) and object oriented language (C++, Java)

Page 27: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

A look at other languages

• FORTRAN– FORmula TRANslator

• COBOL– COmmon Business Oriented Language

• Pascal– Structured programming

• Ada– Multitasking

Page 28: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

A look at other languages

• BASIC– Beginner’s All-Purpose Symbolic Instruction Code

• .NET– .NET platform

• Visual Basic .NET– Based on BASIC

• Visual C++– Based on C++

• C#– Based on C++ and Java

Page 29: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

History of Java

• Java– Originally for intelligent consumer-electronic

devices– Then used for creating Web pages with

dynamic content– Now also used to:

• Develop large-scale enterprise applications• Enhance WWW server functionality• Provide applications for consumer devices (cell

phones, etc.)

Page 30: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

More stories…

• Oak: a reimplementation of C++ in the early 1990s by James Gosling et al.– Intended for intelligent consumer devices.

• Oak became Java in 1995.– Portability and Security of primary concern.– Eminently suitable for Web applets.– Also a powerful language in its own right.

Page 31: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Novelty from Software engineering perspective

• Software reuse: Avoid reinventing the wheel—use existing pieces wherever possible. This practice is central to object-oriented programming.– Classes and methods from class libraries.– Classes and methods you create yourself– Classes and methods that others create and

make available to you.

Page 32: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Typical Java Development Environment

Java programs normally undergo five phases– Edit

• Programmer writes program (and stores program on disk)

– Compile• Compiler creates bytecodes from program

– Load• Class loader stores bytecodes in memory

– Verify• Bytecode Verifier confirms bytecodes do not violate

security restrictions– Execute

• JVM translates bytecodes into machine language

Page 33: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Example of UML

Page 34: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Portability

• Theory: Platform-independent dent (portability)– The JVM is an imaginary CPU with bytecode

instructions. Java programs are translated to bytecodes by the Java compiler

• Practice: differences between compilers, JVMs and computers can make portability difficult to achieve. Simply writing programs in Java does not guarantee portability.

Page 35: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Testing

• Always test your Java programs on all systems on which you intend to run them, to ensure that they will work correctly for their intended audiences.

Page 36: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Introduction to Object Technology and the UML

• Unified Modeling Language (UML)– Graphical language that uses common

notation– Allows developers to represent object-

oriented designs

Page 37: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Introduction to Object Technology and the UML

• Unified Modeling Language (UML)– Graphical language that uses common notation– Allows developers to represent object-oriented designs

• Objects– Reusable software components that model real-world

items– Look all around you

• People, animals, plants, cars, etc.

– Attributes• Size, shape, color, weight, etc.

– Behaviors• Babies cry, crawl, sleep, etc.

Page 38: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

OOD and OOP

• Object-oriented design (OOD)– Models real-world objects– Models communication among objects– Encapsulates attributes and operations

(behaviors)• Information hiding• Communication through well-defined interfaces

• Object-oriented language (OOP)– Programming in object-oriented languages is

called object-oriented programming (OOP)– Example: C++, Java

Page 39: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

OOD/A continues

• Object-Oriented Analysis and Design (OOA/D)– Essential for large programs– Analyze program requirements, then

develop solution– UML

• Unified Modeling Language

Page 40: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

UML

• History of the UML– Need developed for process with which to approach

OOA/D– Brainchild of Booch, Rumbaugh and Jacobson– Object Management Group (OMG) supervised– Version 1.5 is current version

• Version 2 under development

• UML– Graphical representation scheme– Enables developers to model object-oriented systems– Flexible and extensible

Page 41: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is a correct variable declaration statement?

a. int x - float y;b. int x: float y;c. int x,y;d. Long int x;

Page 42: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is a correct variable declaration statement?

a. int x - float y;b. int x: float y;c. int x,y;d. Long int x;

Page 43: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is not a Java keyword?a. dob. nextc. whiled. for

Page 44: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is not a Java keyword?a. dob. nextc. whiled. for

Page 45: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is not an error (either a syntax error or a logic error)?

a. Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false.

b. Spelling a key word (such as while or if) with a capitalized first letter.

c. Using a condition for a while statement that is initially false.

d. An infinite loop.e. None of the above

Page 46: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

Which of the following is not an error (either a syntax error or a logic error)?

a. Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false.

b. Spelling a key word (such as while or if) with a capitalized first letter.

c. Using a condition for a while statement that is initially false.

d. An infinite loop.e. None of the above

Page 47: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

int counter;counter = 1;while ( counter > 20 ) { // body of loop counter = counter + 1;} // end while

a. 19.b. 20.c. 21.d. 0.

Page 48: MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour:

Review

int counter;counter = 1;while ( counter > 20 ) { // body of loop counter = counter + 1;} // end while

a. 19.b. 20.c. 21.d. 0.