5 Steps to a 5 AP Computer Science A 2017 (2016)

STEP 4

Review the Knowledge You Need to Score High

CONCEPT 0    Background on Software Development

CONCEPT 1    Fundamentals of Programming

CONCEPT 2    Classes and Objects (Basic Version)

CONCEPT 3    The String Class

CONCEPT 4    The Math , Integer , and Double Classes

CONCEPT 5    Data Structures

CONCEPT 6    Algorithms (Basic Version)

CONCEPT 7    Classes and Objects (Advanced Version)

CONCEPT 8    Inheritance and Polymorphism

CONCEPT 9    The abstract class and the interface

CONCEPT 10    Recursion

CONCEPT 11    Algorithms (Advanced Version)

CONCEPT 12    Sorting Algorithms and the Binary Search

CONCEPT 13    Seeing the Big Picture: Design

CONCEPT 0

Background on Software Development

IN THIS CONCEPT

Summary: This concept will give you background on Java and what a software developer is. You will also learn the purpose of software, and the tools you will use to prepare for the exam.

Key Ideas

   Java is the programming language of the AP Computer Science A Exam.

   Java is an object-oriented programming language.

   Software developers design and implement code for countless applications.

   An integrated development environment (IDE) is the tool that you will use when you write your Java code.

What Is Java?

So, you want to learn how to write software for other people. Well, you could write all your programs on paper using a pencil. Then, the users could just read your code and pretend that they’re running your program. There’s just one minor problem with that: to write software, you need software.

Java is a general-purpose, object-oriented computer programming language that was developed by James Gosling in the mid-1990s when he worked at Sun Microsystems (Sun was later acquired by Oracle). Java is different from other languages in several ways, but the major difference is that it was designed to be machine-independent . This means that a Java program could be written on any platform (Windows, Mac, Linux, etc.) and then could be run on any platform. Prior to Java, software was machine dependent , which meant that you could only run your program on the same type of machine that you wrote it on.

Here is a simplistic explanation of how Java accomplishes its machine-independent process. Suppose you write a program in Java. The computer can’t run the program as you’ve written it, because it doesn’t understand Java. It can only run a program whose instructions are written in machine code . A compiler is a program that converts your Java program into code called bytecode . The compiler checks your program for syntax errors , and when all of these errors are eliminated, the compiler generates a new program that is readable by a Java virtual machine (JVM) . The JVM is where the Java program actually runs since it translates the bytecode into machine code. The JVM is a part of the Java Runtime Environment (JRE) that is provided by Oracle. Oracle writes a JVM for numerous platforms like Windows, which is how a Java program can run on any machine.

It’s a Big Java World Out There

Java has thousands of built-in classes that all Java programmers can use. Since the focus of this book is to help you score a 5 on the AP Computer Science A Exam, only the features that are tested on the exam are included in this book.

What Is a Software Developer?

Software developers are the wizards of our technology-based world. They are the people who design and create the programs that run on smartphones, tablets, smart TVs, computers, cars, and so on. It is stunning how many people the software developer affects.

Software developers may work individually, but most of the time, they work as part of a team of developers. It is essential that they write clean, readable code so that others can read and modify it, if needed. Since other developers will often read your code, it is important to insert comments into your code. In the real world of programming, most programmers despise commenting their code, but it is a necessary evil, and every developer appreciates reading code that has been well documented.

One of the most important skills that a programmer needs to have is figuring out how to design and subsequently implement code for a project. The software developer’s job can be summarized with this simple graphic:

This is the exciting, yet challenging part of the developer’s role in project development. Computer programmers get a high level of satisfaction from solving problems, and this is why it is a high priority on the AP Computer Science A Exam.

In many classrooms, students work independently on their programming assignments. This is fine when you are learning how to code; however, few software projects in the work world are like that. Projects can have anywhere from a small handful of programmers to hundreds of programmers. There is a hierarchy among the developers that separates the types of work to be done.

What Is OOP (Object-Oriented Programming)?

Object-oriented programming is an approach to programming that uses the concept of classes and objects. It’s a brilliant approach since we live in an object-oriented world . Everywhere you look, there are objects. These objects have attributes that make them different from other objects. Many of these objects can perform some kind of action, or you can get information from them. In OOP, classes define how an object will be constructed. Then, objects are created from these classes, and you manipulate them in your program. Kind of makes you feel like you rule the world, doesn’t it?

Viewing the World Through the Eyes of a Software Developer

Something I challenge all my computer science students to do is to begin viewing the world through the eyes of a software developer. As you learn new concepts, try to relate them to things in your daily life. If you are a gamer, start to analyze the games that you play and see if you can figure out how the developers made the game. My students tell me that their minds “open up” after doing this, and it helps them to be better programmers since they are constantly making connections between the computer science topics and the world that they live in.

For the Good of All Humankind

Let’s be honest, in our world, there are good software developers and there are evil software developers. The hackers who live on the dark side will always exist, and our job as noble software developers is to make the world a better place. Integrity is vital to our side and is a badge to be worn with pride. Therefore, we must vow to only write software that is for the good of all humankind and stand up against all evil software developers.

As developers, we strive to:

  • Make the best product possible
  • Keep our clients’ information safe and private
  • Honor the intellectual property of others
  • Make ethically moral software

Choosing Your IDE

An Integrated Development Environment, or IDE, is a piece of software that allows you to write software more easily. Professional IDEs, such as Eclipse or IntelliJ, have really awesome features that make creating programs easier. Other IDEs are great for introducing a newbie to programming.

There are many excellent IDEs for Java. Your computer science teacher will probably choose the IDE for you. While it is important to learn how to write a program with an IDE, it is also important to remember that you will not be able to use a computer on the AP Computer Science A Exam. So, whatever program you use to write your Java code, you must learn how to do it without the use of a computer.

No Computer!

Computers are not used on the AP Computer Science A Exam.

HelloWorld

In whatever IDE you choose to write your programs, type in the following code for the HelloWorld program. Compile it and run it. This will get you to the point where you can begin this book.

PROGRAM

OUTPUT (This is what is displayed on the console screen.)

Hello World.

Spacing and Indenting in Your Program

Programmers have the freedom to put spacing and indentions in their program in any way they want. Typically, programmers follow spacing guidelines to make it easier to read. The HelloWorld example shown above demonstrates a classic form for spacing and indenting code.

You may also see a HelloWord program that looks like the next example. This program will run in exactly the same way as the previous example even though the spacing is different.

 Rapid Review

  • Java is a general-purpose, object-oriented computer programming language.
  • Java source code is translated into bytecode by the compiler.
  • Java has thousands of built-in classes that all Java programmers can use.
  • A software developer is a person who writes computer programs.
  • Software developers must be creative but also pay attention to detail.
  • An object-oriented language is a programming model that uses classes and objects.
  • To be a better programmer you should start to view the world through the eyes of a software developer.
  • Software developers must keep their clients’ information safe, honor the intellectual properties of others, and make ethically moral software.
  • An integrated development environment (IDE) is a piece of software that allows you to write software more easily.
  • A computer is not used on the AP Computer Science A Exam.
  • HelloWorld is traditionally the first computer program that a beginning Java programmer writes.