Notes From Class
Week 1: January 28, 30, and February 1, 2008
-
If you do not have a Glue or Wam computer account, please get one.
See the FAQ's for step-by-step instructions.
-
I have put your picture on the meet the class page.
If you have any objections (e.g., the mug shot isn't up to
your usual GQ/Vogue standards), please let me know.
-
The National Education Association has created a little 6 minute video called
Shift Happens.
-
The class reader is now available at the Engineering Copy Center.
Cost is $35.00.
Week 3: February 11, 13 and 15, 2008
Week 4: February 18, 20 and 22, 2008
-
Prelude to Homework 1 ....
Make sure that you know how to log in to either your glue or wam account.
Read the instructions for creating a personal home page (pg. 23 of the light blue
class reader). Then start to read the HTML tutorial .. use a text editor (vi or
pico) to type in the minimal html document on pages 27-28 of the class reader.
Then go to the "meet the class page" and make sure that the link from your
entry to your home page works.
-
Here are a few basic UNIX commands:
Unix Commands
--------------------------------------------------------------------------------
1. cd <-- change to home directory
2. cd file1 <-- change to directory file1
3. ls and ls -ls and ls -tl <-- list contents of a directory
4. mkdir file1 <-- make a directory called file1
5. rmdir file1 <-- remove directory file1
6. cp file1 file2 <-- copy file1 to file2
7. mv file1 file2 <-- move file1 to file2
--------------------------------------------------------------------------------
Note. Directories cannot be removed unless they are empty.
Let's suppose that you have created a file and now you want to remove it. Try:
8. rm file1 <-- remoove/delete file1
Text editor commands
--------------------------------------------------------------------------------
1. vi filename <-- use vi editor to change contents of filename.
For example, the command sequence:
prompt >> cd ../pub
prompt >> vi Welcome.html
prompt >> vi resume.html
prompt >> vi ce-systems.html
moves your shell to the public directory and then systemantically creates the
HTML files for your home page, resume and trip page. Notice that each file
name has the "html" extension -- web browsers need this information.
The class reader contains a list of basic editor commands.
--------------------------------------------------------------------------------
-
Homework 1 is available.
Due date is 9am, February 27, 2008.
Week 5: February 25, 27 and 29, 2008
-
Reading.
In class we will move from discussion of html to xml.
Please read the article by Bosak J. and Bray T., XML and the Second Generation,
beginning on pg. 65 of the light blue lecture notres.
Week 6: March 3, 5 and 7, 2008
-
Here is an
interesting article on a new language to support
Semantic Web computing ... read down the bottom on its potential uses,
including getting facebook/myspace accounts to talk to one another.
-
Homework 2 is available.
Due date is 12pm, March 14, 2008.
Week 7: March 10, 12 and 14, 2008
-
Midterm 1. March 12, 9am.
The midterm will cover Chapters 1 and 2 of the class text,
the tutorials at the beginning of the "light blue" lecture notes,
introduction to object-oriented programming concepts and Java,
and anything that was written on the
board during the first seven weeks of class.
Week 8: March 17-21, 2008
-
Spring Break -- No class!!!
Week 9: March 24, 26, and 28, 2008
-
Reading
Please read Chapter 16 of Austin/Chancogne.
-
Homework 3 is available.
Due date is 9am, April 16, 2008.
Week 10: March 31. April 2 and 4, 2008
-
Please read Sections 18.1 and 18.2 of Austin/Chancogne.
They cover the basic concepts of writing, compiling, and running a very simple Java program.
-
Friday April 4.
No Class -- I have to go to California to give a talk....
Please use the class time to work on your Java homework.
Week 12: April 14, 16 and 18, 2008
-
For problem 11, a suitable program structure is:
public class OpenChannel {
public static void main ( String args[] ) {
// Define two-dimensional array of channel properties....
double channel[][] = { { ... fill in missing details ... },
{ ... fill in missing details ... },
{ ... fill in missing details ... } };
// Print channel properties....
... fill in missing details ...
// Compute and print water velocities....
... fill in missing details ...
}
}
You should use a simple looping construc to print the channel properties
and a second loop and Math methods to compute and pring the water velocities.
-
We are revisiting the topic of variables and filling in details on
how variable modifiers can be used to affect scope (i.e., who
can see the variable) and life (i.e., when can they see the variable).
For details, see Section 18.5 of Austin/Chancogne.
-
The topic of "variable modifiers" is a lead in to method and class
modifiers -- details can be found on the frequently-asked questions
web page and in Section 18.8 of Austin/Chancogne.
Week 13: April 21, 23 and 25, 2008
-
Midterm 2 (35%): April 25. Open book and open notes. This exam
will cover the basics of programming in Java.
Week 14: April 28 and 30. May 2, 2008
-
Homework 4 is available.
Due date is 9am, May 12, 2008.
No extensions!!
-
Week 15: May 5, 7 and 9, 2008
-
Java Collections
Now that we know how to create objects,
the next thing to think about is their organization.
How, for example, do you organize (or aggregate) large numbers of
objects so that things are easy to find and modify?
A good organization will represent data items that form a natural group,
such as:
-
A poker hand (a collection of cards),
-
A mail folder (a collection of letters), or a
-
Telephone directory (a mapping of names to phone numbers).
A
collection
is an object that groups multiple elements into a single unit.
Units include:
-
Sets.
A set is a collection that cannot contain duplicate elements.
-
Lists.
An ordered collection (sometimes called a sequence).
Lists can contain duplicate elements.
The user of a List generally has precise control over
where in the list each element is inserted and can
access elements by their integer index (position).
-
Queues.
Queues typically order elements in a FIFO (first-in-first-out) manner.
-
Maps.
An object that maps keys to values.
A Map cannot contain duplicate keys.
Each key can map to at most one value.
-
SortedSet
A Set that maintains its elements in ascending order.
Several additional operations are provided to take
advantage of the ordering.
Sorted sets are used for naturally ordered sets,
such as word lists and membership rolls.
-
SortedMap
A Map that maintains its mappings in ascending key order.
This is the Map analog of SortedSet.
Sorted maps are used for naturally ordered collections of key/value pairs,
such as dictionaries and telephone directories.
Collections are used to store, retrieve, manipulate, and communicate aggregate data.
Typically, they represent data items that form a natural group.
-
Here are the essential details of an arraylist of strings.
/**
* ==============================================================
* ArrayTest3.java: Demo ArrayList Example in Handout...
*
* Written by: Mark Austin April 2006
* ==============================================================
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ArrayTest3 {
public static void main( String args[] ) {
// Create and print a simple array of strings .....
List stringList = new ArrayList();
stringList.add("A");
stringList.add("Red");
stringList.add("Indian");
stringList.add("Thought");
stringList.add("He");
stringList.add("Might");
stringList.add("Eat");
stringList.add("Toffee");
stringList.add("In");
stringList.add("Church");
System.out.println("Use for loop to walk along list" );
System.out.println("=================================" );
for ( int i = 0; i < stringList.size(); i = i + 1 )
System.out.println("Name = " + stringList.get(i) );
System.out.println("Use Iterator to walk along list" );
System.out.println("=================================" );
Iterator iterator1 = stringList.iterator();
while ( iterator1.hasNext() != false ) {
String s = (String) iterator1.next();
System.out.println("Name = " + s );
}
}
}
Week 17: .....
-
Final Exam
May 19, 8-10am in our regular classroom.
The exams is open book and open notes and will be a lot like midterm 2.
Developed in January 2008 by Mark Austin
Copyright © 2008, Department of Civil and Environmental Engineering,
University of Maryland