What is the major difference between a framework and a toolkit? [closed]

孤者浪人 提交于 2019-11-27 20:35:46

Framework enforces some design pattern on the developer and give some tools for code generation. This sits well with my first sentence, as it generates code in a certain style/pattern.
Library gives you functionality for you to use as you wish. Like the stdio functions of C, Console of C#, The "built in" functions of PHP etc
You can regard a library as a kind of API

Quoting Martin Folwer in his article on Inversion of Control:

Inversion of Control is a key part of what makes a framework different to a library. A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.

A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.

So in short, the big difference is that your code calls a library while a framework calls your code.

In my book, a framework provides a structure and encourages or requires that it be used in a certain way. This can be good if the developer wants to do things the framework's way, since it's easier for many thing to be automatic, but it can be bad if the developer wants to deviate from the framework's intent.

A toolkit, on the other hand, provides various tools that can be used together or separately. It's more flexible but requires more effort on the programmer's behalf.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!