Log in

View Full Version : How to: Teach java?


AndyB871
27-04-2015, 18:40
Ive been poking around the boards for a while trying to figure out where to place this post. I noticed there was a curriculum board, but was worried it didn't get enough attention so in the end I decided on here;

Anyway,

I'm at a bit of a dillemma this year. I'm the head coach and software mentor for my team 871, and my team has vehemently requested to switch languages. Traditionally we used labview because of our very very high student turnover rate :( and over the years I've developed a whole set of lessons and a plan I work through each year with the kids.

Well, now they want to try out Java.

I personally think it's great my students are ready to take the next step, and I myself am very experienced with Java. My problem is that I don't really know where to start with my lessons. I wanted to take a broader approach and teach about more general Software Engineering principles before I dove into Java and OOP. I felt like having that base knowledge of design concepts would help them more quickly grasp Java and what it's capable of.

I've been browsing the internet and reading whitepaper on learning and teaching, how to teach programming, etc. etc. but I still haven't found a decent place to start. That being said, do any of you mentors out there have some advice on where I should start? Do you have a learning plan that you work through? How do you handle students with radically disparate capablities?

Any help would be appreciated.
Thanks so much,

-Andy
Team 871

mail929
27-04-2015, 19:04
Team 111 uses the MIT OpenCourseWare for Java (http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-092-introduction-to-programming-in-java-january-iap-2010/). We find it pretty effective and well paced to teach incoming software students. We have a meeting every week before build season where lessons are taught and then an assignment is usually given to be turned in the next week. If you want to look at something more robot specific we open source our code (https://github.com/wildstang111) every year sometime after champs as well as some other teams like 254.

Good Luck!

AndyB871
27-04-2015, 19:13
I've looked through your source before, along with some others, to get a feel for the WPI libraries and it's been very helpful, but that's all because I _already_ have the basis of understanding. Teaching is hard (as I've learned since I took over this team)!

I'm facepalming a bit that I didn't think to check out the MIT stuff. Thanks for the pointer!

mail929
27-04-2015, 19:25
No problem. If you have any questions at all feel free to contact the team.

Spoam
27-04-2015, 19:49
If you want something simpler for new students our 2014 robot code (https://github.com/FRC-Team-955/AerialAssist/tree/master/RobotCode/src/Core) is very minimalist (no feedback loops or fancy objects) while still containing most of what you'd find in typical FRC code.

We typically have a generic skid-steer drivebase on hand for new programmers to work with after giving them a crash course on the control system and introducing them to C syntax and OOP (we start out by teaching them about variables, loops, scope etc. then give them challenges they must complete on their own like sorting an arbitrary array). When they're competent at programming we teach them WPI lib, and when they can make a simple robot run we have them start deriving drivebase kinematics and learning control loops on their own with a little bit of guidance and oversight. We also have 0 programming mentors on our team, so this is all done by student captains.

Our robot code this year was written entirely by sophomores on the team who were completely new to programming last year and has had PID-corrected strafe, field centric and robot centric holonomic drive code (from when our robot had slide drjve lol), a position and velocity PI controller for our elevator and more all designed by them.

AndyB871
27-04-2015, 20:04
@Spoam, that's more or less what I've done with LabView for the students. Do you have a set of challenges that you cycle through or are they typically new each year? Some examples?

This feedback is great BTW, thanks so much! I won't feel so underprepared this Thursday's session!

GeeTwo
27-04-2015, 20:21
Team 3946 has some java lessons and tutorials (http://slidell-robotics.com/index.php?page=javaresources) written by Gixxy (http://www.chiefdelphi.com/forums/member.php?u=58426), our founder. We also use Java for Dummies (http://www.dummies.com/store/product/Java-For-Dummies-6th-Edition.productCd-1118407806.html), and of course, the screenstepslive wpilib (http://wpilib.screenstepslive.com/s/4485) getting started and java tutorials.

Spoam
27-04-2015, 20:24
@Spoam, that's more or less what I've done with LabView for the students. Do you have a set of challenges that you cycle through or are they typically new each year? Some examples?

This feedback is great BTW, thanks so much! I won't feel so underprepared this Thursday's session!

Sorting an array is one of our favorites because it's simple, but can be challenging because it requires someone to truly think like a programmer and translate a problem that's trivial for humans into something a computer can execute.

In a similar vein, we used a lot of (the simpler) project euler (https://projecteuler.net/) problems to get them into critical thinking and problem solving with code.

Along the way there would also be small challenges relevant to what we just taught them (like classes, file access, functions etc). Eventually we just tell them "write code so that this drivebase can move in all directions from joystick input" or "research x and y and implement it". If they get stuck, we give them guidance. Captains are always present for troubleshooting and tuning and review code before putting it on the robot (both to verify it will work, and to make sure it meets our standards).

Fusion_Clint
27-04-2015, 21:14
Try this, FTC is going to JAVA next year and FIRST hired Intelitek to design a curriculum for the change. It is supposed to have 4-5 hours on the MIT app and another 5-7 hours on straight JAVA. Won't be available until September.

http://www.intelitek.com/pdf/FTC_Brochure_Final.pdf

gblake
28-04-2015, 02:15
This one is OK, but it doesn't contain anything about FIRST Robots.
Oracle's Tutorial (https://docs.oracle.com/javase/tutorial/)

David Lame
28-04-2015, 06:52
If you are dealing with students who have absolutely no conventional programming experience, my advice on teaching Java is to download Visual Studio Express, and teach them C# for a few weeks. The languages are practically identical at the beginning level.

The advantage of Visual Studio/C# over Eclipse/Java is that the development environment is much easier to deal with. It's easy to set up Eclipse wrong and end up with something that doesn't work at all, with the problem being some obscure checkbox behind the scenes that no one would know to look for. Also, Intellisense on C# works better than its equivalent in Java. Finally, the easiest programs to work with for object oriented programming concepts are ones with a user interface, and Windows Forms programs are very, very, easy to write. Once they get variables, functions, classes and objects down, it will be fairly easy to transition over to Java and the FRC environment. Sure, they'll have to start typing String instead of string, but that's an easy transition.

Of course, I'm a Microsoft partisan myself. Programmers are notoriously religious about their favorite tools and languages, so a lot of people will think this is absolutely terrible advice. However, in the little bit of teaching I have done to absolute beginners, I've just found C# easier to deal with.

levydev
28-04-2015, 06:57
1) Get familiar with java basics - syntax, variables defs , arrays, control loops. Run simple examples from the command line using a single Class with a main method.

2) Get a taste of Object Oriented Programming with Java. I think just a small introduction to understand Classes, Class instances, methods. Go back to the exercises in #1 and try to spread you code across multiple Classes ( One class definition per .java file should be sufficient)

After you've completed the above steps, you should have enough Java under your belt and may be ready to move on beyond the command line.

For FRC Teams this may be the next step.

https://wpilib.screenstepslive.com/s/4485/m/13809

Aero
28-04-2015, 08:46
The languages are practically identical at the beginning level.

If you teach them one language for a few weeks than switch over, the differences are just going to confuse them more.

If you're teaching them Java, teach it from the beginning.
If Eclipse being complicated is a worry, I'd recommend IntelliJ IDEA as an IDE - they'll be happy to give your FRC team a free copy of the Ultimate edition if you email them.

For people with absolutely no programming experience, it's going to be hard to teach them pure Java and expect them to pick up on WPIlib easily. You can teach WPIlib from the start, but don't expect them to grasp the language's syntax quickly.
I taught a group of rookies Python over a few months. What I found worked best was getting them through basic syntax, then giving them challenges that required independent research to solve. I find teaching programming works better the more self-directed you can make your class.

levydev
28-04-2015, 12:22
Here is an interesting online tutorial that lets you write and execute basic code in the browser: http://www.tutorialspoint.com/java/index.htm. As you read through you'll see some sample code and a "try it" button. While in "try it" mode , you are able to change the code.

This may be a good way for someone to get started without being overwhelmed by the JDK and IDE installation. Although that would eventually be needed.

mathking
28-04-2015, 12:32
For an introduction to Java that kids can really dive into, try Robocode (http://robocode.sourceforge.net/). I use it to introduce kids who don't have any programming experience to the basics of Java in the summer before they start my AP Comp Sci class. I am also happy to share some other lesson ideas if you would like. Send me a message.

JesseK
28-04-2015, 12:37
For learning the basics of brand new languages, two generalist websites come to mind:
http://exercism.io/
http://www.codecademy.com/learn

From there I would browse existing successful teams' public code repositories on GitHub. It's like CAD - you don't know what you need to know until you see an example of it.

gblake
28-04-2015, 12:59
A few folks have mentioned Eclipse.

To complement Eclipse, I'll mention NetBeans. It is tightly affiliated with Oracle and the rest of the Java community. It was easy for me to learn as a Java beginner. It has some fancy features that I might get around to using some day, but until I want to use them, they don't get in my way.

Eclipse on the other hand, never makes me happy. Probably because I have invested less time into using it than I have invested into NetBeans. However, there might be a fundamental difference in ease of use. Tools that emerge from the Unix/Linux community often assume users have a tremendous depth and breadth of knowledge, and/or expect you to understand instinctively subjects like the convoluted, terse syntax used writing a regular expression.

If I had a nickel for every time a *nix tool or help file used a word or phrase for which I had no definition or antecedent, I would have a lot of nickels....

About Visual Studio and C#... I have to agree that switching from Java (+NetBeans) to C# for one project was just about as easy as falling off a log; but my prejudices against Microsoft's attempts at global hegemony (and my curmudgeonly belief that C# was created and promoted for business reasons, not for technical reasons) caused me to switch back to using Java as soon as that one project was over.

Blake
PS: If writing FRC robot code is made easy by some plug-in or other tool integrated into Eclipse, but not into NetBeans, that makes the choice pretty easy.

AndyB871
28-04-2015, 14:18
@mathking robocode looks pretty neat, I think im going to combine a bunch of ideas here. I'm going to start with the MIT course first, using a couple of individual challenges along the way. Once they get comfortable with that I think we'll take a look at robocode and then finally WPIlib.

As for the IDE sub-conversation, I used to be a VS buff myself, but at work we develop software for small embedded platforms, hence no microsoft support. Short of using a text editor *blegh* I gave eclipse a try and i've come to love it, in all it's obfuscated glory.

Since I'm familiar with it, and since we're going to be stuck with it (essentially) for FRC I'm going to take the trial by fire route with eclipse and just commit to it. As issues crop up I'll show them how to navigate through the piles and piles of configuration options.

Thanks guys, this has been really helpful

gblake
28-04-2015, 14:29
...
As for the IDE sub-conversation, I used to be a VS buff myself, but at work we develop software for small embedded platforms, hence no microsoft support. Short of using a text editor *blegh* I gave eclipse a try and i've come to love it, in all it's obfuscated glory.

Since I'm familiar with it, and since we're going to be stuck with it (essentially) for FRC I'm going to take the trial by fire route with eclipse and just commit to it. As issues crop up I'll show them how to navigate through the piles and piles of configuration options.
...I understand. Eclipse comes with both blessings and curses.

Folks tell me that the Notepad++, sup'ed up text editor is not *blegh*. Ima gonna try it someday soon, but I haven't yet. It might be a nice lightweight intro that leads a student toward Eclipse or other IDEs, without quite so many fires or trials on day one. It's probably worth a quick peek.

Jalerre
28-04-2015, 16:34
This (http://chortle.ccsu.edu/cs151/cs151java.html) is a great resource for teaching Java. It breaks it down to the very basics and gives lots of examples. My suggestion would be to pick and choose the lessons that are the most applicable to FRC. And don't forget to utilize the resources that FIRST provides.

David Lame
28-04-2015, 18:50
If you teach them one language for a few weeks than switch over, the differences are just going to confuse them more.

If you're teaching them Java, teach it from the beginning.
If Eclipse being complicated is a worry, I'd recommend IntelliJ IDEA as an IDE - they'll be happy to give your FRC team a free copy of the Ultimate edition if you email them.

For people with absolutely no programming experience, it's going to be hard to teach them pure Java and expect them to pick up on WPIlib easily. You can teach WPIlib from the start, but don't expect them to grasp the language's syntax quickly.
I taught a group of rookies Python over a few months. What I found worked best was getting them through basic syntax, then giving them challenges that required independent research to solve. I find teaching programming works better the more self-directed you can make your class.

Using an easier java environment makes sense. I've only used Netbeans and Eclipse. Both of them aren't very beginner friendly.

Katie_UPS
28-04-2015, 19:13
You're receiving a lot of awesome resources. I TA a freshman level intro to C course, and this is a rough outline of what we use (I wrote this up a while ago for my own purposes, so some function calls are C specific)(we also teach pointers but I removed that section):

Using IDE / Hello World -- how to navigate in IDE/run a program/write hello world
write skeleton code - what is “#include”, what is main, printf()
run code once,twice,many times (same thing happens)
understanding basic debug messages

Varaiables / Printing Basic Variables
what are variables?
how do I make a variable?
how do I print a variable?

Modifying Variables / Scanf()
printing/changing/printing variable
using scanf to set the value of a variable

If() statements
What is an if statement
How does it work
if(1) if (0)
if(x = 1) vs if (x==1)
different operators (&&, ||, !=, !)
examples
using one operator
using multiple operators

Functions
how do functions work
how does return work
the anatomy of a function (type name(parameters))
how does a function and main() talk

Loops - for(;;)
What is a loop
The anatomy of for(;;)
examples (use var tables to show behind the scenes)
counting up by 1
counting down by 1
counting up by 2
counting up by power 2*2*2*2…
counting down by devision
printing fractions

Loops - while()
What is a while loop
Anatomy of a while loop
use while loop to count
use var table
use while loop to wait for a specific input (ie guessing game)

Arrays - 1D
What is an array?
visualizing an array
anatomy of an array
using an array
accessing an element
filling it with a for loop
accessing every element with a for loop

Arrays and Functions
Passing an array
modifying an array in a function

If for some reason, you really want to write your own curriculum, that has been a tried and true path for teaching complete newbies.

mathking
28-04-2015, 22:45
I have used a pretty wide variety of IDEs, plus command line compiling, in teaching computer science. I settled on Eclipse as the one that produces the best results for my students. There was a while when I considered switching to Net Beans because of FRC robot programming, but I decided to stick with Eclipse because overall I have found it to have the best balance of learning curve and power. I guess I am saying don't feel too bad about sticking with Eclipse.

lagringa841
28-04-2015, 23:04
Hello!
I highly recommend Pogo! He starts teaching Java from Elite. He's great at explaining and he starts from the beginning. My teams head programmer recommended him to many members of our team including me and I've learned so much! Best of luck!! :D
https://www.youtube.com/user/PogoStick29Dev

WillNess
30-04-2015, 13:36
FTC is going to JAVA next year

Is it going to be very similar to FRC Java?

levydev
30-04-2015, 13:40
No. FTC teams are going to be deploying Android applications. There will be n Scratch like visual programming alternative called MIT App Inventor. However for those choosing to code in Java , they will be using the Android Studio IDE.

RobOTies
30-04-2015, 16:20
I tried teaching Java for FRC for the first time this year with the help of our mentors. We created a series of activities that are on the class website (https://sites.google.com/a/rsu34.k12.me.us/oths-robotics/home?pli=1).

We started with the Blockly Activities and then the BlueJ activities. By the end of those activities, students were familiar with the basics of Java programming that are most relevant to using with FRC robots. Then they are using "EasyJ" as a scaffold to building the code, and then they copy and paste it into the simple iterative robot template in Eclipse. From there they can modify the code as needed. Note - "EasyJ" was created last year, so be careful with the port numbers since they start at 1 instead of 0.

The activities need some tweaking for next year, but so far I've been impressed at how students have been able to work together to program our Aerial Assist robot from last year with little help from me. Feel free to use any activities and I welcome feedback to make them better!

JCharlton
30-04-2015, 17:03
I'm surprised no one has mentioned Processing.

It's a simple all-in-one that you can use to teach basic programming concepts, while using Java syntax.

I'll admit it might not be the best path to understand FRC robot-objects, but will help new programmers get familiar with basic concepts up to Object properties and methods.

After that then get them started programming in the FRC framework with a "real" IDE.

Techwiz
30-04-2015, 18:29
I'd like to share a tool I've been working on to make WPILibJ programming easier. I'm calling it EasyJ. Its a block environment where each block roughly correlates 1 to 1 with a line of code.

Currently it supports Iterative Robot style programming, but we are working on Command Based.

I'm working with a teacher at Old Town High School and after teaching some Java basics her classe used EasyJ to start programming the robot.

http://easyj.team5122.com/

Hope that helps,
Blake

pafwl
28-12-2015, 15:11
You can access sample code and a presentation from our Comcast FIRST Bootcamp. I presented a section on JAVA/C++. I has a review of Java basics and it presents a method to build your robot code on. This method makes the process very logical, flexible and creating multiple autonomous programs very, very easy.

http://www.frc272.com/files/seminar/Archive/

Good luck... have fun...

Email me directly at pafwl@aol.com.

PS - There is a presentation on using Sensors included and examples in the code.

gblake
28-12-2015, 23:49
This thought just popped into my head.

Depending on how you organize your code, you probably can almost entirely avoid using Java's OO features, and can simply use it to write the same sort of main (probably multi-threaded) routine, plus data and subroutines, that you would write using Fortran or C.

I'm not advocating doing that, I'm just pointing out that it is a legitimate option that might simplify producing a robot for first-time Java users.

rich2202
01-01-2016, 11:15
Here is another free course on Java programming:

https://www.edx.org/course/introduction-programming-java-part-1-uc3mx-it-1-1x-0

DuPiMan
01-01-2016, 16:05
Another possibility is: https://www.codecademy.com/learn
Codecadamy generally does an excellent job teaching programming languages. They just released a Java course, which I have not personally tried yet, but I trust it will be good. Codecadamy also has an excellent Python course (which I used when I was first learning the language). Python is a much simpler way to get an introduction basic programming concepts, it makes a good first language. After having the students learn how variables, data types, functions, loops etc. work in Python, it will be easier for them to pick up Java and OO concepts.

gblake
01-01-2016, 23:21
... After having the students learn how variables, data types, functions, loops etc. work in Python, it will be easier for them to pick up Java and OO concepts.I'm confused. Why is it easier to learn those concepts by writing Python, than by writing Java? I don't remember any important differences in those basics other than Python's loose typing introducing more opportunities for rookies to be sloppy. What am I forgetting? It's been a while since I used Python.