多个应用程序共享相同的代码库

发布于 2024-10-09 13:01:26 字数 65 浏览 5 评论 0原文

我有一个代码库,将被多个应用程序使用。

什么技术可以促进这一需求(服务层?)?

谢谢

I have a codebase, which will be used by several applications.

What techniques would facilitate this requirement (service layer?)?

Thanks

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

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

发布评论

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

评论(2

×纯※雪 2024-10-16 13:01:27

这通常可以通过以下两种模式之一来解决:库或框架。

使用库,可以分解出公共代码并将其放入专用库中。这些库由实际应用程序使用。在库场景中,应用程序提供启动、初始化和协调程序逻辑的逻辑,用简单的 C 术语来说:main() 函数。应用程序特定代码调用库函数。

使用框架,人们基本上可以构建一个完全可运行的应用程序,通过将程序逻辑挂接到框架中来扩展或定制该应用程序。框架通常提供启动、初始化和协调程序逻辑的逻辑,自定义代码由框架代码调用。

使用两者中的哪一个取决于场景和投入的努力。库比框架更容易构建,但是如果框架工作做得好,代码重用就会更好。

This is commonly solved with one of two patterns: library or framework.

Using libraries, one factors out the common code and puts it in dedicated libraries. These libraries are used by actual applications. In the library scenario the application provides the logic for starting, initializing and coordinating the program logic, in simple C terms: the main() function. The application specific code calls library functions.

With a framework, one basically builds a completely runnable application which is extended or customized by hooking program logic into the framework. A framework typlically provides the logic for starting, initializing and coordinating the program logic, the custom code gets called by the framework code.

Which of both to use depends on the scenario and the effort to put into. Libraries are much easier to build than frameworks but with frame works done well, code re-use is much better.

究竟谁懂我的在乎 2024-10-16 13:01:26

我不明白你的实际问题是什么,但我可以告诉你,服务层不太可能是你想要的。

服务层将提供系统之间的通信(包括构建在不同平台上的系统);基于消息传递的方法也可以在系统(应用程序)内的组件或层之间使用。在这两种情况下,共享全部或部分代码库都不是必需的。

<块引用>

我有一个代码库,将由多个应用程序使用。

拥有代码库还是即将拥有? “Will”意味着你还没有到达那里。

<块引用>

什么技术可以满足这一要求?

具体什么要求?如果您的意思是“将会有”,那么我猜您正在寻找编写可由多个应用程序重用的代码的指南?

给我们更多信息,我将扩展我的答案:)

I don't see what your actual question is, but I can tell you that a Service Layer is unlikely to be what you're after.

A service layer will provide communication between systems (including ones that are built on different platforms); and a messaging based approach can also be used between components or layers within a system (application). Sharing all or part of a code-base is not a requirement in either of these scenarios.

I have a codebase, which will be used by several applications.

You have a codebase or you're going to have? "Will" infers you're not there yet.

What techniques would facilitate this requirement?

What requirement exactly? If you meant "going to have" then I guess you're after guidelines on writing code that can be re-used by several applications?

Give us some more info and I'll expand my answer :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文