What is the difference between a framework and a library?

后端 未结 19 1936
南旧
南旧 2020-11-22 11:46

What is the difference between a framework and a library?

I always thought of a library as a set of objects and

19条回答
  •  盖世英雄少女心
    2020-11-22 12:01

    I like Cohens answer, but a more technical definition is: Your code calls a library. A framework calls your code. For example a GUI framework calls your code through event-handlers. A web framework calls your code through some request-response model.

    This is also called inversion of control - suddenly the framework decides when and how to execute you code rather than the other way around as with libraries. This means that a framework also have a much larger impact on how you have to structure your code.

提交回复
热议问题