Frameworks vs. SDKs

2019-03-09 01:36发布

问题:

What is the difference between a framework and an SDK? Take, for example, the MS platform SDK and the .NET framework. Both have API's, both hide their inner workings, and both provide functionality that may not be quickly/easily accessible otherwise (in other words, they serve a real-world purpose).

So what's the difference? Is it primarily a marketing game of semantics, or are there actual differences in how developers are expected to interact with the software (and conversely, how the developers can expect the software to behave)? Is one expected to be higher- or lower-level than the other, etc?

Thanks!

EDIT: This question applies to SDKs and frameworks in general, not just the two mentioned above.

回答1:

An SDK is expected to offer tools to program against a certain system resource or feature. A Framework not necessarily (although .NET offers a whole set of tools such as the compilers, etc - but these are mandatory for it to work anyways).

So, you could develop a Framework consisting solely of libraries, but if you call it SDK you will be expected to offer something to support development.



回答2:

I'll just copy from Wikipedia:

Library:

A library is a collection of subroutines or classes used to develop software. Libraries contain code and data that provide services to independent programs. This allows code and data to be shared and changed in a modular fashion.

Framework:

A software framework, in computer programming, is an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code providing specific functionality. Frameworks are similar to software libraries in that they are reuseable abstractions of code wrapped in a well-defined API. Unlike libraries, however, the overall program's flow of control is not dictated by the caller, but by the framework. This inversion of control is the distinguishing feature of software frameworks.

SDK:

A software development kit (SDK or "devkit") is typically a set of development tools that allows a software engineer to create applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar platform. It may be something as simple as an application programming interface in the form of some files to interface to a particular programming language or include sophisticated hardware to communicate with a certain embedded system. Common tools include debugging aids and other utilities often presented in an IDE. SDKs also frequently include sample code and supporting technical notes or other supporting documentation to help clarify points from the primary reference material.

So:

  • Library is code that your application calls.
  • Framework is an application or library that is almost ready made. You just fill in some blank spots with your own code that the framework calls.
  • SDK is a bigger concept as it can include libraries, frameworks, documentation, tools, etc.
  • .NET is really more like a platform, not a software framework.


回答3:

In a nutshell the difference is :

  • You call the SDK functions.
  • The framework calls your functions.

A SDK is like a toolbox with lots of tools and you choose which ones you use and how. You have control but also a lot of decisions to make. That's quite low level.

A framework makes a lot of decisions for you, so you don't have to reinvent the wheel; It's more a "fill in the blanks" approach. Less freedom but you save a lot of time and probably avoid some mistakes.

In the particular case of the .NET framework it also refers to the runtime files needed to run applications using it but it's not the way the word is used in a programming context...



回答4:

It's a grey area but Frameworks tend to be the libraries you code against, SDK's often have extra tools to help you get more out of the Framework. A good example being the .NET Framework SDK which you install separately, the SDK has extra tools such as ildasm, cordb which aren't really parts of the framework.



回答5:

I was the lead on Zend Framework through its 1.0 release. We often got comments that it wasn't a "framework" in the sense that developers expected -- they said it was more of a class library.

They expected a framework is more like a set of classes that must be used together for them to work. A framework may also include a set of coding conventions, guiding you to organize your code in a certain way. Also a framework may impose naming conventions for your classes and database entities. And finally, code-generation tools.

Zend Framework was designed to be loosely coupled, so you could use any of the classes standalone if you wanted to. It imposed few conventions on your code or your database. And we had intended to develop code generators but hadn't implemented them yet.

But I still felt that Zend Framework qualified as a framework, instead of an SDK, in one other way: a framework is extensible. It's designed as a set of object-oriented base classes, and the intended usage is that developers either extend these classes, or write simple plug-in classes, to add functionality.

A traditional SDK is not extensible. You simply call API methods in the provided classes, they do what they do, and you deal with the result. Any customization is in your usage of the API and how you make use of the results.



回答6:

Microsoft SDK could be used by a developer to create their programs. Final users normally do not need it.

Microsoft Framework instead is mandatory if you want to run .NET applications on a machine.



回答7:

A class library provides classes that usually share the same rough application area (mathematics, rendering) but are intended to be used mostly independent of each other.

A framework provides classes that together form a basis for an application that you only extend and flesh out.

An SDK contains everything you'll need to use the technology the SDK is provided for. It's often containing dokumentation, samples and tools alongside the actual core-content which might be a framework or a class library or even something completely different.



回答8:

In one comparison, you could say:
Library -> Framework -> SDK
Framework consists of several Libraries, plus some tools (compilers, etc), and does not target a specific platform. For a platform, there might be several frameworks developed each serving a different purpose. SDK offers you frameworks and everything else you need for developing software for a specific platform.