Resources


Resources

Code Style Guidelines

Here

Piazza

CS2110 uses Piazza: a public forum for discussing questions about the assignments. The course staff monitors this group regularly, so this is a great way of getting help and interacting with the course staff. An extra advantage of using the group is that everyone else can benefit from your question as well. Anyone can visit the group and read previous questions here .

If you know the answer to a question, feel free to post a reply yourself, but please avoid giving away any hints on the homework or posting any part of a solution. This will be considered a violation of Academic Integrity. Generally, rough algorithms or non-solution-specific code fragments are OK if you need them to illustrate a point.

Quizzes

Section Examples

[Examples for the section will be posted here].

Setting up Java

In CS 2110, you'll be using an integrated development environment (IDE) called Eclipse to develop and debug your applications, which will be coded in the Java 6 or 7 Standard Edition (Java SE 7) platform, as released by Oracle and downloadable from Java.Oracle.com. 

Java SE 6 and SE 7 both include a Java Development Kit (JDK) as well as the Java Runtime Environment (JRE).  The way to think about all of this is that the Eclipse IDE is a "digital dashboard" and code editor for writing code and performing commands like compiling your program, pulling in standard libraries, identifying problems and fixing them.  Under the covers, the IDE is giving you a kind of friendly interface to the JDK, which has all sorts of standard libraries. 

And the JDK is like a computer (sort of a computer within your computer) that can run the resulting code.  While it is running the JRE is handling things like opening files for your program.  If you prefer to just think of the JDK and JRE as two parts of one thing, that would be fine. 

The IDE we use in CS2110 is Eclipse, and we use this even though Oracle has its own IDE for Java.  The version of Eclipse we work with is the "Juno" release.

We recommend that you start by installing Java and then install Eclipse, or that you try and find one of the "combined" Eclipse install packages that includes both Eclipse and Java and installs them both at once (but they don't exist for all possible platforms, unfortunately, and it actually looks as if the Eclipse folks have been phasing them out).  If you follow the steps, this should work for most students on most platforms.  But some mixtures of computers and versions of the operating system and so forth confuse the install scripts.  For those cases, our CS2110 consultants can help.

Some cs2110 students installed Java on their machines a while ago and try to cut corners and skip this install step.  That can be a mistake if that version of Java is too old.  You want version 6 or 7. 

To find out which version of the Java Runtime Environment (JRE) you are running, open a command window (in Windows, Start > Run... and type cmd, and in Mac OS X, Applications > Utilities > Terminal) and type java -version at the command prompt:

C:\>java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

This says I have version 6 installed (6 and 1.6 are synonymous), which is fine.  If this command had failed (meaning Java isn't installed at all), or had said you were running version 1.5, you would need to upgrade to the most current Java release, which is Java SE 7.

If you are on a PC running Windows and have never installed a version of the Java Development Kit (JDK) on your machine, you probably don't have it. If you are on a Mac, you probably do. To find out, type javac -version:

C:\>javac -version
javac 1.6.0_07

If you get an error message or the version is earlier than 1.6 or 1.7, you must (re)install the JDK.

Installing the JDK

The easiest way to install the JDK is to jump down to the link for installing Eclipse, below, and follow that.  Then select the option for installing the JDK and JDE as part of the Eclipse install.  In one easy (but slow) download, you'll have everything you need.  But if you can't find a combined package for your machine, which is an issue lately, you may need to first install the JDK by itself, and then install Eclipse by itself.  In what follows we'll explain how to do this.

The JDK is already installed in CIT and ACCEL labs. However, installing it own your own machine will greatly facilitate your work. Please note that you should double check your work in a public lab, as privately owned machines occasionally exhibit different behaviors.

Windows and Unix

  • To download the JDK, visit Oracle's Java web site and download and install JDK 7.   If you run into mention of "Sun", that's just the name of the company that created Java.  Sun was eventually acquired by Oracle and these days, Oracle runs the Java development effort.

Mac

  • If you have a 64-bit Intel-based Mac running Mac OS X 10.5 (Leopard), there is a version of Java SE 7 available from Apple. If you wish to upgrade, visit Apple's Java web site and download and install Java for Mac OS X 10.5, Update 1. After installing, run Applications > Utilities > Java > Java Preferences. Drag the newly installed version of Java to the top of the list under Java Application Runtime Settings. Click Save.

Disabling the Java 1.7 Plug In in your Browser

Annoyingly, the US Department of Homeland Defense chose this specific moment to announce that there is some sort of gaping security problem with version 7 (not prior versions) of Java, but that it only applies to use of Java as a web-browser plug-in (aka add-on).  We don't plan to use Java as a web-browser plug-in, but you might already have been doing so, and as a result you might already have a security problem with your browser.  If you didn't but you just upgraded to JDK 1.7, you might have just created a problem.

To deal with this, go to your browser control panel, click to the page that they use to manage plug-ins or add-ons, see if Java is listed as one of them (it might not be; not everyone is using Java this way), and if it is there, disable it.  Then restart your browser.

If you really want to leave Java enabled in your browser you have to check to see that you are using a version that doesn't have this security issue.  For that, google "java security problem in xxxxx" giving the name of your browser (Safari, Chrome, IE, etc) and see what the company that made the browser says.  If you follow their advice you may be able to leave Java enabled.

Installing Eclipse

Once you have the Java JDK installed, and have secured your web browser against terrorists, visit http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/junosr1 and follow the installation instructions you'll find there.  In principle, if you installed Java correctly, the Juno release of Eclipse will find it.  If not, you may need to create a shortcut to the version of "javaw" Eclipse should use when it needs to launch the Java system.  Our consultants can help if you get into this situation, which occurs mostly if you do things in the wrong order or if you had an old copy of Java on your machine and Eclipse became confused.

When you download and install Eclipse, as long as you select the "Java Personality" for the package, and your computer is one of the supported ones, you can also download and install the JDK and JDE all in one monster file.  We mention the personality because Eclipse can also be used to develop code in other languages like C++, and it can be used to create applications that run on the desktop (our kind), on servers (we won't do this), as new libraries, etc.  If you get confused and use the wrong personality, Eclipse will complain but nothing horrible will happen and you can usually poke around until you get to the home page, then select the personality you really wanted (Java) and then you should be in better shape.  Each of your homework assignments will be a separate Eclipse "project", but you can use the results from one assignment as a basis for the next, and in fact we'll often do so.

Compiling and Running from the Command Line

We don't make much use of this feature in CS2110, but sometimes it is useful to run a Java program without launching it from inside Eclipse.  You can easily do this; Eclipse and Java are really two different systems that "talk to each other" in a friendly way, but can also be used independently.  The notes that follow explain how you would run your Java program all by itself, if you wanted to do so.

Compiling

Say your main class is MyProgram and it is contained in the source file MyProgram.java. If it is not in a package, navigate to the folder containing MyProgram.java and type javac MyProgram.java.

If it is in a package (say myPackage), the source should be in a folder called myPackage. Navigate to the folder containing myPackage and type javac myPackage/MyProgram.java.

Running

From the same folder you compiled from, type java MyProgram <program arguments> if it is not in a package, and java myPackage.MyProgram <program arguments> if it is.

Specifying a Classpath

Sometimes you may need to inform Java where to find auxiliary classes. You can do this with the -cp option to the java command. Supply a sequence of folders telling Java where to look for classes, separated by : (Mac) or ; (Windows).

Brushing Up

For students with limited Java experience, we recommend the online notes from CS 1130 (formerly 101J), Transition to Object-oriented Programming as a refresher. This is a self-paced course consisting of several modules that you can go through at your leisure.

More Ways To Catch Up


Support Services

CS2111

In spring 2013, many incoming students won't have Java experience and many have relatively little prior  OO experience (everyone is expected to have some programming experience, and some prior exposure to OO concepts, but the level of prior experience varies widely).  To help out we've created an enrichment course that runs for 1 credit, S/U, and provides a bit of extra exposure to the same ideas we'll cover in class.  CS2111 is totally optional but could be very helpful to anyone nervous about his or her background.  It will be taught by Professor Gries, who is very familiar to many of you from CS1110.  You would normally take CS2111 in addition to CS2110 and the CS2110 recitation, so CS2111 does involve extra time -- one hour per week.  But with this extra help, even people very nervous about programming should be able to keep up with CS2110.

Piazza and Consultants

You'll be amazed at how easy it is to get help if you just post a question on our Piazza forum.  People help each other out and you can often get "unstuck" in seconds by just posting your problem or question.  Our consultants have lots of office hours you can go to, and will help too (although they never write code for you...).  And you can obviously also make appointments with Professor Birman, Professor Gries, or any of our TAs.  We're here for you!

Academic Excellence Workshops

The Academic Excellence Workshops (AEW) offer an opportunity for students to gain additional experience with course concepts in a cooperative learning environment. Research has shown that cooperative and collaborative methods promote higher grades, greater persistence, and deeper comprehension. The material presented in the workshop is at or above the level of the regular course. We do not require joining the AEW program, but do encourage students to join if they are seeking an exciting and fun way to learn. The AEW carries one S/U credit based on participation and attendance. The time commitment is two hours per week in the lab. No homework will be given. This is a wonderful opportunity for students to seek extra help on course topics in a small group setting.

Your fellow undergraduate students, who are familiar with the course material, teach the sessions with material that they prepare. The course staff provides guidance and support but do not actually teach the AEW course content or any session. A representative from the AEW program will be speaking about the program and registration procedures in lecture.

One of your TAs will be designated as the AEW liaison for CS 2110. Watch the announcements to find out who.

See the AEW webpage for further information.