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 ¨Âí¬ Íïèáííåä Òáóèáä ¼íïèáííåäòáóèá®®®Àçíáéì®ãïí¾ ÷òïôåº

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

--
  Phlip