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. |
인터넷을 파괴한 열 한 줄
- 2016년 3월 한 프로그래머가 공개 저장소로부터
left-pad라는 작은 라이브러리를 삭제했습니다. 이 라이브러리는 열 줄 길이에 불과했는데, 문자열 앞부분에 공백을 추가하는 기능이었습니다. - Within hours, builds failed at companies around the world. Thousands of programs had never written those eleven lines. They had all borrowed them, and the borrowing had been invisible until the moment it stopped working.
- That is how modern software is made. A program library is the borrowing, done on purpose, and this lesson is what it gives a developer, what it costs, and the two ways it can be attached to a program.

프로그램 라이브러리가 무엇인지
- 프로그램 라이브러리는 사전에 작성되고 검증된 루틴, 서브루틴, 클래스 및 모듈의 집합으로, 프로그램이 자체 코드를 작성하지 않고 사용할 수 있게 합니다.
- 수학 라이브러리, 그래픽 라이브러리, 네트워크 라이브러리, 경로 탐색 라이브러리, 압축 라이브러리: 각각 필요한 모든 프로그램에게 한 번 해결해 놓은 문제 영역을 담당합니다.
- 개발 중인 소프트웨어는 일반적으로 이러한 라이브러리 루틴과 새로운 프로그램에만 특화된 코드로 구성됩니다.

새로운 코드는 작은 부분이고, 빌려온 코드는 큰 부분입니다

컴퓨팅 개념 실험실
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.
단점
- 이 routine(routine)이 정확한 요구사항에 부합하지 않을 수 있으며, 개발자가 이를 수정할 수 없으므로 제한된 범위 내에서 대안을 마련해야 합니다.
- 프로그램은 라이브러리에 의존하게 되므로, 버그나 업데이트 누락, 또는
left-pad와 같은 경우 라이브러리 사용 중단으로 인해 문제가 발생합니다. - 라이브리의 라이선스로 인해 프로그램 판매 및 배포 방식이 제한될 수 있으며, 사용하지 않는 routine들은 프로그램을 더 크게 만듭니다.
worked example: 레스토랑 로봇
- 레스토랑 로봇용 소프트웨어를 작성하는 팀은 테이블 간 최단 경로를 찾는 routine이 포함된 프로그램 라이브리를 사용합니다. 이 팀에게 두 가지 장점과 하나 단점을 설명하십시오.
- 장점: routine이 이미 작성되고 테스트되었으므로, 팀은 시간을 절약하고 결과의 신뢰성을 확보할 수 있습니다. 장점: 팀 자체적으로 경로 탐색 알고리즘을 이해할 필요 없이, 로봇 고유의 기능 개발에 시간을 할당할 수 있습니다.
- 단점: 이 routine이 레스토랑의 정확한 요구사항(의자 이동, 일방 통로 등)을 처리하지 못할 수 있으며, 팀은 이를 변경할 수 없으므로 routine의 한계를 우회해야 할 수 있습니다.
- 각 항목을 이 팀과 이 routine에 구체적으로 연결하십시오. 일반적인 "시간 절약"보다 "경로 탐색 알고리즘 작성 및 테스트에 소요되는 시간 절약"이라는 구체적인 설명이 더 높은 점수를 받습니다.

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.
정적 라이브러리(static libraries)
- 정적 라이브러리는 프로그램이 컴파일되고 링크될 때 executable에 복사됩니다.
- 따라서 프로그램은 독립적으로 작동하며, 실행을 위해 다른 파일이 필요 없습니다.
- The cost: every program carries its own copy, so executables are larger, and a library update means rebuilding every program that uses it.

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파일로, 별도의 파일로 유지되며, 프로그램이 이를 호출할 때만 **실행 시간(run time)**에 메모리로 로드됩니다. - Executables are smaller; several running programs share one copy in memory; and a DLL can be updated once, a bug fix or a new device, without recompiling the programs that use it.
- 메모리는 라이브리가 필요한 동안에만 사용됩니다. 비용: DLL이 없거나 버전이 잘못되면 프로그램이 실행되지 않습니다.

컴파일 시에 복사되거나, run time에 로드되어 공유됨

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]
- 라이브러리 코드가 실행 파일에 복사되지 않았으므로 실행 파일의 크기가 작다.
- One copy of the DLL in memory is shared by every running program that uses it, saving memory.
- DLL을 업데이트하여 버그를 수정하거나 새로운 기기를 지원할 수 있어, 해당 DLL을 호출하는 프로그램을 재컴파일하거나 재설치할 필요가 없다.
- 라이브러리는 필요할 때만 로드되므로 루틴이 사용 중일 동안에만 메모리가 사용된다.
정적 또는 동적 선택
- The program must run on a machine where nothing else can be installed, an embedded device or a single downloaded file: static, because the executable is self-contained.
- 하나의 시스템에서 많은 프로그램들이 동일한 루틴을 공유하거나 루틴이 자주 변경되는 경우: 동적(dynamic), 하나의 공유 사본이 더 작고 한 번의 업데이트로 모든 것을 해결하기 때문이다.
- 상충 관계(trade-off)로 정당화한다: 자체적이지만 크기가 크고 업데이트를 위해 다시 빌드되어야 함, 혹은 작고 공유되지만 파일이 존재해야 한다는 의존성이 있음.

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은 run time에 로드되며 컴파일 시간에는 그렇지 않다. 이 단어가 바로 채점 포인트이다.
- 개발자에게 이점이 있다: 이미 작성되고 테스트되어 있어 전문 지식이 필요하지 않으며 유지보수가 용이하다. "프로그램이 더 빠르게 실행된다"는 목록에 포함되지 않는다.
- 라이브러리는 코드이지 도구(tool)가 아니다. IDE가 도구이며, 라이브러리는 프로그램이 호출하는 것이다.
- 단점은 라이브러리 사용에 대한 단점이어야 한다: 변경할 수 없음, 적합하지 않을 수 있음, 의존성. "비용이 들다"는 일반적으로 핵심 점이 아니다.
이해했습니다
- **프로그램 라이브러리(program library)**는 프로그램이 직접 작성하는 대신 호출하는 미리 작성되고 테스트된 코드이다.
- 장점: 빠르고 저렴한 개발, 신뢰할 수 있는 루틴, 해당 분야에 대한 전문 지식 불필요, 쉬운 유지보수, 팀별 병렬 작업 가능; 단점: 적합하지 않을 수 있음, 변경 불가, 의존성
- 정적(static): 컴파일 시에 실행 파일에 복사되며, 자체적이지만 크기가 크고 업데이트를 위해 다시 빌드됨
- 동적(dynamic (DLL)): run time에 로드되는 별도 파일로, 크기가 작고 여러 프로그램이 공유하며, 한 번의 업데이트로 모두 적용됨
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.