夠用的文法(選修)

預計時間: 10 分鐘

本單元提供了足夠的文法知識,以便您理解本課程的其餘部分。如果您已經了解一些文法,請繼續閱讀「單字」單元。否則,請繼續閱讀。

為求簡潔,本單元抄了一些捷徑;文法主題實際上比本單元所建議的要複雜得多。

文法學家對於詞類的數量或類型並非全都意見一致。下表著重於與本課程相關的詞類:

詞類定義範例
名詞人、地、概念或事物Sam runs races.
代名詞取代另一個名詞(或更大結構)的名詞Sam runs races.He likes to compete.
形容詞修飾名詞的單字或片語Sam wears blue shoes.
動詞動作的單字或片語Sam runs races.
副詞修飾動詞、形容詞或其他副詞的單字或片語Sam runs slowly.
介係詞指定兩個名詞位置關係的單字或片語Sam's sneakers are seldom on his shelf.
連接詞連接兩個名詞或片語的單字Sam's trophies and ribbons live only in his imagination.
轉折語連接兩個句子的單字或片語Sam runs races weekly. However, he finishes races weakly.

名詞

名詞代表人、地或事物。JudyAntarcticahammers 都是名詞,但像 robustnessperfection 等無形的概念也是名詞。在下面的範例段落中,我們將名詞以粗體格式顯示:

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.

在此框架中,物件必須複製物件想要變更的任何底層程式庫中的通訊協定緩衝區很大,因此複製通訊協定緩衝區的成本高得令人無法接受。

在程式設計中,您可以將類別和變數視為程式的名詞。

練習

請找出以下段落中的六個名詞:

C enables programmers to control pointers and memory. Great power brings great responsibility.

C 讓程式設計師能夠控制指標和記憶體。強大的能力帶來重大的責任。



C enables programmers to control pointers and memory. Great power brings great responsibility.

現在假設第二個句子如下:

Great control brings great responsibility.

這裡的「control」是動詞還是名詞?

在這種情況下,「control」是名詞,即使在第一個句子中「to control」是動詞。英語中的許多單字在某些情況下是名詞,在其他情況下是動詞。

代名詞

代名詞是一個間接層——指向或替代其他名詞或句子的指標。例如,請看以下兩個句子:

Janet writes great code. She is a senior staff engineer.

Janet 寫出很棒的程式碼。是一位資深工程師。

在前面的範例中,第一個句子確立了 Janet 作為一個名詞。第二個句子用代名詞 She 取代了名詞 Janet。

在下面的範例中,代名詞 This 取代了整個句子:

Most applications aren't sufficiently tested. This is poor engineering.

大多數應用程式都沒有經過充分的測試。是糟糕的工程。

練習

請找出以下段落中的三個代名詞:

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

餐廳的特色是裸麥吐司配花生醬和李子醬。員工覺得它很棒,希望他們每天都能吃到這個。


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

動詞

動詞是表示動作的單字或片語。當您想表示兩個名詞(一個執行者和一個目標)之間的關係時,動詞就發揮作用了。動詞標示出執行者對目標做了什麼。

每個句子都必須至少包含一個動詞。例如,以下每個句子都包含一個動詞:

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

有些句子,例如以下句子,包含多個動詞:

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

根據時態和詞形變化,動詞可以由一個或多個單字組成。例如:

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

練習

請找出以下段落中的動詞:

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.

Samantha 正在用 C++ 編寫 Bullwinkle 行動。這個專案目前消耗了超過 80,000 行程式碼。她以前使用 Python,但最近被 C++ 所吸引。Samantha 領導一個由四名軟體工程師組成的團隊,下一季將增加到六名軟體工程師。


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.

形容詞和副詞

形容詞修飾名詞。例如,在下面的段落中,請注意形容詞如何修飾後面的名詞:

  • Tom likes red balloons. He prepares delicious food. He fixed eight bugs at work.
    Tom 喜歡紅色的氣球。他準備了美味的食物。他在工作上修復了八個錯誤。

大多數副詞修飾動詞。例如,請注意以下句子中的副詞(efficiently)如何修飾動詞(fixes):

  • Jane efficiently fixes bugs.
    Jane 有效率地修復錯誤。

副詞不一定緊鄰其動詞。例如,在以下句子中,副詞(efficiently)與動詞(fixes)之間隔了兩個字:

  • Jane fixes bugs efficiently.

副詞也可以修飾形容詞或其他副詞。

練習

請找出以下段落中的四個形容詞:

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

對於一個聰明的人來說,工程是一個很棒的職業。我認識一位聰明的工程師,他可以在任何智力任務中表現出色。


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

介係詞

介係詞指定兩件事物之間的關係。有些介係詞回答「這個東西相對於那個東西在哪裡?」的問題。例如:

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

其他介係詞回答「這個事件相對於那個事件是什麼時候?」的問題。例如:

  • The program evaluates the addition operation before evaluating the subtraction operation.
    程式在評估減法運算之前評估加法運算。
  • The cron daemon executes the script every Tuesday at noon.
    cron 服務在每個星期二中午執行該腳本。

一些介係詞(例如,byof)回答有關關係的其他類型的問題。例如,以下句子使用 by 來關聯一本書及其作者:

  • The C Programming Language by Kernighan and Richie remains popular.
Note

注意: 英語中的一些單字屬於多個文法類別。例如,雖然 under 通常是介係詞,但根據上下文,under 也可以用作副詞或形容詞。

練習

請找出以下段落中的兩個介係詞:

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


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

連接詞和轉折語

連接詞連接句子中的片語或名詞;轉折語則連接句子本身。

最重要的連接詞如下:

  • And (和)
  • But (但是)
  • Or (或者)

例如,在以下句子中,and 連接了「code」和「documentation」,而 but 則連接了句子的前半部分和後半部分。

Olivia writes great internal code and documentation but seldom works on open-source projects.

Olivia 寫出很棒的內部程式碼文件,但是很少從事開源專案。

技術寫作中最重要的轉折語如下:

  • However (然而)
  • Therefore (因此)
  • For example (例如)

例如,在下面的段落中,請注意轉折語如何連接和情境化句子:

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.

Juan 是一位出色的程式設計師。然而,他很少寫足夠的測試。例如,Juan 編寫了一個 5,000 行的 FFT 套件,其中只包含一個 10 行的單元測試。

練習

請填入最合適的轉折語:

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.

Barbara 通常在寫第一行程式碼之前會花很長時間研究問題。_____________,有一天她突然受到啟發,自發地編寫了一個方法。


這種情況下最好的轉折語如下:

However (然而)


Last modified: 2025-07-04