软件/编程框架的实际定义是什么?

发布于 2024-08-27 18:42:17 字数 210 浏览 2 评论 0原文

维基百科中的文章似乎太冗长了。

我将框架理解为一组精心设计的库和工具。 Qt 框架提供了一组用于跨平台 GUI 的库/工具。 cocoa 框架对 Mac 做了同样的事情。

软件框架的实际定义是什么?

The article in Wikipedia seems too verbose.

I understand framework as a well designed set of libraries and tools. The Qt framework provides a set of libraries/tools for cross platform GUIs. The cocoa framework does the same thing for Mac.

What's the practical definition of software framework?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

2024-09-03 18:42:17

如果您自己定义整体程序结构,但对某些操作使用预构建的构建块和原语,那么您正在使用库。

另一方面,框架为您定义了整体程序结构,使您可以在预定义的扩展点添加和扩展功能。

If you define the overall program structure yourself, but use prebuilt building blocks and primitives for some operations you are using a library.

A framework on the other hand defines the overall program structure for you, letting you add and extend functionality at predefined extension points.

对你再特殊 2024-09-03 18:42:17

看起来答案就在你的问题中。

它是一组集成的库,抽象了底层语言或体系结构的某些部分,并提供了在其设计的特定领域中常用的工具(例如,Web 框架将具有处理 HTML 的工具)。

Looks like the answer's in your question.

It's an integrated set of libraries that abstracts some parts of the underlying language or architecture and provides tools that are commonly used in the specific area for which it was designed (e.g. a web framework will have tools to deal with HTML).

分開簡單 2024-09-03 18:42:17

该定义的第一部分是我所能想象的最简洁的软件框架的定义。来自维基百科(以保存其他人浏览它):

计算机中的软件框架
编程,是一种抽象
哪些通用代码提供通用
功能可以选择性
被用户代码覆盖或专门化
提供特定的功能。
框架是一个特例
软件库,因为它们是
包装代码的可重用抽象
在一个明确定义的 API 中,但它们
包含一些关键的区分
将它们与
普通图书馆。软件框架
具有这些显着特征
将它们与图书馆分开或
普通用户应用程序:

  1. 控制反转 - 在
    框架,不像图书馆或
    普通用户应用程序,
    整个程序的控制流程是
    不是由调用者决定,而是由
    框架。[1]
  2. 默认行为 - 框架有一个
    默认行为。这个默认的
    行为实际上必须是某种
    有用的行为而不是一系列
    无操作。
  3. 可扩展性 - 框架可以
    通常由用户扩展
    选择性覆盖或专门化
    通过提供特定的用户代码
    功能
  4. 不可修改的框架代码 -
    一般来说,框架代码不是
    允许修改。用户可以
    扩展框架,但不修改
    它的代码。

The first section of that definition is about as terse as I can imagine the definition for something as vague and nebulous as a software framework could be. From Wikipedia (to save others browsing for it) :

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 a special case of
software libraries in that they are
reusable abstractions of code wrapped
in a well-defined API, yet they
contain some key distinguishing
features that separate them from
normal libraries. Software frameworks
have these distinguishing features
that separate them from libraries or
normal user applications:

  1. inversion of control - In a
    framework, unlike in libraries or
    normal user applications, the
    overall program's flow of control is
    not dictated by the caller, but by
    the framework.[1]
  2. default behavior - A framework has a
    default behavior. This default
    behavior must actually be some
    useful behavior and not a series of
    no-ops.
  3. extensibility - A framework can be
    extended by the user usually by
    selective overriding or specialized
    by user code providing specific
    functionality
  4. non-modifiable framework code - The
    framework code, in general, is not
    allowed to be modified. Users can
    extend the framework, but not modify
    its code.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文