Framework Vs. API

前端 未结 12 1043
隐瞒了意图╮
隐瞒了意图╮ 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:19

    A framework does introduce the notion of inversion of control
    (i.e. the overall program's flow of control is not dictated by the caller, but by the framework)

    When you are referring to language frameworks (such as Java Framework or .Net Framework), you actually including more than just libraries and their APIs (which would be more limited a Software Framework if those libraries provide an inversion of control).

    A Language Framework includes the development and execution environments which will call your code (to compile it or to execute it).
    That is why .Net Framework is a "Framework".


    Java may refer to its Frameworks (JDK, JRE) as a "Java Platform" in order to emphasize its "platform independent" programming language feature.

    From About the Java Technology

    A platform is the hardware or software environment in which a program runs. (including Microsoft Windows, Linux, Solaris OS, and Mac OS).
    Most platforms can be described as a combination of the operating system and underlying hardware.
    The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.

    The Java platform has two components:

    • The Java Virtual Machine
    • The Java Application Programming Interface (API)

    Java Platform

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

    From my understanding, an API is basically a way of interfacing with an existing app (like Facebook), whereas a framework is basically a tool for building your own app from the ground up.

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

    Design Patterns provide the following definitions:

    • toolkits: "often an application will incorporate classes from one or more libraries of predefined classes called toolkits. A toolkit is a set of related and reusable classes designed to provide useful, general-purpose functionality".
    • frameworks: "a framework is a set of cooperating classes that make up a reusable design for a specific class of software".

    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".

    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.

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

    I've always thought the framework was the whole thing, internal code, API's, etc.

    While the API is just the bit you use when you want to make use of the framework.

    In other words, the .NET framework consists of the .NET libraries, all the languages and so on. The API is just the way you call the functions.

    0 讨论(0)
  • 2020-12-04 08:26
    • Software Framework: Is a re-usable design for a software system (or subsystem). A software framework may include programs, code libraries, a scripting language, other software to help develop and glue together the different components of a software project. Various parts of the framework maybe exposed through an API.

    • API (Application Programming Interface): Is a set of routines( AKA methods, functions), data structures, object classes, and/or protocols provided by libraries and/or operating system services in order to support the building of applications.
      More details along with other Link to this particular topic is http://aprogrammersday.blogspot.com/2009/02/difference-between-framework-and-api.html
    0 讨论(0)
  • 2020-12-04 08:28

    As its name suggests (Application Programming Interface) the API is just the interface of the framework.

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