|
6 | 6 | \newcommand{\thetitle}{Think Java} |
7 | 7 | \newcommand{\thesubtitle}{How to Think Like a Computer Scientist} |
8 | 8 | \newcommand{\theauthors}{Allen B. Downey and Chris Mayfield} |
9 | | -\newcommand{\theversion}{6.1.6} |
| 9 | +\newcommand{\theversion}{6.1.7} |
10 | 10 |
|
11 | 11 | %%%% Both LATEX and PLASTEX |
12 | 12 |
|
@@ -404,7 +404,7 @@ \chapter{The way of the program} |
404 | 404 |
|
405 | 405 | The single most important skill for a computer scientist is {\bf problem solving}. |
406 | 406 | It involves the ability to formulate problems, think creatively about solutions, and express solutions clearly and accurately. |
407 | | -As it turns out, the process of learning to program is an excellent opportunity to develop problem solving skills. |
| 407 | +As it turns out, the process of learning to program is an excellent opportunity to develop problem-solving skills. |
408 | 408 | That's why this chapter is called, ``The way of the program''. |
409 | 409 |
|
410 | 410 | On one level you will be learning to program, a useful skill by itself. |
@@ -461,7 +461,7 @@ \section{What is computer science?} |
461 | 461 |
|
462 | 462 | Designing algorithms and writing code is difficult and error-prone. |
463 | 463 | For historical reasons, programming errors are called {\bf bugs}, and the process of tracking them down and correcting them is called {\bf debugging}. |
464 | | -As you learn to debug your programs, you will develop new problem solving skills. |
| 464 | +As you learn to debug your programs, you will develop new problem-solving skills. |
465 | 465 | You will need to think creatively when unexpected errors happen. |
466 | 466 |
|
467 | 467 | Although it can be frustrating, debugging is an intellectually rich, challenging, and interesting part of computer programming. |
@@ -809,7 +809,7 @@ \section{Formatting code} |
809 | 809 | %These characters, which are called {\bf whitespace}, affect the format of the code, but they don't affect its behavior. |
810 | 810 |
|
811 | 811 | %You have a lot of freedom in how you arrange your code. |
812 | | -%However with that freedom comes responsibility, both to yourself (when you look at the code in the future) and others who will be reading, understanding, and debugging it. |
| 812 | +%However, with that freedom comes responsibility, both to yourself (when you look at the code in the future) and others who will be reading, understanding, and debugging it. |
813 | 813 |
|
814 | 814 | \index{Google style} |
815 | 815 |
|
@@ -874,7 +874,7 @@ \section{Debugging code} |
874 | 874 |
|
875 | 875 | Finally, programming sometimes brings out strong emotions. |
876 | 876 | If you are struggling with a difficult bug, you might feel angry, despondent, or embarrassed. |
877 | | -Remember that you are not alone, and most if not all programmers have had similar experiences. |
| 877 | +Remember that you are not alone, and most, if not all, programmers have had similar experiences. |
878 | 878 | Don't hesitate to reach out to a friend and ask questions! |
879 | 879 |
|
880 | 880 |
|
@@ -2931,7 +2931,7 @@ \section{Adding new methods} |
2931 | 2931 | \item Introducing new methods can make a program smaller by eliminating repetitive code. |
2932 | 2932 | For example, to display nine consecutive new lines, you could invoke \java{threeLine} three times. |
2933 | 2933 |
|
2934 | | -\item A common problem solving technique is to break tasks down into sub-problems. |
| 2934 | +\item A common problem-solving technique is to break tasks down into sub-problems. |
2935 | 2935 | Methods allow you to focus on each sub-problem in isolation, and then compose them into a complete solution. |
2936 | 2936 |
|
2937 | 2937 | \end{itemize} |
@@ -7974,7 +7974,7 @@ \section{Garbage collection} |
7974 | 7974 |
|
7975 | 7975 | If there are no references to an object, there is no way to access its attributes or invoke a method on it. |
7976 | 7976 | From the programmer's view, it ceases to exist. |
7977 | | -However it's still present in the computer's memory, taking up space. |
| 7977 | +However, it's still present in the computer's memory, taking up space. |
7978 | 7978 |
|
7979 | 7979 | \index{garbage collection} |
7980 | 7980 |
|
@@ -11225,7 +11225,7 @@ \section{Exercises} |
11225 | 11225 |
|
11226 | 11226 | \index{override} |
11227 | 11227 |
|
11228 | | -Think of other ways you can minimize penalty points, such as playing the highest ranking cards first. |
| 11228 | +Think of other ways you can minimize penalty points, such as playing the highest-ranking cards first. |
11229 | 11229 | Write a new class that extends \java{Player} and overrides \java{play} to implement your strategy. |
11230 | 11230 | \end{exercise} |
11231 | 11231 |
|
@@ -11362,7 +11362,7 @@ \section{Command-line interface} |
11362 | 11362 | One of the most powerful and useful skills you can learn is how to use the {\bf command-line interface}, also called the ``terminal''. |
11363 | 11363 | The command line is a direct interface to the operating system. |
11364 | 11364 | It allows you to run programs, manage files and directories, and monitor system resources. |
11365 | | -Many advanced tools, both for software development and general purpose computing, are available only at the command line. |
| 11365 | +Many advanced tools, both for software development and general-purpose computing, are available only at the command line. |
11366 | 11366 |
|
11367 | 11367 | There are many good tutorials online for learning the command line for your operating system; just search the web for ``command line tutorial''. |
11368 | 11368 | On Unix systems like Linux and OS X, you can get started with just four commands: change the working directory ({\tt cd}), list directory contents ({\tt ls}), compile Java programs ({\tt javac}), and run Java programs ({\tt java}). |
@@ -11394,7 +11394,7 @@ \section{Command-line testing} |
11394 | 11394 | And after you've completed programming an algorithm, it's important to test that it works correctly on a variety of inputs. |
11395 | 11395 |
|
11396 | 11396 | Throughout the book, we illustrate techniques for testing your programs. |
11397 | | -Most if not all testing is based on a simple idea: does the program do what we expect it to do? |
| 11397 | +Most, if not all, testing is based on a simple idea: does the program do what we expect it to do? |
11398 | 11398 | For simple programs, it's not difficult to run them several times and see what happens. |
11399 | 11399 | But at some point, you will get tired of typing the same test cases over and over. |
11400 | 11400 |
|
@@ -11786,7 +11786,7 @@ \section{Graphics methods} |
11786 | 11786 | \index{bounding box} |
11787 | 11787 |
|
11788 | 11788 | The four parameters specify a {\bf bounding box}, which is the rectangle in which the oval is drawn. |
11789 | | -\java{x} and \java{y} specify the the location of the upper-left corner of the bounding box. |
| 11789 | +\java{x} and \java{y} specify the location of the upper-left corner of the bounding box. |
11790 | 11790 | The bounding box itself is not drawn (see Figure~\ref{fig.circle}). |
11791 | 11791 |
|
11792 | 11792 | \begin{figure}[!ht] |
@@ -12492,7 +12492,7 @@ \subsection*{No, I really need help.} |
12492 | 12492 |
|
12493 | 12493 | It happens. |
12494 | 12494 | Even the best programmers get stuck. |
12495 | | -Sometimes you need a another pair of eyes. |
| 12495 | +Sometimes you need another pair of eyes. |
12496 | 12496 |
|
12497 | 12497 | Before you bring someone else in, make sure you have tried the techniques described in this appendix. |
12498 | 12498 |
|
|
0 commit comments