APCS vs FRC

In FRC Programming, you'll use several things you've learned from AP Computer Science, such as Object-Oriented Programming. But this page is titled "APCS vs FRC" for a reason- there are fundamental differences that make this page relevant. Here are a couple of points I'd like to mention:

Comments

Like in AP Computer Science, comments are very important. Unlike AP Computer Science A, you'll be working with other programmers. Try to make them at major/confusing parts of your code. And if you're commenting under a method header, make sure to describe what each parameter is for.

APCS teaches you two types of comments— single-line and multiline comments.

// this is a single-line comment

/*  
    this is a
    multiline comment
*/

Generally, both types of comments work fine. However, if you're writing a comment at the header of a class/method, you should use multiline comments. This is because VSC has a special feature that shows a little tooltip every time you hover/select over a method/class with a multiline comment above it. (you also have to add an extra asterisk)

Encapsulation

In FRC programming, we tend not to care too much about Encapsulation. It is a good coding practice, but there isn't any data you'll need to hide in your code.

GetInstance()

In APCS, you are taught that when you want to create an object, you use a constructor. This works fine for everything, except for Subsystems.

Subsystems can potentially be very beefy— as in some of them potentially having literal thousands of lines of code. Creating multiple Instances (objects) of a subsystem isn't a good idea, especially as non-static variables will not sync between other instances. If you're thinking about making every variable static, that's both an eyesore to the compiler and everyone else.

You might be wondering how we'd use subsystems with OOP then. What if we use a single object instead of creating thousands of them? But how would we give this singular instance to the user? All you need to do is a GetInstance() method!

Last updated