ruby for desktop and web

  • Thread starter Mohammed Rashad
  • Start date
M

Mohammed Rashad

[Note: parts of this message were removed to make it a legal post.]

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

David Masover

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++.
 
R

Roger Pack

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
 
M

Mohammed Rashad

[Note: parts of this message were removed to make it a legal post.]

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
 
P

Phlip

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.

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

Phlip

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top