Assignment : Welcome to CSE131!

Objective

The goals of this assignment are to prepare for the rest of the course! The major parts are:

  1. Install software we’ll be using for the class.
  2. Create an account on GitHub, which is a cloud service we will use to distribute and collect your work. (If you already have an account, you will need to add your WUSTL email to it if it isn’t already there.)
  3. “Accept” the materials needed for this assignment.
  4. Add the assignment to Eclipse.
  5. Using Eclipse, which you installed in the first step, on the assignment, which you got in the third and fourth steps.
  6. Practice “pushing” your work, which both makes a backup copy and is used to “turn in” work.
  7. “Accept” a repository for “Exercises” and add it to Eclipse.
  8. Review course details
  9. “Demo” your work to a TA. This is how we will record credit for most class sessions, so be sure you do it before leaving each class.
    1. Show the TA your work
    2. Confirm that your final work is on GitHub
    3. Confirm that your score is recorded in Canvas

1. Installing Software

We will be using a language called Java to create and run code on our computers. Before you can execute Java code, you need to install two pieces of software:

  1. The Java Development Kit (JDK). The JDK includes a whole bunch of Java tools that are used to assist in the creation and execution of Java programs. Visit the link above to download the JDK and install it on your computer.
  2. Professional software developers use an Integrated Development Environment (IDE). As the name describes, it’s used to develop computer programs and it integrates several different useful features:
    • It includes a smart editor that helps you create and work with computer code.
    • Is can work with other programs called compilers. Compilers translate the program you write into something the computer can run. The JDK that you installed included a compiler.
    • Other handy features, like support for debugging assistance

    We’ll be using Eclipse, a popular IDE that supports programming in Java.

You should now install: 1. The Java Development Kit (JDK) (first) and 2. Eclipse. Here’s a video you can follow-along with to install both: JDK & Eclipse Install

2. Create a GitHub Account

We will be using software called Git for “version control”. Version control systems (VCS) are great for when you want to record who did what for which file or set of files, and it is especially useful when multiple people collaborate on projects. Here’s a video explaining the concept:

We’ll use the site GitHub to distribute and collect course work. GitHub is a place that hosts git repositories. You’ll need to create a (free) account. Please visit GitHub and sign up for an account. Please use your WUSTL email address, although you can add multiple e-mail addresses. If you already have an account, please be sure to add your WUSTL email. These directions describe how to add additional email addresses.

3. Accepting a new assignment

For each major type of course work you will need to generate a repository on GitHub. You’ll do so by clicking on a link and “accepting” an assignment. Click HERE to accept Lab 0 and follow along with the instructions below.

  1. Carefully scroll through the list of names and select only your name!
    Select Name
    • You only need to do this one time this semester. After doing so, your GitHub account is associated with your name (for this course).
  2. Select the button to accept the assignment:
    Accept Assignment
  3. After accepting the assignment, a copy of the assignment materials, called a repository, will be made for you. Click on the link to view the repository:
    View Repository
  4. Finally, 1) click on Clone or Download and then 2) click the “Copy to Clipboard” button to make a copy of the URI shown.
    View Repository

You’ve now created an assignment repository and have the URI. You’ll need to do steps 2-4 many times this semester.

4. Add the assignment to Eclipse

  1. Open or go to Eclipse.
  2. Go to the File menu and select Import
    View Repository
  3. Expand the Git options and select Projects from Git
    View Repository
  4. Select Clone URI and then hit Next
    Clone URI
  5. The URI you copied when you created the assignment should automatically be used (if not, go back to GitHub, copy the full URI for cloning the repository, and paste it in here). Hit Next
    Select URI and Location
  6. Enter your GitHub username and password. (You can select Store in Secure Store if you don’t want to re-enter your password every time you accept an assignment). Select Log in when ready
    Select URI and Location
  7. The URI you copied when you created the assignment should automatically be used (if not, go back to GitHub, copy the full URI for cloning the repository, and paste it in here). Hit Next
    Select URI and Location
  8. Select Next on the Branch Selection window.
    Select Branch
  9. Select Next on the Local Destination window.
    Select Destination
  10. Select Import existing Eclipse Project and select Next on the Project Wizard.
    Select Eclipse Project
  11. Select Finish.
    Select Eclipse Project

5. Using Eclipse on the Assignment

Your project should now be open in Eclipse. You should have a pane called the Package Explore on the screen (if not, go to the Window menu, select Show View and pick Package Explorer).

  1. Expand the lab-0 folder.
  2. Expand the src folder.
  3. Expand the lab0 folder and double click on the RobotInstructions.java file. It should look something like this:
    Package Explorer

  4. Run the other file, the RobotController.java, by right-clicking on it, selecting Run As, and then selecting Java Application, like:
    Run Controller
  5. A new window should now open. Click on the Go button and you’ll see a simulated robot draw on the screen. It’s merely following the instructions that are being given in the RobotInstructions.java that you opened.
  6. Close the robot simulation window (not Eclipse).
  7. Review the contents of RobotInstructions.java, which should be shown in Eclipse. Make some changes:
    1. Change the robot.forward(60); to robot.forward(120);. What do you think the robot will do differently?
    2. Run the robot simulator again. Now that you’ve configured Eclipse to run it, you can just select the Play button on the menu:
      Re Run Controller
    3. Did the robot do what you expected?
    4. What if you removed the line that now says robot.forward(120); and replaced it with two lines that each say robot.forward(60);? Before making any change be sure to close the simulator. Then make your changes and hit the Play button to see their impact.
    5. Try removing a semi-colon (;). Eclipse should add red indicators in several places indicating there are errors with the file. These are helpful cues that you should pay attention to in larger programs. The circles in this picture show all the special indicators, which help programmers find the exact locations of this type of problem:
      Error Indicators
    6. Try running the program with errors. Eclipse should show a window warning you. Do not hit the Proceed button.
    7. Put the semi-colon back in and correct the errors.
    8. Add a new, empty line after a robot.forward line. Type robot then .. Notice that when you hit the . a window appears with a list of options. Eclipse is letting you know the choice available to you here. This is one benefit of using an IDE like Eclipse.
    9. Experiment with changing / adding other commands.

Working With Code

Now that you understand how to use Eclipse to modify and run the program, spend some time making the robot draw a picture of a house. Be sure to stop at least 20 minutes before the end of the session, even if you aren’t completely done! You can come back and work on it more after class if you’d like.

6. “Pushing” your work

You should frequently “commit and push” work, which saves work to the cloud. This process is also used to allow us to see your final work. Be sure you back up your work like this regularly. (Often the backups are vital if someones loses their work due to a computer problem. They can just restore the saved copy to a new computer)

Since you should be regularly “saving” work to GitHub, we never accept the excuse “X happened to my computer and I lost my work”!!

  1. Right-click on the Project Folder, Select Team and then select Commit:
    Commit
  2. The commit tab will open (you may want to stretch out the pane to see all of it). The Staged Changes pane lists the files that have changed and will be committed (i.e., saved). Normally it will already include any files you’ve been working on, but if not, be sure to drag them down from the Unstaged pane.
    Staged Changes
  3. Commits need a message describing what is being saved or why. Often this is a description of either what you’re working on or what still needs to be done. Always try to pick something brief, but meaningful. Enter a message and then click on Commit and Push.. (you may now be prompted for your GitHub password). (Do NOT pick just the Commit button. That will save a copy on your computer, but not on GitHub. You risk not having a back-up copy of your work and not getting credit on assignments!)
    Staged Changes

After doing Commit and Push always check your work on GitHub. Go to GitHub.com, select the respository for the assignment, and then review the individual files.

7. Accept an Exercise Repository

We’ll use a separate repository for Exercises, which you should complete as you watch the course videos. Go through the steps given above to: 1) Accept the repository via this Link and 2) Add it to Eclipse.

Many things called “Assignment”, “Studio”, or “Extension Batch” will require new repositories, but this single repository includes all the things required for all “Exercises” this semester.

8. Course Information

Review the course site on Canvas. Make sure you review:

  1. Course Policies
  2. Know where to go to find Office Hours, which will be posted by the second week of class.
  3. Know how to browse the content and prepare for modules.
  4. Be sure you’re signed up for the course’s Piazza forum.

9. “Demo” your work to a TA!

Sign up to have a TA demo your work (the sign-up processed will be described in class).

To submit your work, contact the instructor or a TA. They will walk you through the submission process. Be prepared to show them the work that you have done and answer their questions about it!

  1. Show the TA your work
  2. Show them your final work on GitHub.
  3. Ask any questions you have about the course.
  4. After the
  5. Confirm that your score is recorded in Canvas. Mistakes can happen and you should always confirm credit is recorded before leaving class!