Introduction To Computation and Problem Solving
Introduction To Computation and Problem Solving
Introduction To Computation and Problem Solving
Introduction to Computation
and Problem Solving
1
1.00/1.001 course information
Course staff:
2 instructors, 5 TAs, 1 RA, 1 lab TA, graders
Course Web page takes you to:
All course information on Web
Lectures, labs, tutorials, problem sets posted
on same day as live event
Hardcopy handouts at lecture, lab, tutorial
Pick them up as you come in
Grad students: register for 1.001, not 1.00
2
Course goals
Core concepts of software development
Software design and requirements
Development and debugging/testing
Teamwork in software implementation
Programming in interactive, object
oriented environment:
Java; Microsoft C# is very similar
Very brief intro to C++ and C# at end
Use of computation for scientific,
engineering, management problems
Homeworks cover variety of problems
Software patterns
3
Laptops, labs and tutorials
Hand in your laptop/tutorial/lab signup form on line-
See the course web site.
Assignment of partners to those who dont already
have one-notification by email.
Get laptop.
The first lab has Mandatory attendance. Come
with partner if you have one and your laptop.
Tutorials start next week: Two sessions / week
experienced and inexperienced sections.
Mandatory attendance.
Come with laptop and partner.
4
Writing Java programs
Laptop computers (Microsoft Windows XP)
Forte Java integrated development environment
(IDE). We will sometimes use BlueJ environment
You may load Java, BlueJ and Forte on your
own laptop or desktop computer:
Windows2000 or XP, 256MB RAM strongly
recommended
Download instructions for Java and Forte IDE
posted on 1.00 Web site
Lab Friday and tutorials next week will teach you
how to use the Forte IDE
Athena workstations (UNIX)
Forte Java IDE also available; same as on
laptops
Course Requirements
5
Course Resources
Academic honesty
You may collaborate on understanding lectures, labs,
text, tutorials, problem statements.
You may discuss the design of your program: options
for classes, method signatures.
You must then write your Java code yourself.
You may get help from students while writing your
programs only by:
Asking them to point out an error, but not to fix it
for you.
Explaining Java syntax to you. Use a different
example than the program youre writing.
We strongly prefer that you get help from TAs,
instructors when writing your program.
Wireless Laptop Initiative
Course 1.00 is one of 4 wireless laptop
pilot projects
Why laptops? Some reasons:
Easy, convenient access to computing
Assess value of collaborative learning
Examine supportability of this
technology
Determine tacit learning attributes
7
Getting connected
8
Your Responsibilities
Practice Safe Computing
Promiscuous use requires care
Provide good care and feeding of your
laptop
Return the computer at the end of the
semester in good condition
If the unthinkable happens
Contact Campus Police for theft
reporting
Notify your instructor/course technical
contact immediately
9
Mutual Responsibilities
Backup
Use SecureFX file transer utility to copy
things to your personal Athena locker
You need to use it
Recovery
Worst case scenario: machine re-
imaged by I/S and restored to original
working state
You load your data from your personal
AFS locker
Course Outline
Course has 8 major units:
Objects and Java
Program structure
Graphical user interfaces
Numerical Methods
Data Structures
Java Input and Output
Searching and Sorting
Threads and the Web
10
Class 1: Course Introduction
and Overview of Java
Javas history and goals
What exactly is Java?
Some key concepts in Java
Some simple Java programs
Javas History
11
Javas History continued
Traditional Computing
12
Aspects of Traditional
Computing
Executable programs are specific to
a hardware processor architecture
and operating system.
Applications typically preloaded onto
computer with execution initiated by
user.
Client computers, servers, handheld
devices separate environments.
13
Javas Design Goals
Safe, so you can trust application code
downloaded over the WWW
Portable, so you can develop on one system
but run on another
Distributed, so a thin client can take
advantage of network services
Scaleable, to build real applications based on
extensive pre-existing class libraries
14
Object-oriented programming
Objects are things (entities) that have state (data
fields) and behaviors (methods, functions)
They are a way of organizing large programs
into understandable, maintainable, reusable
pieces
Your programs, except for homework 1, will be a
set of objects interacting with one another to
produce the desired results
Examples will be pipes with fluid flows, bus
routes in bus networks, elevators in elevator
banks, polynomials, robots and stretch wrap
devices, dictionaries of misspelled words,
Classes are patterns from which objects are made
Object-oriented programming
Objects communicate by passing messages
They invoke behaviors (methods) and
pass parameters (data) in messages
Objects encapsulate or hide information
Details of one object are hidden from
other objects, so their details need not be
known
main method launches objects, does little
else
15
Object-oriented programming
16
Developing a Java program
17
Simple console application
public class Welcome1 {
public static void main(String[] args)
System.out.println("Welcome to the Course");
int students= 240;
int grads= 35;
double pctGrads= (double) grads/students;
System.out.println("Percent grads: " +
pctGrads);
System.exit(0);
}
}
18
Sample GUI application
// GUI application opens its own window (frame) on the PC
import javax.swing.*;
import java.awt.*;
A Simple Applet
import javax.swing.*;
getContentPane().add(myLabel);
}
}
19
Web page created by applet
20