CS271 ASSEMBLY LANGUAGE PROGRAMMING

Download Report

Transcript CS271 ASSEMBLY LANGUAGE PROGRAMMING

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
• Graduated from the University of
Connecticut (05 Class), Ph.D in
Computer Science and Engineering
• Master of Computer Science from
UW-Milwaukee (96-99)
• Bachelor of Science from Hanoi
University of Technology (86-91)
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
Contact information
[email protected]
(fastest way to contact me)
McCutchan Hall 424
Office Hours: 8:30am – 10:30am,
1pm-2pm MW or by appointment
262 472 5170
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)
Technology Requirement
• J2SE Software Development Kit (SDK): ):
http://java.sun.com/javase/downloads/index.j
sp (just download SDK 5.0 or later)
• Eclipse: http://www.eclipse.org/downloads/
Course detail - Topics
Design, implement,
document, testing
a real world application
Understand business
Requirement
and Design
Implementation focusing
On code reuse
Documentation
Testing
Course detail - Evaluation
GRADABLE
POINTS
Labs
120
Mid term Exam
160
6 Projects
420
Final Exam
200
Quizzes
100
Total
1000
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%
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
Fall 06 grade distribution
MCS 220 Grade Distribution
A
B
C
D
F
Spring 07 grade distribution
MCS 220 Grade Distribution
A
B
C
D
F
Must-have for success
+
Reading textbook
=
+
Practicing (labs+projects)
Devote time)
Getting started…
Prerequisite: COMPSCI 172,
What do we still remember or know about
Java and Object-Oriented Design?
Assessment
1. Java is the only object-oriented programming
language
a. True
b. False
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 changed
b. a data value for a constant can be changed and a
data value for a variable can not be changed
c. a data value for a constant sometimes can be
changed and a data value for a variable sometimes
can not be changed
d. None of the above
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
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) {….}
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
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>[ ]
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 order
d. None of the above
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.
Assessment
9. What is the value of result after the following Java
statements execute?
int a, b, c, d, result;
a = 4;
207
b = 12;
c = 37;
d = 51;
result = d + a * c + a % b + a;
Assessment
10. Which of the following group(s) does (do)
NOT contain any object-oriented programming
language:
a. Visual Basic, C++
b. Pascal, C
c. C++, Java
d. Lisp, Fortran
Class Focus
Professional software development
Strict deadlines, high standard,
ridiculous demands (some times)
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)
A look at other languages
• FORTRAN
– FORmula TRANslator
• COBOL
– COmmon Business Oriented Language
• Pascal
– Structured programming
• Ada
– Multitasking
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
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.)
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.
Novelty from Software engineering
perspective
• Software reuse: Avoid reinventing the
wheel—use existing pieces wherever possible.
This practice is central to objectoriented programming.
– Classes and methods from class libraries.
– Classes and methods you create yourself
– Classes and methods that others create and make
available to you.
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
Example of UML
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.
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.
Introduction to Object Technology and
the UML
• Unified Modeling Language (UML)
– Graphical language that uses common notation
– Allows developers to represent object-oriented
designs
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.
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
OOD/A continues
• Object-Oriented Analysis and Design (OOA/D)
– Essential for large programs
– Analyze program requirements, then develop
solution
– UML
• Unified Modeling Language
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
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;
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;
Review
Which of the following is not a Java keyword?
a. do
b. next
c. while
d. for
Review
Which of the following is not a Java keyword?
a. do
b. next
c. while
d. for
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
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
Review
int counter;
counter = 1;
while ( counter > 20 )
{
// body of loop
counter = counter + 1;
} // end while
a. 19.
b. 20.
c. 21.
d. 0.
Review
int counter;
counter = 1;
while ( counter > 20 )
{
// body of loop
counter = counter + 1;
} // end while
a. 19.
b. 20.
c. 21.
d. 0.