Ruby for desktop and web

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.?

[email protected] 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.

Unfortunately ruby doesn’t run “natively” in the browser. So if you
want to re-use the exact same code as desktop app and ruby app, you
can either “run a rails app locally and use its web interface” (then
use the same rails app on the web), or use jruby and “java web start”
to have the same program run locally and remotely.

Also related is the (non-ruby) GWT.
Cheers!
-r

On Sunday, September 05, 2010 08:29:36 am Mohammed R. 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++.

Firstly, the most important detail for reuse is unit tests. They allow
your code to change even if it is reused, because the tests for one
usage will defend it while you change the code to fit another use.

On Sep 7, 7:06 am, Mohammed R. [email protected] wrote:

Can I use M-V-C architecture keeping Model and controller common for both
web and desktop and changing view only

For desktop (using c++/ruby) need to fix it because I want to know that Can
I use the same ruby class which are abstract for both web and desktop

Model
Controller
desktop-view (using c++ and FOX)

There are plenty of Ruby desktop views, such as RubyQt, which solve
many of those problems for you. I don’t think C++ and FOX will be
gentle with you.

For Web
Model
Controller
web-view

If you use Ruby on Rails, you can borrow its Models and much of its
Controllers for the desktop. Consider this rubric:

  • smart models
  • thin controllers
  • dumb views

You need models that perform all their algorithms and transactions
isolated from their view. RoR tends to specialize in this division of
labor.

However, RoR Controllers only control RoR views, so you must push more
logic down, into a “Representation Layer”, which is model methods that
behave like controllers. Then your Desktop and Web controllers
themselves would be extremely thin.

Can I use M-V-C architecture keeping Model and controller common for
both
web and desktop and changing view only

For desktop (using c++/ruby) need to fix it because I want to know that
Can
I use the same ruby class which are abstract for both web and desktop

Model
Controller
desktop-view (using c++ and FOX)

For Web
Model
Controller
web-view

There are plenty of Ruby desktop views, such as RubyQt, which solve
many of those problems for you. I don’t think C++ and FOX will be
gentle with you.

OMG I read “FOX DB”. Fox Windows is something else entirely; of course
you should use it, and hands off the C++ inside!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs