Program libraries
導入済み
19:11
オペレーティングシステム
あなたは一度も見たことがなく、これからも見ることはない——それにもかかわらず、常にそこにあります。開くアプリ、保存するファイル、画面をタップする每一次に、見えない…
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| public repository | A storage place where code is shared and available to anyone. |
| string/strɪŋ/ | A sequence of characters treated as a single data value. |
| builds | The processes of turning source code into programs ready to run. |
| software/ˈsɒftweə/ | The programs and instructions that tell a computer what to do. |
| program library/ˈprəʊɡræm ˈlaɪbrəri/ | プログラムライブラリ |
| developer | A person who designs, writes, tests, or maintains software. |
| routines/ruːˈtiːnz/ | Sections of code written to perform particular tasks within a program. |
| subroutines/ˈsʌbruːtiːnz/ | サブルーチン |
| classes/ˈklæsɪz/ | Definitions of object types, describing their fields and methods; they are distinct from the individual objects created from them. |
| modules/ˈmɒdjuːlz/ | Separately organised program components that perform defined tasks and communicate through interfaces. |
| graphics | Images and other visual content created or displayed by a computer. |
| network/ˈnetwɜːk/ | A set of connected devices or nodes that can exchange information. |
| path-finding | The process of finding a route between two places. |
| compression/kəmˈpreʃn/ | Representing data using fewer bits. |
| library routines/ˈlaɪbrəri ruːˈtiːnz/ | |
| code/kəʊd/ | Instructions written in a programming language for a computer to follow. |
| encryption/enˈkrɪpʃn/ | Transforming information using an algorithm and key so that unauthorised readers cannot readily understand it. |
| bug/bʌɡ/ | An error in a program that causes it to work incorrectly. |
| licence/ˈlaɪsəns/ | A legal agreement stating how software may be used and shared. |
| path-finding algorithms | Step-by-step methods for finding routes between places. |
| static library/ˈstætɪk ˈlaɪbrəri/ | スタティックライブラリ |
| executable/ɪɡˈzekjʊtəbl/ | 実行可能ファイル |
| compiled/kəmˈpaɪld/ | Describes source code translated into a form a computer can run. |
| linked/lɪŋkt/ | Describes compiled code joined with other required code to create a program. |
| rebuilding | The process of creating a program again from its code and required libraries. |
| dynamic library/daɪˈnæmɪk ˈlaɪbrəri/ | ダイナミックリンクライブラリ |
| Dynamic Link Library | A separate library file on Windows that programs can load while running. |
| memory/ˈmeməri/ | The part of a computer that holds data and programs currently in use. |
| run time/rʌn taɪm/ | The period during which a program is running on a computer. |
| recompiling | The process of translating source code into executable form again. |
| compile time | The period when source code is translated into a form a computer can run. |
| embedded device | A computer built into a larger system to perform a specific task. |
| IDE/ˌaɪ diː ˈiː/ | Integrated development environment: a program combining tools such as an editor, compiler or interpreter, and debugger. |
インターネットを破壊した11行
- 2016年3月、あるプログラマーが公開リポジトリから
left-padという小さなライブラリを削除しました。これは11行長で、文字列の先頭にスペースを追加するだけでした。 - 数時間之内に、世界中の企業でビルドが失敗しました。数千のプログラムはこの11行を一度も書いていませんでした。すべて借用しており、それが機能しなくなった瞬間までその借用は目に見えませんでした。
- これが現代のソフトウェアの作り方です。プログラムライブラリは意図的な借用であり、このImplemented lesson は開発者にもたらすもの、それのコスト、そしてプログラムに接続される2つの方法を示しています。

プログラムライブラリとは何か
- プログラムライブラリとは、プログラム自身が書く代わりに使用できる、事前に書かれてテスト済みのルーチン、サブルーチン、クラス、モジュールの集合体です。
- 数学ライブラリ、グラフィックスライブラリ、ネットワークライブラリ、パスファインディングライブラリ、圧縮ライブラリ:それぞれ、必要なすべてのプログラムにとって一度問題領域を解決します。
- 開発中のソフトウェアは通常、このようなライブラリルーチンと、新しいプログラム固有のコードを組み合わせて構築されます。

新しいコードは小部分であり、借用されたコードは大部分である

コンピューティング概念ラボ
Classify concrete examples by the computing idea they demonstrate.
A program library is:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Libraries provide ready-made, tested code (maths, graphics, network…) that a program can call instead of writing its own.
A collection of ready-made, reusable, tested code is a program ______.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Libraries save time and reduce bugs.
開発者へのメリット
- ルーチンはすでに書かれてテスト済みなので、開発が早く安価になる。
- それらは信頼性が高い:多くのプログラムで使用されているため、ほぼエラーがない。
- 開発者はその分野(グラフィックス、暗号化、パスファインディングなど)の専門知識は不要であり、プログラムの独自の機能に時間を費やすことができる。
- プログラムは保守しやすい:共通コードが一处に存在し、チームが並列に作業でき、メンバー全員が同じルーチンを使用できるため。
A benefit of using a library is that the code is:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Library code is tested, widely used and standardised — reusing it saves time and improves reliability.
Which are benefits to a developer of building software from library routines? Select すべて that apply.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Tested routines, no expertise needed, easier maintenance. The program's own code still has to be tested.
デメリット
- このルーチンが正確な要件に合致しない可能性があり、開発者が変更できないため、制約を回避して対応する必要がある。
- プログラムはライブラリに依存している: バグ、更新の欠如、または
left-padのような撤回されたライブラリは、プログラムの問題となる。 - ライブラリのライセンスにより、プログラムを販売・共有する方法が制限されたり、未使用のルーチンがプログラムを大型化させたりすることがある。
演習例:レストラン用ロボット
- レストラン用ロボットのソフトウェアを開発するチームは、テーブル間の最短経路を探すルーチンを含むプログラムライブラリを使用しています。このチームにとっての利点2つと欠点1つを説明してください。
- 利点: ルーチンは既に作成・テスト済みであるため、チームは時間を節約でき、その結果を信頼できる。利点: チーム自身が経路探索アルゴリズムを理解する必要がなく、ロボットの独自機能の開発に時間を割ける。
- 欠点: ルーチンがレストランの正確な要件(椅子の移動、片側通行通路など)に対応できない可能性がある。チームは変更できないため、その制約を回避する工夫をする必要がある。
- 各ポイントをこのチームおよびこのルーチンに結びつける。「時間を節約」よりも「経路探索アルゴリズムの作成とテストに要する時間を節約する」といった具体性のある記述の方が高い得点が得られる。

Which is a drawback for the robot team of using the path-finding routine from a library?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The team cannot change library code, so any mismatch with their needs must be worked around. Not needing to understand the algorithm is a benefit, not a drawback.
スティックライブラリ
- スティックライブラリは、プログラムがコンパイルおよびリンクされる際にエグゼキュータブルにコピーされる。
- その後、プログラムは単独で動作する:実行するために他のファイルは必要ない。
- コスト: 各プログラムに独自のコピーが含まれるためエグゼキュータブルが大きくなり、ライブラリの更新には使用该するすべてのプログラムを再ビルドする必要がある。

A static library differs from a dynamic library because it is:
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
A static library is built into the executable; a dynamic library is loaded at run time and shared between programs.
ダイナミックライブラリとDLLファイル
- ダイナミックライブラリは、Windows上のDynamic Link Library (DLL) またはLinux上の
.soファイルであり、別個のファイルとして残り、プログラムが呼び出すたびにメモリに読み込まれ、実行時に利用される。 - エグゼキュータブルが小さく、複数の実行中のプログラムがメモリ上で1つのコピーを共有できる。また、バグ修正や新デバイスのサポートのために DLL を一度だけ更新すれば、使用するプログラムを再コンパイルする必要がない。
- メモリはライブラリが必要としている間のみ消費される。コスト: DLL が存在しない場合や、誤ったバージョンの場合、プログラムは実行されない。

コンパイル時にコピーされる、あるいは実行時に読み込まれて共有される

A dynamic library can be shared by many programs and updated once for all of them.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Because it is loaded at run time, one shared dynamic library serves many programs; updating it fixes them all without rebuilding each.
Match each trait to a static or a dynamic library.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Static linking copies code into the executable (bigger, self-contained); dynamic linking loads a shared library at run time (smaller, updatable once for all).
A program loads a DLL when it first needs one of its routines. Put the events in order.
難易度 3/5 · 200 コイン + 今日初回達成時の小ボーナス
Here the DLL is loaded at run time, when its routine is first needed (some programs load their DLLs at start-up instead). One copy in memory can be shared by several programs.
演習例:DLLファイルの利点
- ソフトウェア開発者が DLL ファイルを使用しています。その利点を説明してください。 [4]
- エグゼキュータブルファイルが小さい。ライブラリのコードがエグゼキュータブルにコピーされていないためである。
- メモリ内の DLL の1つのコピーを、使用するすべての実行中のプログラムが共有するため、メモリを節約できる。
- バグ修正や新デバイスへの対応のために DLL を更新しても、それを呼び出すプログラムを再コンパイルしたり再インストールしたりする必要がない。
- ライブラリは必要なときにのみ読み込まれるため、ルーチンが使用されている間のみメモリが消費される。
スティックかダイナミックかの選択
- プログラムを何もインストールできないマシン、組み込みデバイス、または単一のダウンロードファイル上で実行する場合:スティック。エグゼキュータブルが自己完結型であるためである。
- 1つのシステム内で多くのプログラムが同じルーチンを共有する場合、またはルーチンが頻繁に更新される場合:ダイナミック。1つの共有コピーは小さく、一度の更新で全てに対応できるためである。
- トレードオフで正当化される:自己完結型だが大きく、更新のために再ビルドが必要か、小さく共有可能だがファイルの存在に依存するか。

A program that must run from a single file on a device where nothing else can be installed should use a dynamic library.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
A dynamic library is a separate file that must be present. A static library is copied into the executable, which is exactly what a self-contained program needs.
見落としやすいポイント
- DLLは実行時に読み込まれ、コンパイル時には読み込まれない。その一言がポイントである。
- 利点は開発者に対するもの:すでに作成・テスト済みであるため、専門知識が不要、保守が容易である。「プログラムが高速に動作する」はリストに含まれない。
- ライブラリはコードであり、ツールではない。IDE がツールであり、ライブラリはプログラムが呼び出す対象である。
- 欠点はライブラリの使用に伴う欠点でなければならない:変更できない、要件に合わない、依存関係。「金銭がかかる」は通常は要点ではない。
理解できましたか
- プログラムライブラリとは、プログラムが自身でコードを書く代わりに呼び出す、事前に作成・テスト済みのコード群である
- 利点:高速かつ低コストでの開発、信頼性の高いルーチン、当該分野の専門知識が不要、保守が容易、チームによる並列作業が可能;欠点:要件に合わない、変更できない、依存関係
- スティック: コンパイル時にエグゼキュータブルにコピーされ、自己完結型だが大きく、更新のために再ビルドが必要
- ダイナミック (DLL): 実行時に読み込まれる別個のファイル、小型、多くのプログラムで共有、一度の更新で全てに対応
何が問題でしたか?この内容はサイトの運営チームだけが確認します。