Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Docs/1_General/1.1_Java.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@

The majority of our robot code is made in Java, and at least basic familiarity with the language is necessary to contribute to robot code.
APCSA, FTC, or the following resources are all great starting points to learn java, and you should be able to pick up a lot of it by working with the robot code.
If you already know another language you might be able to skip this step, but familiarizing yourself with the language is always valuable.
Feel free to look at the resources below, but none of them are required.

### Resources

These resources are good if you are totally new to programming, and cover Java from the very basics.
However, we'd like you to keep in mind that
> This isn’t a Java class. What we want is recognition so you can get into the code and **have some idea of what’s going on**. Don’t spend enough time on the book to be comfortable, just familiar.

- [Code Academy](https://www.codecademy.com/learn/learn-java) - online course
Don't feel like you need to be "fluent" before moving on to Stage 2 articles - a "working proficiency" is fine.

- [Codecademy](https://www.codecademy.com/learn/learn-java) - online course
- [Head First Java](https://www.rcsdk12.org/cms/lib/NY01001156/Centricity/Domain/4951/Head_First_Java_Second_Edition.pdf) - book

**Don't read the entire book!** Here are the chapters that contain the knowledge you really need to know:
- 1-4
- 5-6. You don't need to go through the motions of building the dotcom game, but make sure you know how it works
- 7-8
- 10 (ignore the date/calendar stuff at the end)
- 11 (skip the music player project, but read the parts about handling exceptions)

This book is best for conceptual knowledge, but you should be doing practice problems **while** you are reading through it.
You don't need to finish the book before starting on practice problems.
The codecademy (+ eventually on the robot) exercises are how you learn to actually apply these skills.

If you already have programming experience, but no Java experience, this might be useful:

- [Java for Python Programmers](https://runestone.academy/ns/books/published/java4python/index.html)

Lambdas and functional programming are important concepts to WPILibs Command Based system, which you will learn about in the next few articles.
Feel free to read this article now or wait until you get some of the context about what Command-Based programming is and how we use it.
Lambdas and functional programming are important concepts to WPILib's Command Based system, which you will learn about in the next few articles.
Feel free to read this article now, or wait until you get some of the context about what Command-Based programming is and how we use it.

- [WPILib docs - Functions as Data](https://docs.wpilib.org/en/stable/docs/software/basic-programming/functions-as-data.html)

Expand All @@ -31,10 +44,5 @@ The exercises below are a starting point (and required) to learn Java, but you a
- Write a program to compute the first 64 fibbonaci numbers and print them to the standard output.
This program must complete in under 1 second.
Feel free to use [this website](https://www.programiz.com/java-programming/online-compiler/) to write and run the code, or run it on your own machine.
- Complete 2 easy problems, or 1 medium problem on [leetcode](https://leetcode.com/problemset/all/) in java if you need more practice.

### Notes

- We use an auto-formatter to keep the code clean.
To run it type `./gradlew spotlessApply` into the terminal when in a WPILib project.
This should be done before you push code (if not more frequently!) to keep the codebase readable.
**Show a lead or mentor once you're done.**
- (optional) Complete 2 easy problems, or 1 medium problem on [leetcode](https://leetcode.com/problemset/all/) in java if you need more practice.