Computer Science 202
Introduction to Programming
Fall 2013, The College of Saint Rose
Lecture 1: Introduction and Overview
Date: Tuesday, August 27, 2013
Agenda
- Welcome to Computer Science 202!
- Why take this course?
- Pre-course evaulation
- Syllabus and administrative details
- SubmissionBox setup
We will be using a system called "SubmissionBox," developed by
software engineering students here at Saint Rose, for the submission
of most of your work this semester. We'll start by making sure
everyone can log in and submit a test assignment before we move on to
the first in-class exercise.
After you each get a chance to set a password, we will work together
through the submission procedure.
- In-class Exercise 1 - (5 lecture assignment
points) due before the end of class.
Before you leave class today, we will make sure everyone can run a
Java program in the BlueJ development environment that we will be
using all semester. We will work together through this exercise. It
is important to keep up - ask if you are having trouble at any step.
For today, everyone should use one of the lab computers. If you would
like to use your own computer later, we will see soon how to set that
up.
Here is the outline of our procedure:
- Create a folder where you will store your work for this course.
It is essential that you choose a location that is on your network
storage space (the "H" drive) so it will be available on any
computer in the lab (and in fact, on computers in labs all over
campus). I suggest calling your folder something like
"CS202" without any spaces.
- Launch BlueJ by clicking its icon on the desktop. A mostly
blank window, called the project window, with some greyed out
buttons, should appear.
- From the "Project" menu, choose "New Project". In the
window that pops up, navigate to the folder you created above, then
enter "InClass1", again with no spaces in the "File" box, then
click "Create". You should now see an icon in your BlueJ window
that looks like a sheet of lined paper, and the buttons on the left
side should now be active.
- Click the "New Class..." button. In the "Class Name" field,
enter "HelloWorld", again with no spaces, and make sure that the
"Class Type" is selected as "WindowController Class", then click
"Ok". You should now see another icon in your project window
labeled "HelloWorld" and with some diagonal lines across it.
- Double-click on the new "HelloWorld" icon. This should bring
up an editor window with the skeleton of a program that we will use
as a starting point. You should see text displayed in a few colors
and some of it within shaded boxes. We will learn all about what's
going on there as we go forward.
- Click the "Compile" button at the top of the editor window.
If all goes well, you should see a message at the bottom of the
editor window: "Class compiled - no syntax errors".
- Now, go back to the project window. The "HelloWorld" icon
should no longer have the diagonal lines across it. And now we're
ready to run the program. Right-click on the "HelloWorld" icon,
which should bring up a menu. The last item in that menu is what
you want: "Run Controller". Choose this. Two things should
happen: a new red icon should appear at the bottom of the project
window, and a brand new window should appear, mostly if not
completely blank and white. This new window is one we will refer to
as the canvas. Congratulations, you have run a Java program, albeit
an incredibly boring and useless one. Close the canvas window when
you are done admiring it.
- To make our program slightly more interesting, we are going to
make it display a message on the canvas. Go back to the editor
window, the one with the program text. On the blank line between
the
{
and }
, type the following line, exactly as you
see it here, including all spacing and punctuation:
new Text("Hello, world!", 100, 100, canvas);
- Now hit the "Compile" button again on the editor window, and
choose "Run Controller" again from the popup menu on the
"HelloWorld" icon on the project window. The canvas that comes up
should now have a message displayed.
- Now, go back to the editor window and change the paragraph at
the top to a message that briefly describes what you just did (a
sentence or two is sufficient here), and replace the "(your name)"
after the
@author
with your name. Re-compile (the
"Compile" button) and re-run (the "Run Controller" menu item)
the program to make sure you didn't break anything.
- Finally, to make sure your program looks pretty, go back to the
editor window and choose "Auto-layout" from the "Edit" menu.
This will indent all of your code nicely (more on this later).
Re-compile and re-run one last time to make sure everything still works.
Please submit only the file
HelloWorld.java in
Submission Box
under "InClass1" before you leave class.
Lecture 1 Assignment
Due at the start of class, Thursday, August 29.
Please submit answers to these questions
in
Submission Box
under "LA1" by the start of our next class. We will
discuss these questions at the start of class, so no late
submissions are accepted.
- I would like to get a better sense of everyone's backgrounds
coming in. Please answer each of the following. (4 points)
- What is your name, year, and major?
- If you are not already one, are you considering
a major or a minor in CS or IT?
- Have you taken any other computer science, either before or
at Saint Rose?
- Do you have any programming experience? If so, which
programming languages have you used and how complex were the
programs you developed?
- What was your high school and home town?
- What is your favorite restaurant in your home town and what
should I order there?
- What types of computers (e.g., PC running Windows, Mac) have
you used?
- If you plan to use computers other than those in
Saint Rose labs for course work, what type of computer
do you plan to use?
- In an effort to get to know you and to make sure you know how to
find me, please stop by my office (Albertus Hall 400-2) and introduce
yourself as a Computer Science 202 student (some time this week). (3 points)
Examples
Late penalty graph: