What is the difference between a class library and a framework

后端 未结 11 2061
别那么骄傲
别那么骄傲 2020-12-01 13:04

I hear the whole day the terms class library, base class library, Framework, ...
What highlights a framework and what a base class library?

11条回答
  •  生来不讨喜
    2020-12-01 13:24

    A class library usually is a DLL or a packet of classes that you can "include"/"reference" into your solution and reuse.

    A framework is usually a recurring pattern/solution targeted towards a specific context e.g. a GUI Framework. A framework more than often implies that you write certain pieces as dictated by the framework designers, slot them in the expected/correct places and it should work.

    • e.g. Spring is a framework for DI. You write xml files in a format dictated by the designers and then the framework allows you to obtain assembled classes without having to worry about the framework does it.
    • Rails is a framework in Ruby for RAD web-apps. You only write the models, controllers and views and you have a working web app in under an hour.
    • the BCL is a set of class libraries so that you don't have to implement data structures and frequently used types in .NET and just get the tested proven implementations for free by just including them.

    A framework usually contains multiple class libraries. As always, the terms are used in an ambiguous manner nowadays.. but the above represents the more common interpretation of the terms... mine atleast :)

提交回复
热议问题