Section 1.3 Transitioning from AP CSP to AP CSA
If you have taken the AP CSP (Computer Science Principles) course and exam you should be well prepared for AP CSA. However, there are likely to be a few new things to get used to. If your CSP class used a block coding language like App Inventor, Scratch, Snap!, or App Lab, you learned to create program structures by plugging together blocks. In Java youโll find the structures are similar but youโll have to get used to expressing them in text.
On the other hand, if youโve previously used a different text-based language, such as Python or Javascript, while you will be used to the idea of writing programs in text youโll have to get used to some specific details of Javaโs syntax.
Here are some tips to keep in mind when you are writing Java code, especially if your prior programming experience was with a block language:
-
You must spell things correctly, or at least consistently. Unlike in a block programming language where you know you are using the right block because you dragged it from a palette, in Java names are what connect different parts of your program and they need to be spelled consistently.
-
You must pay attention to case: names that differ only in caseโone starting with a lower-case letter and the other with an upper-case letter, for instanceโare still different.
-
Punctuation is important. In particular, most statements in Java need to end with a semicolon (
;
). Leave a required semicolon out and your program wonโt run. Thatโs different than this paragraph which you can still read even though we forgot the period at the end of this sentence -
Java is in the family of programming languages that use curly braces (
{}
) to group together statements. The curly brace notation may be familiar to you from the AP CSP pseudocode which uses them in a similar way. -
You should match the indentation of your code to the structure created by your curly braces.
Here are some comparisons between some App Inventor blocks, AP CSP pseudocode, and Java code used in AP CSA.
You have attempted of activities on this page.