Back to Primitive Types

Lesson PreviewLesson 6 of 7 in this unit

1.6 EXTRA: Unit 1 Programming Conventions

Part of Primitive Types in AP® Computer Science A. Read the opening section, then create a free account for the full interactive lesson, practice, and progress tracking.

Unit 1 Programming Conventions

There are certain well-understood but unspoken rules in programming. You may have seen previous code examples follow these rules listed below. While adopting these practices may not make your AP exam answer more correct, it may help your answer come across as more professional to the grader and may even result in you getting more points; this advice can also help when working on collaborative programming projects outside of this course.

Firstly, name your variables using camel case. This means that you should capitalize the first letter of each word in the variable name, except for the first word.

java
int correctWayToNameVariable = 0; //this is the correct way to write camel case.
int DontCapitalizeFirstLetter = 0; //this is incorrect, do not capitalize the first letter.
int  incorrectwaytonamevariable = 0; // This is incorrect, do not leave everything in lowercase.

Continue the full lesson in Stellar

Create a free account to unlock the remaining sections, checkpoints, course practice, and progress tracking for AP® Computer Science A.