Upload
jeanne-boyarsky
View
648
Download
1
Embed Size (px)
Citation preview
FTC: Moving from Robot-C to Java
5/2/15Jeanne Boyarsky
Programming Mentor FRC Team 694
slideshare.net/boyarskyTwitter @jeanneboyarsky
Blog: http://www.selikoff.netModerator on Java forums at:
http://www.coderanch.com
Pause for CommercialMy first book:
Choices for CodingStep Tool Type of
programmingComments
Crawl Point to Point (download two existing apps)
Configuration Rookie teams?Prototyping?
Walk MIT App Inventor
Blocks Like Scratch
Run Android Studio Text (most like Robot-C)
Real programmers use
http://appinventor.mit.edu/explorehttps://developer.android.com/sdk/index.html
Java – the lay of the land
Non-Android Java program stops here
Major parts
JDK (Java Development Kit)
IDE (integrated development environment)
Editor Emulator
javac
JRE (java runtime environment)
APIs (libraries)
Git (version control)
javaGradle (build)
Note: Github.com offers free hosting
Installing Android Studio
Pre-reqs:
Java JDK 8 (or 7 if already have it)
Lots of RAM (2-4 GB)
Any Operating System
http://www.oracle.com/technetwork/java/javase/downloads/index.html
https://developer.android.com/sdk/index.html
The official IDE for Android!
SetupPre-reqs:
Time
Internet
Admin rights
Wizard guides you through setup/downloads runtime
Create Android project (even to play with Java)
Create Java library
Finish up
First class
Run it
Run > Run FTC
C/C++ vs Java - differences
For C/C++ Java
Constants Header file Interfaces or static/final fields
Referencing other code
#include import
Primitives bool, int, short, etc boolean, short, int, long, float, double
Strings char[] or string String
These are not logical equivalents. Just in similar spaces.
Same in Java
LotsArrays
If statements
Math
Calling a method (mostly)
Comments
Big differences in Java
Garbage collection!
no malloc/free – unless calling C/C++
No pre-processor directives
No pointers
No operator overloading
Platform independent
Android Studio - ViewsDefault – Android view
Project view – shows file system
Android Studio – AutocompleteControl + space
Reading: Parts of a class
Imports
Superclass Interface
Reading: C-like enough, right?
Instancevariable
Package (like a folder for grouping)Top level Class
Nested class
Comment
Constant
Reading: Complex Android Class
Java Version Q&A
Why doesn't Java know how to count? The versions go 1.1, 1.2, 1.3, 1.4, 5, 6, 7, 8
Blame marketing!
What books are good for learning Java?Head First Java
Thinking in Java (older versions free)
Java for Dummies
Deitel & Deitel
Core Java
Questions
About Java:
– Friendly forums for those new (or not new) to Java:
http://www.coderanch.comFor FTC specific questions:
– http://www.chiefdelphi.com
– http://ftcforum.usfirst.org/forum.php
– https://www.reddit.com/r/FTC/
– Where else?
References
Android Studio: https://developer.android.com/sdk/index.htm
FTC Schematic: http://modernroboticsinc.com/Content/Images/uploaded/Schematicx1000.jpg
FTC Kit: http://modernroboticsinc.com/first-ftc
FTC Controller: http://first.intelitek.com