Framework Vs. API

前端 未结 12 1029
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 08:04

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, co

相关标签:
12条回答
  • 2020-12-04 08:30

    I'd like to think that an API is a subset of a framework

    0 讨论(0)
  • 2020-12-04 08:30

    I know this is an old thread and that it really doesn't matter, but I just can't help but to chime in with my own views. An API (e.g. device driver API, Windows API, etc.) provides the basic and essential functions for a platform such that a programmer can exercise his creativity and do something with the platform - yes, including using it to build a framework. A framework is higher level in function and abstraction, and provide a set of reusable and convenient functions/classes/conventions to facilitate the development of applications that share certain common attributes (e.g. iPad apps, web services, etc.)

    0 讨论(0)
  • 2020-12-04 08:32

    A framework implements a very important option called IoC (Inversion of Control) which means in a nutshell that your code has, no more, things in hand.

    While in an API your code calls other codes (libraries), when you use a specific framework, it's the framework who is in control of the application flows.

    0 讨论(0)
  • 2020-12-04 08:35

    In my experience, a framework often includes two things (at least) that an simple API doesn't:

    • Extensibility: you can compose or subclass framework components to extend or customize its functionality.

    • Tools for code-generation, administration, or diagnostic tasks related to application development.

    0 讨论(0)
  • API (application programming interface): like his name means, is an interface for externe programs to interact with your inter program or library without having direct access. for example, the google map API and Facebook API give you the interface to interact with their program and library without having direct access.

    In the other hand:

    Framework : is a collection of libraries that can help you to build an application. you can imagine the framework as a "skeleton" where the application defines the "meat", so you can't take a human skeleton to build a hors body, so you have to choose the good framework before start programing. this is why we said : You call Library. Framework calls you.

    0 讨论(0)
  • 2020-12-04 08:42

    A framework is basically a collection of classes that abstract away the development process and promote code reuse for example you might have database, session, and pagination classes that are independent of the application you are building. But an API is source code interface that allows two or more components of different systems to interact, for example adding the Google Maps API to your website, you and Google are two different systems, Google coded the underlying interface for incorporating its products to your website/application. All in all just go with a framework work when building your system, then develop an API when you offer extensions for other people like Facebook and Google.

    0 讨论(0)
提交回复
热议问题