Before beginning any work, do a Team...Pull in your repository.
Which computer should you use for this lab session?
- 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 Urbauer 214, 216, 218, 222 labs. You log into those with your WUSTL key and password.
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.
In CSE131 this semester, we will be using Git as our version control system.
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, as you will be in this course.
Before working on any project, you must check out your repository. The instructions for this will be later on in this writeup. The general workflow of Git, following the repository being checked out, is as follows. Don't worry if you don't understand some of the terms yet, they'll make sense as we go through this studio and the coming lab:
These steps will have to be repeated and followed for every assignment you work on throughout the duration of this course.
- Pull from the master/origin
- Do work on one/some of your files
- Commit and/or push your work back to the origin
- Repeat steps 1 through 3
Whenever you sit down to work on an assignment, you must always pull from origin/master before working. If you don't, it is possible that you'll cause a conflict.
If you have not yet installed eclipse, follow these instructions to install it on your computer.
We really think you should use your own computer. Almost all students do, and this allows them to work on their code from any place with Internet.
We recommend using the H drive, and then creating a folder there called workspace in your documents folder.
If you are a visual person, use this video and follow along to accomplish the steps below.
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.
robot.forward(100);You do not need to type in the comments (things beginning //).
- See the red box in the image above? A quick way to rerun your program is to find that green button in your eclipse window and click on that.
- Or you can repeat the instructions from before, right-clicking on the RobotController in the package explorer and choosing Run As…Java Application.
If ever a file shows up in the Unstaged Changes and you want to include it in the commit and push, then drag it to the Staged Changes window.
Unfortunately, if the push is rejected, you get a similar-looking pop-up but it wil have in tiny font somewhere that the push was rejected.
To fix that, there is this post on piazza.
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.
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.
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, lab, or extension 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.
When you are done with this lab, you must be cleared by the TA to receive credit.
- Do a Team…Pull to update your repository. You must do this or the commit/push below may fail.
- Commit and push all your work to your repository.Make certain this has worked by logging into bitbucket. There you will see the commit(s) in your news feed if it was successful. You can also check the Source page to locate and ensure your code was received.
It is your responsibility to make certain the code has been pushed. Some of your work receives credit through testing of your pushed code. You will receive no credit for such work if you failed to push. We generally reserve the right to revoke credit for any of your work that has not been pushed on-time.
- 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