itm 352 introduction to applications programming prof. daniel port
TRANSCRIPT
ITM 352
Introduction to Applications Programming
Prof. Daniel Port
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 2
Your Mission…
Your mission (should you decide to accept it) is to analyze, design, and build software
information service applications
using Java…using Java….
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 3
Goals of this class Fundamental CS concepts: abstractions, modeling, OO
analysis and design, algorithms, time/space complexity Programming concepts: variables, conditional
execution, iteration, recursion, object-oriented programming, etc.
Programming mechanics: compiling, debugging, software applications, user interfaces, IDE’s, etc.
Good programming practice, potential pitfalls Preparation for Database and other programming
oriented courses, software project management
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 4
This is Education...
Not “training” but “to draw out” goal is not to be comprehensive, but to
comprehend awareness is paramount, skills secondary…
“Want to play the game, gotta learn the lingo”We will adjust the course as needed
your interaction is essentialsilence = death
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 5
What is Java?
A programming language.- All computers are directed by programs
- like very detailed recipes
- written in languages that humans can understand and be processed by computers (unlike English at present)
Java is one among many thousands of such languages.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 6
What’s special about Java?
Object-oriented, like the most popular languages used today for the most innovative applications.
Current, designed according to the latest understanding of programming language design.
Portable, so it can be run on almost any computer.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 7
Why are you learning Java? In ITM you will learn about managing and
developing information technology. Some of this will involve programming either on your part or by those you work with. Java has the basic elements of most programming languages.
Java is very popular and well supported In the real world, … Besides, you can do many fun things quickly
and easily in Java (rich libraries)
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 8
Brief syllabusJava is our vehicle for learning programming
concepts that apply to all programming languages. Code-Test-Debug Cycle Simple applications Conditional execution Object-oriented programming Iteration Data Structures (e.g. Strings, Arrays, etc.) Complexity
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 9
Vital infoInstructors
Prof. Daniel Port, Office: E601k Phone: 956-7474 (soon…)Email: [email protected] hours: TR 11-12:00 and by appointment
Class web page (expected)http://www2.hawaii.edu/~dport/ITM352.htm (check it at least twice a week)
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 10
About Your Instructor BA Mathematics - UCLA PhD Applied Mathematics and Theoretical
Computer Science - MIT 6 High-tech startups - products, consulting Professional services at NeXT Inc. EC2 Multimedia Business Incubator - USC Research Asst. Prof. - USC CS Dept. Asst. Prof. – U. of Hawaii (new!)Research areas: Software Engineering, Software Engineering Economics
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 11
More vital info
Lectures – section 1: TuTh 12:00 – 1:15 section 2: TuTh 1:30 – 2:45 You can go to either section anytime
When in need of help: try the web site ask the instructor
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 12
AssignmentsTwo mid-term exams, final examSeveral short quizzes Five Programming assignments
Approximately ever three weeks To be submitted electronically unless otherwise
stated (I will explain this later)
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 13
Class slidesPowerPoint slides will be available on class
web page in powerpoint formatSlides will not normally be available until
after class need to maintain flexibility we do not want to encourage skipping class! I am willing to change this if class participation
is maintained
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 14
GradingApproximate weighting of graded items
Midterms - 35%, Final - 25% Programming assignments/quizzes - 30% total Class participation – 10% Lowest assignment/quiz will be dropped
Approximate scale for final grades 88 - 100% A’s 78 - 87% B’s 68 - 77% C’s
It is possible for everyone to get an “A”
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 15
Responsibilities - Mine Hand out assignments in a timely manner
Provide clear programming assignments and exam
questions
Fair grading
Respond to e-mail
Help you comprehend material
Adjust course as needed to benefit the majority
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 16
Responsibilities - Yours Come to class, ask questions Read textbook sections before lecture Begin assignments early; hand in on time Check web-site and email list regularly Seek help when needed Deal with problems directly, responsibly Do no less than your very best (but have some fun
while doing it) No excuses!!!!
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 17
How To Do Well In 352 Attend lectures, ask questions (I will sometimes
ask questions of the class) Do all assignments early (especially readings!!!) Best advice (thanks mom!):
Always ask “how does this apply” Always try to understand what the instructor wants you
to know Find something interesting about the material Go above and beyond what is asked for
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 18
Course policiesLateness
Programming assignments will not normally be accepted late. Bone-fide emergencies only.
Cheating - On exam: zero on that exam On programming assignments: -100% on first
offense (we use sophisticated detection tech.) Second offense (of any kind): “F” in course Bottom line: don’t do it, it’s never worth the risk
(there also really is never any need)
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 19
How to Fail 352 Some examples of things that will make you sad:
Submitting someone else's work Copying someone else's exam/quiz answers Collaborating on programming assignments (general
discussions on approach not included) Acquiring exam/quiz questions prior Enabling anyone to do the above
Any form of cheating will not be tolerated I’ve done plenty myself … it’s simply not worth it. If you are struggling, I will do my best to help I am a “softie” when I see honest effort, I am a total
jerk if I suspect lack of effort or cheating
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 20
How Class Will Work Lectures on basic CS and Java concepts
We may not always cover everything in the book We may not complete all lecture slides
In class demonstrations Usually code examples
In class discussions Philosophical and managerial topics Your interaction is critical, so don’t be shy
Scheduled computer lab sessions Hands-on assistance on assignments Extra material and experience for your edification
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 21
Final Words… Programming is not a memorization subject.
You must immerse yourself it it until you know in your mind, heart, and gut each fundamental concept.
Ask questions and practice until you fully comprehend each concept, then you assuredly will do very well.
You do not have to be a stellar programmer to do well in this course, you simply need to be proficient in the fundamental practice of programming.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 22
Class Survey Periodically I will ask the class questions to
help me adjust the course material
What Do You Want From 352?Learn how software applications are
programmed?Understand what programmers do????
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 23
Now on to the course material…
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 24
What is programming?
Direct computer’s actions in detailUses a language that humans can work with
and translates into something the computer understands
Builds a computer representation of abstractions (a model) that people value in some way
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 25
What language does a computer understand?
Machine language - 0’s and 1’s (bits) arranged in very precise order instructions to hardware, mostly a CPU
Different types of machines have different machine languages, meaning that different sequences of bits are needed to make the computer do the same thing. However, all CPU’s of one type - e.g. all Pentium II’s, all PowerPC’s - have the same machine language
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 26
Executing m. l. programs
01100011110010...
input
output
memory central pro-cessing unit
Bits in memory are instructions telling CPU what to do.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 27
High-level languageNo one writes in machine language any
more. We write in languages like Java:class Hello {
/* @Author: Dr.Chandra */
public static void main (String[] args) {
// Be polite, say hello
System.out.println(“Hello, I’m feeling well adjusted today.”);
}
}Don’t worry if you don’t understand the above, it’s what we’ll learn in this class!
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 28
Translating high-level languagesThe program (source code) typically would
be stored in file called Hello.source. This is called the source file.
Use a program called a compiler to translate the source file into binary machine code and written to an object file called Hello.bin
The resulting file can usually be executed (binary passed to CPU) or linked to libraries then executed
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 29
Compilers
Compiler translates source code to object code
class Hello { . . .}
001010111; ....
sourcefile
objectfile
After running compiler, object file representing CPU instructions can be loaded into memory and sent to the CPU for processing
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 30
Java is a little different... The Java program (source code) typically would
be stored in file called Hello.java. This is called the source file.
Use a program called a compiler to translate the source file into byte codes and written to an object file called Hello.class.
Another program called an interpreter translates byte codes into machine language for the CPU at runtime
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 31
Java virtual machine
Different types of machines have different machine languages. For portability, Java is implemented differently.
Java sourceprogram
compiler “Java virtualmachine” code
load
browser (or JVM) running in computerloads and executes JVM code
There are native compilers that directly translate Java into machine language.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 32
Writing and running Java programs
Edit Java program Hello.java (source file).
Enter command javac Hello.java
(Creates object file, Hello.class.)Enter command
java Hello
(Runs the object file.)
compiler
JVM Interpreter
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 33
Applications vs. applets
Applications: stand-alone programs, usually invoked from command line.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 34
Applications vs. applets (cont.)
Applets: run within a window in a browser.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 35
Writing and running appletsWrite applet - place in HelloApp.java.
public class HelloApp extends Applet { public void init () { add(new Label(“Hello, I’m feeling well adjusted today.”)); }}
Run compiler javac HelloApp.javato create object file HelloApp.class.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 36
Writing and running applets (cont.)
Write HTML page, say mypage.html: <Title>My home page</Title>
<Body> <H4>My first applet</H4>
<Applet code="HelloApp.class"
width=50 height=20>
</Applet>
</Body>
Run browserLoad mypage.html into browser.
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 37
Assignment 1
Read (when available, may be posted on web): Savitch: Ch. 1 and 2
Install JBuilder Serial number in Appendix 12, P. 1028
Compile and run FirstProgram.java
1/14/03 ITM 352 - Spring, 2003 - © Port Intro to Intro to AP - 38
Next Class
Pictures!Basic Programming ConceptsProblems with JBuilder?