From: David Masover Date: 2010-09-06T00:53:17+09:00 Subject: Re: ruby for desktop and web On Sunday, September 05, 2010 08:29:36 am Mohammed Rashad wrote: > I need to develop a application which can be used in desktop environment > and web environment. The code/core classes written for desktop version > must be reused for the web also. code REUSE is a must property. > > I had two option > > 1. To use C++ for desktop and ruby for web. > Using a library/interface/extension to access the cpp code on web (dont > know about the package needed) > > second option > use ruby for web and desktop > So will it be easier to use/reuse (inherit) the classes wrtitten for > desktop version by the web page written in ruby.? What was the question? If code reuse is your only priority, you haven't actually provided enough information to choose one or the other. If readability, efficiency of coding, and maintainability are priorities, you might consider Ruby for web/desktop, and you have all sorts of options for doing the desktop version. Depending on your users, the easiest might be something like Rawr: http://rawr.rubyforge.org/ If raw speed on the desktop is an issue, you might use C++. But chances are very good that it isn't. You can be "fast enough" quite easily, and the difference between "slow" and "fast enough" is almost always choice of algorithm and program structure, and not choice of language. It might not be as much of a consideration as you'd think, though. Using something like Rails, you can create a very good REST API, and pretty much every language has good support for the ideas of REST -- especially since the minimum needed is just good HTTP support. You'd have to describe your app in much more detail, but unless the web app and the desktop app are providing duplicate functionality, I don't know why they'd need to share much code -- unless the desktop app needs to work offline, it could simply be a different UI that ultimately results in the same model operations on the server. By the same token, if you don't need it to work offline, chances are you could produce a Web app which works as well as any desktop app would. Then you'd be using Ruby and JavaScript, but not C++.