框架比。 API [英] Framework Vs. API

查看:114
本文介绍了框架比。 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,这可能是一个愚蠢的问题,但有时条款框架和API可以互换使用。我看到它的方式是,一个框架是一个更大的更通用的东西,包含许多的API,能够用于各种编程任务(例如,在.NET框架。)API是更小,更特化的(例如, Facebook的API。)任何要分享对此事的独到见解?

Now, this may be a silly question but sometimes the terms Framework and API are used interchangeably. The way I see it is that a Framework is a bigger more generic thing, containing many API's, that could be used for various programming tasks (for example, the .NET Framework.) An API is smaller and more specialized (for example, the Facebook API.) Anyone want to share their insights on the matter?

和就拿微软.NET调用框架,而孙称他们的一个平台...所以它可能也是一个企业/营销决定如何称之为库的集合。

And take for instance that Microsoft call .NET a Framework whereas Sun calls theirs a Platform ... so could it be also a business/marketing decision as to how call a "collection of libraries."?

推荐答案

设计模式提供以下定义:


  • 工具包:通常,应用程序将整合类从predefined类中的一个或多个库被称为工具箱的工具包是一套旨在提供有用的,通用的功能,相关的和可重复使用的类
  • 框架:框架是一组协作类,使一个可重复使用的设计特定类软件的

这里的关键是,虽然工具包(API)的可以在许多领域有用,框架是面向通过创建的应用程序指定的子类来解决的具体的问题类,可定制的问题抽象类的框架。

The key here is that while toolkits (APIs) can be useful in many domains, frameworks are geared to solve issues for specific classes of problems, that can be customized "by creating application specific subclasses of abstract classes of the framework".

此外,也许更重要的是,框架决定了你的应用程序的体系结构:反转控制是框架的特征之一(见的 Martin Fowler的这个);而不是让您的应用程序调用特定的API来实现特定的行为,它是调用你的code的框架。

Moreover, and maybe more importantly, "the framework dictates the architecture of your application": Inversion Of Control is one of the characteristics of frameworks (see Martin Fowler on this); instead of having your application call specific APIs to implement a specific behavior, it's the framework that calls your code.

这篇关于框架比。 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆