链接 Cocoa 桌面应用程序和RubyonRails 网站
我正在开发一个工具,它将包含一个中央网站和一个桌面应用程序。我之前只真正完成过完全在线开发,或完全离线/客户端开发,并且实际上不必将两者联系起来。我可以在如何将数据传入/传出在线网站和网站方面使用一些帮助。桌面应用程序。
桌面应用程序需要进行通信和通信对 iTunes 进行一些控制,所以最初我在 OSX 和 Mac 上的 Cocoa 中构建它。利用 ScriptingBridge 框架。
在网站方面,我正在考虑使用 Ruby on Rails,将数据存储在 mySQL 数据库中,因为我相当熟悉 &看起来很适合它要做的在线工作。 (但如果有更好的方法,请接受其他建议!)
我正在努力寻找在 Cocoa 应用程序和 Cocoa 应用程序之间轻松传输数据的最佳方法。在线 Rails 数据库 - 有没有一种简单的方法可以让 Cocoa 应用程序直接访问在线数据库,或者通常是将一些 XML 转储到网络服务器上并让应用程序读取它?
I'm developing a tool that will comprise a central website and a desktop application. I've only really done entirely online developent, or entirely offline/client-side development before and not really had to link the two. I could use some help in how to approach passing data to/from the online site & desktop app.
The desktop app needs to communicate & do some control of iTunes, so initially I'm building this in Cocoa on OSX & making use of the ScriptingBridge framework.
On the website side I'm thinking of using Ruby on Rails, with data stored in a mySQL database, as I'm fairly familiar & seems like a good match for the online job it has to do. (But open to other suggestions if there's a better approach!)
I'm struggling to find the best approach to easily transfer data between the Cocoa app & the online rails database - is there a simple way of having the Cocoa app access the online database directly, or is it typical to dump some XML onto the webserver and have the app read that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 RoR 系统上打开 RESTful API 非常简单。让您的桌面应用程序使用 JSON 或 XML 与该 API 进行通信。
使用 JSON 而不是 XML 的优点:(1) 在 Rails 中操作极其简单 (2) 在 Javascript 中使用极其简单,如果除了桌面客户端之外还需要构建 Web 客户端。
让桌面应用程序直接与远程数据库通信是一个非常坏主意。两个主要原因:
安全。这样的设置只会招致黑客攻击。有些数据库是“为网络构建的”(我想到的是 CouchDB),在这里可以使用,但 MySQL 则不然。
灵活性。对于现场的桌面应用程序,进行更改并将其分发给所有客户端是很困难的。如果需要更改架构,Web 应用程序层通常允许您保持与桌面客户端的界面稳定。
Opening a RESTful API on your RoR system is as simple as you can get. Have your desktop app communicate with that API using JSON or XML.
Advantages to using JSON rather than XML: (1) extremely simple to manipulate in Rails (2) extremely simple to work with in Javascript, should the need arise to build a web client in addition to the desktop one.
It's a very bad idea to have the desktop app communicate directly with your remote database. Two main reasons:
Security. Such a setup just begs to be hacked. Some databases are "built for the web" (CouchDB comes to mind) and would be alright here, but MySQL isn't.
Flexibility. With desktop application in the field, making changes and distributing them to all clients is hard. Should the need arise to change your schema, the web application layer frequently allows you to keep the interface with the desktop clients stable.