

ライブラリとフレームワークの違いとはなんでしょうか。  
G検定の勉強をしていたら  
NumPy  
scikit-learn  
が、ライブラリの説明の箇所でもフレームワークの説明の箇所でも登場しました。  
両者はたまたま両方にまたがるものなんでしょうか？


CC BY-SA 4.0
2022-12-10T06:58:52.790
92676
2022-12-14T00:59:53.830
55769
question
python numpy scikit-learn
ライブラリとフレームワークの違いとは？


私はこんなイメージです。矢印が呼び出しの向きを表しています。

[![フレームワークとライブラリのイメージ](https://i.stack.imgur.com/4SRNj.jpg)](https://i.stack.imgur.com/4SRNj.jpg)


CC BY-SA 4.0
2022-12-13T16:50:09.590
92759
2022-12-13T17:00:14.157
2022-12-13T17:00:14.157
3060
55896
92676
answer


## 回答ではありません

ただのWikipediaの引用です。  
<https://en.wikipedia.org/wiki/Software_framework>

> Frameworks have key distinguishing features that separate them from normal
> libraries:
[code]

>     inversion of control: In a framework, unlike in libraries or in standard
> user applications, the overall program's flow of control is not dictated by
> the caller, but by the framework.[1] This is usually achieved with the
> Template Method Pattern.
>     default behaviour: This can be provided with the invariant methods of
> the Template Method Pattern in an abstract class which is provided by the
> framework.
>     extensibility: A user can extend the framework – usually by selective
> overriding – or programmers can add specialized user code to provide
> specific functionality. This is usually achieved by a hook method in a
> subclass that overrides a template method in the superclass.
>     non-modifiable framework code: The framework code, in general, is not
> supposed to be modified, while accepting user-implemented extensions. In
> other words, users can extend the framework, but cannot modify its code.
>  
[/code]

**余談:**  
個人的にはinversion of
control(制御の反転)を主軸にした説明が多い気がします。こういう言葉の定義ほどどうでもいいことはない気もしますけど。


CC BY-SA 4.0
2022-12-14T00:59:53.830
92762
2022-12-14T00:59:53.830
54957
92676
answer