# Just enough grammar (optional)

<br />

> [!NOTE]
> **Estimated Time:** 10 minutes

This unit provides just enough grammar to understand the remainder of the
course. If you already know some grammar, move on to [Words](https://developers.google.com/tech-writing/one/words).
Otherwise, read on.

For simplicity's sake, this unit takes a few shortcuts; grammatical topics are
actually wildly more complicated than this unit suggests.

Grammarians don't all agree on the number or types of parts of speech. The
following table focuses on the parts of speech relevant to this course:

| Part of Speech | Definition | Example |
|---|---|---|
| Noun | A person, place, concept, or thing | **Sam** runs **races**. |
| Pronoun | A noun that replaces another noun (or larger structure) | Sam runs races. **He** likes to compete. |
| Adjective | A word or phrase that modifies a noun | Sam wears **blue** shoes. |
| Verb | An action word or phrase | Sam **runs** races. |
| Adverb | A word or phrase that modifies a verb, an adjective, or another adverb | Sam runs **slowly**. |
| Preposition | A word or phrase specifying the positional relationship of two nouns | Sam's sneakers are seldom **on** his shelf. |
| Conjunction | A word that connects two nouns or phrases | Sam's trophies **and** ribbons live only in his imagination. |
| Transition | A word or phrase that connects two sentences | Sam runs races weekly. **However**, he finishes races weakly. |

## Nouns

Nouns represent people, places, or things. **Judy** , **Antarctica** , and
**hammers** are all nouns, but so are intangible concepts like **robustness**
and **perfection**. In the following example passage, we've formatted the
nouns in bold:
> In the **framework** , an **object** must copy any underlying **values** that
> the **object** wants to change. The **protocol buffers** in the **codebase**
> are huge, so copying the **protocol buffers** is unacceptably expensive.

In programming, you might think of classes and variables as your program's
nouns.

### Exercise

Identify the six nouns in the following passage:
> C enables programmers to control pointers and memory.
> Great power brings great responsibility.

#### Click the icon to see the answer.

You can find the nouns in boldface:
> **C** enables **programmers** to control **pointers** and **memory** . Great **power** brings great **responsibility**.

Now suppose the second sentence was the following:
> Great control brings great responsibility.

Is "control" a verb or is it a noun?


In this context, "control" is a noun, even though "to control"
in the first sentence is a verb. Many words in English
serve as a noun in some contexts and a verb in others.

## Pronouns

Pronouns are an indirection layer---pointers to or substitutions for other nouns
or sentences. For example, consider the following two sentences:
> Janet writes great code. **She** is a senior staff engineer.

In the preceding example, the first sentence establishes **Janet** as a noun.
The second sentence replaces the noun **Janet** with the pronoun **She**.

In the following example, the pronoun **This** replaces an entire sentence:
> Most applications aren't sufficiently tested. **This** is poor engineering.

### Exercise

Identify the three pronouns in the following passage:
> The cafeteria featured peanut butter and plum jam on rye toast.
> Employees found it awesome and wished they could eat this every day.

#### Click the icon to see the answer.

> The cafeteria featured peanut butter and plum jam on rye toast. Employees found **it** awesome and wished **they** could eat **this** every day.

## Verbs

A verb is an action word or phrase. When you want to represent the relationship
between two nouns (an actor and a target), the verb does the work. A verb
identifies what the actor does to the target.

Each sentence must contain at least one verb. For example, each of the following
sentences contains a single verb:

- Sakai **prefers** pasta.
- Rick **likes** the ocean.
- Smurfs **are** blue.
- Jess **suffers** from allergies.

Some sentences, such as the following, contain multiple verbs:

- Nala **suffers** from allergies and **sneezes** constantly.
- The program **runs** slowly but **fails** quickly.

Depending on the tense and the conjugation, a verb could consist of one word or
multiple words. For example:

- Tina **was eating** breakfast a few hours ago.
- Tina **is eating** lunch right now.
- Tina **will eat** dinner tonight at 7:00.

### Exercise

Identify the verbs in the following passage:
> Samantha is coding Operation Bullwinkle in C++. This project
> currently consumes over 80,000 lines of code. She previously
> used Python, but recently gravitated to C++. Samantha leads
> a team of four software engineers, which will grow to six
> software engineers next quarter.

#### Click the icon to see the answer.

> Samantha **is coding** Operation Bullwinkle in C++. This project currently **consumes** over 80,000 lines of code. She previously **used** Python, but recently **gravitated** to C++. Samantha **leads** a team of four software engineers, which **will grow** to six software engineers next quarter.

## Adjectives and adverbs

Adjectives modify nouns. For example, in the following passage, notice how the
adjectives modify the subsequent noun:

- Tom likes **red** balloons. He prepares **delicious** food. He fixed **eight** bugs at work.

Most adverbs modify verbs. For example, notice how the adverb
(**efficiently** ) in the following sentence modifies the verb (**fixes**):

- Jane **efficiently** fixes bugs.

Adverbs are not necessarily right next to their verb. For example, in the
following sentence, the adverb (**efficiently** ) is two words away from the
verb (**fixes**):

- Jane fixes bugs **efficiently**.

Adverbs can also modify adjectives or other adverbs.

### Exercise

Identify the four adjectives in the following passage:
> Engineering is a great career for a brilliant mind. I know a
> clever engineer who could excel at any intellectual task.

#### Click the icon to see the answer.

> Engineering is a **great** career for a **brilliant** mind. I know a **clever** engineer who could excel at any **intellectual** task.

## Prepositions

Prepositions specify the relationship between two things. Some prepositions
answer the question, "*Where* is this thing relative to that other thing?"
For example:

- The submenu lies **under** the menu.
- The definition appears **next to** the term.
- The `print` function falls **within** the main routine.

Other prepositions answer the question, "*When* is this event relative to
that other event?" For example:

- The program evaluates the addition operation **before** evaluating the subtraction operation.
- The cron daemon executes the script every Tuesday **at** noon.

A few prepositions (for example, **by** and **of** ) answer other kinds of
questions about relationships. For example, the following sentence uses
**by** to relate a book to its authors:

- *The C Programming Language* **by** Kernighan and Richie remains popular.

> [!NOTE]
> **Note:** Some English words fall into multiple grammatical categories. For example, although **under** is usually a preposition, **under** can also serve as an adverb or adjective depending on context.

### Exercise

Identify the two prepositions in the following passage:
> Parameters may optionally appear within a URL, after the path.

#### Click the icon to see the answer.

- Parameters may optionally appear **within** a URL, **after** the path.

## Conjunctions and transitions

Conjunctions connect phrases or nouns *within* a sentence; transitions connect
sentences themselves.

The most important conjunctions are as follows:

- And
- But
- Or

For example, in the following sentence, **and** connects "code" with
"documentation," while **but** connects the first half of the sentence
with the second.
> Olivia writes great internal code **and** documentation **but** seldom
> works on open-source projects.

The most important transitions in technical writing are as follows:

- However
- Therefore
- For example

For example, in the following passage, notice how the transitions connect and
contextualize the sentences:
> Juan is a wonderful coder. **However** , he rarely writes sufficient tests.
> **For example**, Juan coded a 5,000 line FFT package that contained only a
> single 10-line unit test.

### Exercise

Fill in the most appropriate transition:
> Barbara typically studies problems for a long time before writing the first
> line of code. _____________, she spontaneously coded a method the other day
> when she was suddenly inspired.

#### Click the icon to see the answer.

The best transition for this situation is as follows:
> However

<br />

**Next unit:** [Words](https://developers.google.com/tech-writing/one/words)