什么是如果你想创建一个模块化的应用程序最好的资源? [英] What are the best resources if you wanted to create an application with modularization?

查看:148
本文介绍了什么是如果你想创建一个模块化的应用程序最好的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的新网络平台/应用程序,如Drupal的,字preSS,和Salesforce,分析其中不乏创建基于模块化的概念,他们的软件:开发人员可以在无需创建新的扩展和应用改变code由主要开发维护的核心系统。特别是,我知道Drupal使用一个钩系统,但我不知道很多关于实现它的发动机和设计。

In my analysis of the newer web platforms/applications, such as Drupal, Wordpress, and Salesforce, many of them create their software based on the concept of modularization: Where developers can create new extensions and applications without needing to change code in the "core" system maintained by the lead developers. In particular, I know Drupal uses a "hook" system, but I don't know much about the engine or design that implements it.

如果你要下去创建应用程序的路径,你想要一个允许模块化的系统,你在哪里开始呢?这是一个特殊的设计模式每个人都知道?是否有一个手册,这个范式往往订阅?是他们任何的网站从地面行动讨论这种类型的开发?

If you were to go down a path of creating an application and you wanted a system that allowed for modularization, where do you start? Is this a particular design pattern that everyone knows about? Is there a handbook that this paradigm tends to subscribe to? Are their any websites that discuss this type of development from the ground-up?

我知道有些人直接指向OOP,但似乎并没有被同样的事情,完全是。

I know some people point directly to OOP, but that doesn't seem to be the same thing, entirely.

我打算这个特定的系统倾斜更倾向于类似Salesforce的,但它不是一个CRM系统。

This particular system I'm planning leans more towards something like Salesforce, but it is not a CRM system.

有关问题的缘故,请忽略了购买与构建参数,因为这要考虑的是已经在工作。现在,我研究了构建方面。

For the sake of the question, please ignore the Buy vs. Build argument, as that consideration is already in the works. Right now, I'm researching the build aspect.

推荐答案

有两种方式去在这里,采取哪一种取决于如何将您的软件运行。

There are two ways to go around here, which one to take depends on how will your software behave.

一种方法是插件路线,人们可以在那里的安装新的code 到应用程序中修改相关方面。这条路线需要您的应用程序安装,而不是只提供作为一种服务(或者您安装和审查code发送的第三方,一场噩梦)。

One way is the plugin route, where people can install new code into the application modifying the relevant aspects. This route demands your application is installable and not only offered as a service (or else that you install and review code sent in by third parties, a nightmare).

另一种方式是提供一个 API ,这可以通过< STRONG>由相关各方称为,使应用控制转移到位于别处code(一拉Facebook应用程序),或使应用程序执行的API命令使开发人员(一拉谷歌地图)

The other way is to offer an API, which can be called by the relevant parties and make the application transfer control to code located elsewhere (a la Facebook apps) or make the application to do as the API commands enable the developer (a la Google Maps).

尽管机制各不相同,如何真正落实他们不同,你必须在任何情况下,定义

Even though the mechanisms vary and how to actually implement them differ, you have to, in any case, define


  • 什么自由将让我的用户有哪些?

  • 将我提供什么样的服务,为程序员定制应用程序?

和最重要的事情:


  • 如何启用这在我的code,同时保持安全和可靠。这通常是通过沙箱的code,验证输入和潜在提供有限的能力对用户进行。

在此背景下,挂钩在code调用所有注册插件'钩子函数,如果定义了predefined的地方,修改应用程序的标准行为。例如,如果你有一个呈现一个背景功能,可以

In this context, hooks are predefined places in the code that call all the registered plugins' hook function, if defined, modifying the standard behavior of the application. For example, if you have a function that renders a background you can have

function renderBackground() {
    foreach (Plugin p in getRegisteredPlugins()) {
        if (p.rendersBackground) p.renderBackground();
    }
    //Standard background code if nothing got executed (or it still runs, 
    //according to needs)
}

在这种情况下,你有'renderBackground'钩子插件可以实现改变的背景。

In this case you have the 'renderBackground' hook that plugins can implement to change the background.

在一个API的方式,用户应用程序会打电话给你的服务来获取呈现的背景

In an API way, the user application would call your service to get the background rendered

//other code
Background b = Salesforce2.AjaxRequest('getBackground',RGB(255,10,0));
//the app now has the result of calling you

这是一切也与好莱坞原则,这是应用好事,但有时它只是不实际的。

This is all also related to the Hollywood principle, which is a good thing to apply, but sometimes it's just not practical.

这篇关于什么是如果你想创建一个模块化的应用程序最好的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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