Changes between Version 1 and Version 2 of Software/WhyJava
- Timestamp:
- Sep 5, 2017, 7:28:26 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Software/WhyJava
v1 v2 3 3 FRC supports many different programming languages, but Team 2537 uses [https://en.wikipedia.org/wiki/Java_(programming_language) Java]. Java is the primary language taught by most high schools and colleges because the [http://media.collegeboard.com/digitalServices/pdf/ap/ap-course-overviews/ap-computer-science-a-course-overview.pdf AP Computer Science exam] requires Java. Although it is not an ideal language for robotics, using Java allows participation in robotics to help reinforce material learned through the school curriculum. Java is also among the [https://spectrum.ieee.org/computing/software/the-2017-top-programming-languages most popular programming languages] so it is well worth learning. Java is part of the family of programming languages that includes C, C++, and C# which collectively have dominated computer programming for the last several decades. 4 4 5 The small set of Java words includes verbs (words that invoke an action like '[https://www.tutorialspoint.com/java/java_do_while_loop.htm do]'), conditionals like '[https://www.javatpoint.com/java-if-else if]', and you can introduce nouns that are the subjects or objects that other words can act on. L ike all languages, Java has specific rules of syntax (grammar, spelling, etc.) that dictate how the language is used. Learning the key words and syntax are the first challenges when learning Java. Let's examine the simple turtle-graphics exercise and see how it might look in Java:5 The small set of Java words includes verbs (words that invoke an action like '[https://www.tutorialspoint.com/java/java_do_while_loop.htm do]'), conditionals like '[https://www.javatpoint.com/java-if-else if]', and you can introduce nouns that are the subjects or objects that other words can act on. Let's examine the simple turtle-graphics exercise from the [wiki:SoftwareOverviewControl Control Systems Software Introduction] of drawing a square and see how it might look written in Java: 6 6 7 7 {{{#!th rowspan=3 align=justify … … 31 31 }}} 32 32 33 Notice that each Java command ends with a semi-colon and that groups of commands are enclosed in curly-braces. These are examples of Java syntax. 33 Like all languages, Java has specific rules of syntax (grammar, spelling, etc.) that dictate how the language is used. Learning the key words and syntax are the first challenges when learning Java. Notice that: 34 * Each Java command ends with a semi-colon 35 * Groups (''blocks'') of commands are enclosed in curly-braces. 36 * Details provided to a command (''parameters'') such as the color to set are placed in parentheses 37 These are all examples of Java syntax. 34 38 35 39 Like all programming languages, Java allows you to combine groups of commands into a single unit that forms an abstraction. For example, the words shown above that draw a square could be combined into a single new word that can be used to replace the individual words. This allows programs to be built with increasing abstraction so high level concepts such as 'put the ring on the peg' can be expressed clearly and concisely.