Which computer should use use for this lab sesesion?
- For most of this course's assignments, you will probably want to do the work on your own computer.
There should be time at the end of this lab session for you to install the course software on your computer.
- If you don't have your computer with you, or the software is not yet installed, then please use a lab computer in this room.
Professional software developers use an Integrated Development Environment (IDE) that includes a text editor (for creating source code), a compiler (for translating source code into executable code), and a debugger (for finding errors). In this course, we'll be using eclipse, a popular IDE that supports (among many other things) programming in Java.
Professional software developers also use a versioning repository to store their code, so that they can share their code easily and keep track of the changes they make. We will be using the subversion revision control system. It will allow you to submit your code for grading and to share it with TAs who can help you with problems you might encounter.
Attention wireless users in CEC labs!!This part of the lab explains how to get started using eclipse with subversion.
You must be on a non-guest network to access your repository. If your wireless network name has the word guest in it somewhere, switch to one tha does not.
If you have not yet installed eclipse, follow these instructions to install it on your computer.
We recommend using the H drive, and then creating a folder there called workspace in your documents folder.
When you get to the point of entering the full and complete location of the repository, copy and paste the line below as the repository's URL:https://svn.seas.wustl.edu/repositories/YYYY/cse131_fl15/javaAfter pasting:
- Change YYYY to your WUSTL key, using lower case letters only. Include all punctuation that is normally part of your WUSTL key.
If you would normally type in the WUSTL key shown on the left, you need to use the version shown in blue on the right to access your repository: Examples:
- RonKCytron → ronkcytron
- ima.StudeNt → ima.student
- Queen.Mary.4 → queen.mary.4
Although only you can access your repository, you should generally keep your WUSTL key a secret.
- OK, click Finish to get the repository location validated.
- When you are prompted for a username and password, supply your
- WUSTL key username (again, all letters must be lower-case)
- WUSTL key passwordYour WUSTL key username and password are what you use to log into WebSTAC for registration. These credentials may be different than those required to log into a lab computer.
Be careful! If you provide a bad password repeatedly, your account will get locked out after a small number of such attempts. So be sure to follow these instructions carefully and ask if things are not working.
Those instructions next ask you to Check Out a copy of the repository location so you can do the work for this lab. Be sure to right click on the whole project (your name and ID number) to do the checkout. Do NOT click on things below that like labs.
Throughout the semester, this is where you should look for the files you need to complete your assignments.
Supporting software is placed in other source folders, such as labsupport. You are welcome to look at any code, but to keep the number of files managable, we'll place lab code in your labs source folder in your repository.
If what you see makes sense to you already, you may not need to take this class.For now, you don't need to understand what you see. We just want the computer to run this program.
Try typing some random text into the RobotController.java file to introduce an error. You should see an error icon appear at the left. Note that sometimes the error message appears on the line after the error. At the bottom of the window, you'll see console and problems. The console window shows any printed output of the program. If you click on problems you'll see a list of the errors, and clicking on an item in the list will take you to the location of that error in the Java file so you can correct it.
Undo your typing, or close (without saving) and re-open the file.
You now have two files open in eclipse:
- RobotController.java is the main file. You always run the application using the instructions given above for this file.
- RobotInstructions.java is the file that contains code directing the robot to move. This is the file you will modify to change the robot's behavior.
Really? We're asking you to program even though you probably don't much about Java yet?
Even after you have learned much about Java, programming, and computer science, you may come across some code that you want to modify to change its behavior. This takes some courage, but see if you can figure out what the robot's instructions do, based on observing the robot and reading the code. Make some changes to the code to test your hypotheses. Soon you will have the robot doing your bidding.
Tip: Since RobotController.java was the program most recently run, you can run it again simply by clicking the green arrow on the toolbar at the top.Each time it runs, you should see the results of your most recent modifications.
If you pause with the mouse over a location on the map, the x,y coordinate of your mouse location will be shown on the screen.
Also, feel free to walk the route yourself, and stop by the the instructor's office to say hello sometime. Visitors are usually treated to soda and candy.
To commit them, locate the name of your project (your name and ID) in the package explorer window of eclipse. Right (control) click on that, go down to Team... and select Commit. You should see activity reflective of elipse sending your modified code back to the repository.
Tip: It is good practice to commit your code often. You can always recover any previously committed version of your software. Committing your code allows you to work on the code from a different computer, and ensures that you do not lose your work should your computer fail.
You now know the basic steps to create projects, as well as open, edit, compile, and run Java programs in eclipse. You should also have a basic understanding of sequential execution and how to call methods on ojects. Please ask if you have questions about any of this.
OK so you can program a robot now to go where you want it to go. How does this fit into the rest of the course? Based on the instructor's presentation, you will next complete a simple online activity (in pairs if you like), with the goal of understanding the anatomy of a Java file.
The course will then proceed from the most simple aspects of programming in Java to the more complex parts.
- The online activity can be found here.
- Try it (in pairs if you like) until you get it completely right.
- Be prepared to identify the anatomy of a Java file when the TA checks you off.
Take some time to peruse the web site. Are you clear about course policies concerning grading and attendance?
- The green block you see below appears at the end of any studio or lab assignment for which you need a TA to clear you.
- Please type in the requested information before you flag down a TA.The information logged by this activity will result in a blackboard grade being posted for your assignment, but that grade may not show up for a week or so.
- You should have already done this, but just in case, be sure you have committed your work back to the repository as follows:
- Right click on the project (your name-ID) in the Package Explorer
- Drag down to Team....Commit....
- You can fill in some comment there — be creative.
- Click OK to cause your changes to be saved in the repository.
When you done with this lab, you must be cleared by the TA to receive credit.
- Commit all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so
This demo box is for lab 0