Sie sind auf Seite 1von 13

Announcements

• Handouts (5) to pick up


– Course syllabus
– Tutorial/lab signup form (due 4pm today)
– Lecture 1 notes
– Homework 1
– Initial assessment
• Please do it now and hand it in as you leave lecture
• It’s ungraded; it is used only in aggregate form for
course evaluation

1.00 Lecture 1

Course Overview
Introduction to Java

1
1.00 course information
• Course staff:
– 2 instructors, 8 TAs, 2 RAs, 2 lab TAs,
graders
• Course Web page:
web.mit.edu/1.00/www/
– 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 a bit on 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++ at end; also similar
• Use of computation for scientific,
engineering, management problems
– Homeworks cover variety of problems
• Software patterns, e.g.,
– Model-view-controller
– Problem generator-solver-output generator

3
Course goals, p.2
• Graphical user interfaces
– Java Swing, event models
• Algorithms
– Sorting, searching, traversing, …
– Concepts, programming, libraries
• Data structures
– Stacks, queues, trees, lists, …
– Concepts, programming, libraries
• Use of libraries
– Prewritten modules for common tasks

Laptops, labs and tutorials


• Hand in your laptop/tutorial/lab signup form at
end of class or by 4pm today in 5-336
– Laptop partner, lab and tutorial assignments will be
posted on Web site tomorrow at 9am
• Get laptop tomorrow (Thursday) or Friday
– Room 26-055, Thu 9am-5pm, Fri 9am-1pm
– Each pair of students receives laptop for term
– You must come with your partner to pick up laptop
• The first lab is Friday: 1-2:30 or 3-4:30, 26-152
– Lab every Friday all term at those times (2 sections)
– Mandatory attendance. Come with partner, laptop
• Tutorials start next week: Mon and Tue
– Separate experienced and inexperienced sections.
– Mandatory attendance. Come with partner, laptop

4
Laptops, labs, tutorials (p.2)
• Friday labs use laptops, active learning exercises
– Mini-lectures with lab exercises: programming,
simulations, short exercises.
– TAs, instructors assist during lab
• Tutorials will also use active learning methods
– 8 students per tutorial (4 pairs)
– Short questions, review lecture topics, design exercises
• Laptops
– Laptops have wireless cards. Use them all over campus
– You may use them for other classes this term
– Return them at or before final exam
• Homework
– Turn in via Command (command.mit.edu)
– Register on Command in the next few days

Writing Java programs


• Laptop computers (Microsoft Windows)
– Forte Java integrated development environment
(IDE)
– You may load Java and Forte on your own
laptop or desktop computer:
• Windows2000, 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

5
Course requirements, resources
• Course requirements
– 10 problem sets (60% of grade). Due Fridays.
– 2 in-class quizzes (16%). On Wednesdays at regular
class time. No evening quizzes this term.
– Final exam during finals period (17%)
• Quizzes, exam are open book, open notes
– Tutorials weekly. Mandatory attendance. (3%)
– Friday lab weekly. Mandatory attendance (4%)
• Course resources
– TA office hours. Schedule to be posted on Web and 5-
336 next Mon: 16+ TA hours per week
– Lab TA hours: Wed and Thu evening, 8 hrs each
– Instructor office hours after class and by appt
– Text: Horstmann/Cornell, Core Java, Vol. 1

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 you’re writing.
• We strongly prefer that you get help from TAs,
instructors when writing your program

6
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

What will you get?


– HP Omnibook 6000, all-in-one unit
• 256MB RAM
• 30 GB disk
• Lucent Wireless LAN cards (802.11b)
• 650 MHz Pentium III
• Extra battery
• Case
• Software: Forte, Netscape, and MIT Utilities
(Purple CD) and TSM (backup)

7
Getting Help
• Course Technical Support: Bassam
Chaptini, for all course related
questions
– 3-3456, bhc@mit.edu, 9-355 (Carrel J)
• For general hardware & MIT apps
support contact either Bassam or I/S
– Laptop Technical: # 452-4757 (2-4SLP),
or laptop-project@mit.edu

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

8
Our Responsibilities to You
• Prompt responsive support for MIT
apps and connectivity
• Hardware repair
– Loaner pool machines
• General help

Mutual Responsibilities
• Backup
– TSM has been installed (back up tool)
– 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 TSM backups or
your personal AFS locker
• Make this a successful pilot project!
– Help us by volunteering to keep a journal of
your experiences, and, participate in some
focus groups (3) over the course of the
semester (free pizza!!!)

9
Java
• Modern programming language used for
technical and commercial applications
– Object oriented, as is most modern software
– Internet-focused, supports distributed computing
• In the first half of the term, we teach basic
elements of Java
– Focus on syntax, basic concepts, user interface
• In the second half of the term, we teach
object-oriented applications
– Focus on numerical applications, data structures,
algorithms

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 1.00 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: Pipe class-> many Pipes (objects)

10
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
(except in homework 1)
– Objects are extensible through inheritance
mechanisms
• Children have parent’s traits (state and behavior) and can
modify or add traits
• Objects can dynamically invoke objects that didn’t exist
(weren’t written yet) when the invoker was written. This,
and other object concepts, promote code re-use.

Developing a Java program


• Read the homework and understand it.
– If you don’t know what you have to do, you won’t be
able to do it.
• Sketch out a design: objects, state, behavior.
– Decide how to approach the problem
– Sketch the approach, in words or pictures. Sketch in
stages.
• Write the program in Java, using Forte
– Create Java source code files in Forte explorer/project
– Write Java code using Forte editor
– Write only as much as you think will compile at each
stage (e.g., reading the input). Use Forte Java compiler
– Once one stage compiles, write and compile the next.
Stage size will increase over the term.
• Test, mostly by reading/reviewing code in Forte
– Use the Forte debugger to read code
• Repeat the cycle again to pick up details

11
Sample Java application

public class Welcome1 {


public static void main(String[] args) {
System.out.println("Welcome to 1.00");
int students= 240;
int grads= 35;
double pctGrads= (double) grads/students; // Hmmm.
System.out.println("Percent grads: " + pctGrads);
System.exit(0);
}
}

// Lecture slides will use compressed format with {}


// Use more white space in your code
// Lecture slides will omit System.exit(0); you must use it

Sample GUI application


// GUI application opens its own window (frame) on the PC
import javax.swing.*;
import java.awt.*;

public class Welcome extends JFrame {


// Creates new form (object) Welcome
// main called when application starts
public static void main(String args[]) {
Welcome app= new Welcome();
app.setDefaultCloseOperation(EXIT_ON_CLOSE);
app.show();
}

public Welcome() { // Constructor-called on creation


JLabel myLabel= new JLabel("Welcome to 1.00 again");
setSize(300,200);
Container conPane= getContentPane();
conPane.add(myLabel);
}
}

12
Things to do
• Hand in your initial assessment
• Hand in your tutorial assignment form by
4pm today in 5-336
– Those needing a partner: please meet in front
or outside briefly now to find one.
• Check your partner, lab, tutorial sections
tomorrow at 9am on 1.00 Web site
• Pick up your laptop tomorrow or Friday
– Both partners must come
• Attend your assigned lab section Friday
– Bring laptop, partner; we’ll learn to use Forte
• Tutorials start next Monday and Tuesday
• Register on MIT Command

13

Das könnte Ihnen auch gefallen