我应该学习 XUL 吗?
我熟悉网络编程,包括客户端和服务器端,并且我想扩展一点我的知识,以便能够编写一些桌面程序。
我的问题是我不太熟悉管理小部件的桌面方式。据我了解,在典型的桌面程序中,小部件有自己的生命周期,相互发送信号并通过回调对信号做出反应。所以每个小部件都是一个具有很多方法的对象。这使我现在所知道的更加复杂,而且我不确定我现在是否想学习这一点。
在网络上,您通常使用标记语言(通常是 HTML 的某个版本)描述页面上的元素,并且当触发事件时,您可以使用 Javascript 修改元素。我试图了解是否有一种方法可以在桌面程序中使用网络范例。我希望能够通过标记语言描述小部件(这些将是静态的)并根据事件更改它们。如果我理解正确的话,基于 XUL 的应用程序就是这样工作的。
问题是我能找到的有关 XUL 的文档似乎有点过时了。学习 XUL 是个好主意吗?几年后我还能继续使用它吗?或者它已经成为一种旧技术了?
如果 XUL 不是一个好主意,有哪些替代方案?对于最简单的应用程序,其中小部件是静态的,或者仅稍加修改,有一些简单 工具,但是更复杂的程序又如何呢?
编辑:我应该提到我主要使用 Ubuntu,所以我需要一个独立于 Linux 或操作系统的工具。
I'm familiar with web programming, both client and server side, and I'd like to expand a bit my knowledge in order to be able to write some desktop programs.
My problem is that I'm not really familiar with the desktop way of managing widgets. As far as I understand, in a typical desktop programs, widgets have their own life, sending signals to each other and reacting to signals with callbacks. So every widget is an object with lots of methods. This adds a further complication with respect to what I know now, and I'm not sure I want to learn this at the moment.
On the web you tipically describe the elements on the page with a markup language, usually some version of HTML, and when an event is fired you modify the elements with Javascript. I'm trying to understand if there is a way to use the web paradigm in a desktop program. I'd like to be able to describe widgets via a markup language (these will be static) and alter them based on events. If I understand correctly, XUL based applications work this way.
The problem is that the documentation I can find about XUL seems a bit outdated. Is learning XUL a good idea? Can I expect to be still using it a few years from now? Or is it becoming already an old technology?
In case XUL is not a good idea, what are the alternatives? For the most simple applications, where the widgets static, or are only slightly modified, there are some easy tools, but what about a more complex program?
EDIT: I should mention I mainly use Ubuntu, so I need a linux or OS-independent tool.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
XUL 基本上提供了您所要求的内容。它与 HTML 类似,您可以使用基于标签的语言来描述界面,并且可以使用 JavaScript 进行编码。它当然用于桌面开发,包括 Firefox、Thunderbird、Songbird 和 Komodo Edit/IDE 等产品。
在桌面上运行,您将比作为 Web 应用程序运行、读写文件、甚至通过 XPCOM 运行非 JavaScript 代码拥有更多的自由。
Mozilla 开发人员中心 提供了大量最新文档。您具体寻找的是如何创建 xulrunner 应用程序 - 这是一个框架,可以让您使用 XUL 创建桌面应用程序。
人们当然可以使用 XUL 创建优秀的桌面应用程序。缺点是没有大型的开发者社区(除了 Mozilla、Songbird 和扩展开发者),并且最终没有为进入社区构建应用程序的人们提供大量支持。有一个邮件列表,还有一个 IRC 频道。挑战在于,使用 xulrunner 时会出现一些怪癖,并且在解决这些怪癖时,支持会很有限。我认为这是一个“先有鸡还是先有蛋”的问题——一个多元化的、大型的开发者社区会提供更多的支持——而更多的支持会促进社区的发展。
过去两年我一直在使用 XUL 开发产品,我仍然在争论是否会再次选择同样的道路。
我认为我们没有足够的信息来告诉您“应该[您]学习 XUL”——但是如果您需要大型社区的高水平支持,那么您应该看看@其他人提到的其他框架。如果您可以费力地阅读并且能够轻松地使用您的类型来完成它,那么它可能是一个很好的资源,并且您的网络背景可能会帮助您开始工作。如果您对 Firefox 扩展有任何兴趣,这些技能将直接转移。
由于没有强大的 Web 背景,当我尝试切换到 HTML 应用程序时,我怀念在 XUL 中布局界面是多么容易。如果您想稍微修改一下,请查看 XUL Explorer 和 XUL 元素周期表。
XUL an provide essentially what you have asked. It is similar to HTML in that you use a tag-based language to describe the interface, and you can use JavaScript for your coding. It certainly is used for desktop develop, including such products as Firefox, Thunderbird, Songbird, and Komodo Edit/IDE.
Running on the desktop, you will have more freedom than running as a web app, reading and writing files, and, through XPCOM, even running non-JavaScript code.
There is a vast quantity of pretty up-to-date documentation at the Mozilla Developer Center. What you are specifically looking for is how to create a xulrunner app - this is the framework that will let you create desktop apps using XUL.
One certainly can create good desktop apps using XUL. The downside is that there is not large developer community (outside of Mozilla, Songbird, and extension developers), and there ends up not being a lot of support for people coming into the community to build apps. There is a mailing list, and there is an IRC channel. The challenge is that there will be quirks as you use xulrunner, and there will be limited support as you work through them. It's kind of a "chicken and the egg" problem, I think - a diverse, large developer community would lend more support -- and more support would grow the community.
I have been using XUL to develop a product for the past two years, and I still debate whether or not I would choose the same path again.
I don't think we have enough information to tell you "Should [you] learn XUL" -- but if you need a high level of support from a large community, then you should look probably look @ some other framework that others have mentioned. If you can slog through and are comfortable taking your type to work through it, it can be a good resource and your web background might help you hit the ground running. If you have any interest at all in Firefox Extensions, these skills will transfer directly.
Not having a strong web background, when I try to switch to work on HTML apps, I miss how easy it is to lay out an interface in XUL. If you want to tinker a little, take a look at XUL Explorer and the XUL Periodic Table.
您可能想了解 Adobe 的 AIR 技术。它允许您使用称为 MXML 的标记语言(类似于 HTML,语法更严格)来描述 UI,并使用 ActionScript(一种类似于 JavaScript 的脚本语言)定义功能。 AIR 应用程序是独立于平台的,因为它们在 AIR 平台上运行,该平台为您抽象操作系统特定的事物。出于同样的原因,它们可能比本机应用程序相对慢 - 但这对于小型应用程序来说可能不是问题。这取决于什么对你来说更重要——运行速度还是开发速度。
AIR 的主要缺点是用户需要在其计算机上安装 AIR 平台才能安装和运行 AIR 应用程序,就像需要安装 Java 才能运行任何用 Java 编写的应用程序一样。如今,大多数平台都附带了开箱即用的 Java,但 AIR 还没有那么普遍。
关于 XUL,如果我错了,请有人纠正我,但显然它是用于描述 Mozilla 的应用程序(如 Firefox、Thunderbird 等)中的 UI 的标记语言,并用于为其应用程序开发扩展。我找不到任何关于 XUL 用于真实桌面应用程序的参考。You might want to check out Adobe's AIR technology. It lets you describe the UI using a markup language called MXML (similar to HTML, stricter syntax) and define the functions using ActionScript, a scripting language similar to JavaScript. AIR apps are platform independent as they run on AIR platform that abstracts OS specific things for you. They might be relatively slower than native apps for the same reason - but this may not be an issue for small applications. It depends on what's more important to you - running speed or development speed.
The main downside with AIR is that users need to install AIR platform on their machine to install and run AIR applications, just like you need to install Java before you can run any application written in Java. Most of the platforms come with Java out of the box nowadays, but AIR isn't that ubiquitous yet.
And about XUL, someone please correct me if I'm wrong, but apparently it is the markup language for describing UI in Mozilla's applications like Firefox, Thunderbird etc and used for developing extensions for their applications. I couldn't get any references to XUL being used for real desktop applications.如果您反对学习 C# 等内容,您可以使用 Flex 编写 AIR 应用程序。它具有标记语言,但也使用 ActionScript 进行一些实际编程。对我来说,这是编写桌面应用程序的一个很好的介绍。
If you're that opposed to learning something like C#, you could write AIR applications with Flex. It has a markup language but also uses some real programming with ActionScript. For me it was a good introduction to writing desktop applications.
我和你的处境一样。到目前为止,我已经看过
并错过了 XUL ... 嗯... XUL 的第一个优点是我可以将它用于 Firefox 插件:) 开辟了可能性。
我发现对于钛和空气来说,文档都缺乏,所以我发现很难开始。我确实是从 silverlight 开始的,但我是从 WPF 开始的。对于air,我发现它的webkit被修改为禁用一些css3功能 我喜欢使用
@font-face
和阴影 :( 失望的是,如果我使用“本机”桌面编程语言
i am in the same shoes as you. so far i have looked at
and missed out XUL ... hmm ... 1 advantage of XUL is that i can use it for Firefox addons :) opens up possibilities.
i find that for both titanium and air, the documentation is kind of lacking so i find it harder to get started. i nv really started on silverlight but i did with WPF. for air i find that its webkit is modified to disable some css3 features i'll like to use like
@font-face
and shadows :( disappointedthere are attractive advantages provided if i use a "native" desktop programming language
查看利用 XAML 的 WPF,这对您来说可能是一个不太高的学习曲线。
如果您使用 Ubuntu,您可能想看看 Mono 框架,它是 Linux 系统上的 C#。存在一种称为 Moonlight 的 XAML 形式,它可能对您有用。至少有一个您可以检查的选项!
Look into WPF, which leverages XAML, which is probably going to be a not-too high a learning curve for you.
If you're using Ubuntu, you might want to take a look at Mono framework, which is C# on Linux systems. A form of XAML exists, called Moonlight, which might be useful for you. At least an option you can examine!