Scaleability and Sharing of code between apps

Application 1 is an auditing application called AuditSystem.
Application 2 is a quality control appllication called QC.

App1 has a couple of classes, including models, that i would like to use
with App2. I would like a change in a class to be felt in both
applications. How do i acheive this without copying and pasting code??
At the moment im feeling i should have made the whole thing one
application, but that would be wrong.

Also is it true that 2 applications have to be hosted on 2 different
servers??

Thanks for any help, i really need it.
Chris

Hi, Chris,

some thoughts:

You might make your code a plugin
(http://wiki.rubyonrails.org/rails/pages/HowTosPlugins). If you are
using svn for your project and you decide to use a plugin design and are
using subversion as version control the power of svn:externals as
described in Peak Obsession might
come in handy. Updating the trunk of every project using your plugin is
then a matter of ‘svn up’.

If your code might be useful on other ruby projects you should consider
making it a gem: http://docs.rubygems.org/read/book/1

Regards
Jan

On 1/9/06, Chris [email protected] wrote:

[…]
App1 has a couple of classes, including models, that i would like to use
with App2. I would like a change in a class to be felt in both
applications. How do i acheive this without copying and pasting code??
At the moment im feeling i should have made the whole thing one
application, but that would be wrong.

Once upon a time, there was something called “Poductize” which enabled
you to do exactly this. Last time I checked it (had become||was
replaced by) an engine.

Also is it true that 2 applications have to be hosted on 2 different
servers??
On a shared host (pendrell.textdriven.com) I (along with many others
no doubt) have at least 3 rails app served by the same lighttpd
process. So I guess the answer to this is : not true.

Jean

Engines are more like ‘super-plugins’, and provided a sort of
‘inverted’ version of Productize. In a nutshell, if you want to share
views and controllers as well as models, you might want to use an
engine:

http://rails-engines.org/wiki/pages/When+To+Create+An+Engine

  • james

Geez… who would have thought that you had to mess around with engines
and the like just to share code?? thats 1 thing thats easier in java.

I suppose this is why ROR is sometimes said to be not very scalable?

Any comments on this?

I NEED to convince my boss that ROR is scalable (in terms of size not
number of hits). Any ideas what i can say? I write enterprise
(debateable) software for our organisation.

James,

What is it about engines/plugins that makes it harder than ‘in java’?
I’d love to hear your audible sigh qualified.

This is the kind of answer i was hoping for. I should have asked “are
engines messy?”

James what do you qualify as an enterprise setting?

Thanks,
Chris

What is it about engines/plugins that makes it harder than ‘in java’?
I’d love to hear your audible sigh qualified.

FYI, we are using RoR (and Engines) as part of a 7-person team in an
‘enterprise’ setting, with great success, and very little messing
around.

  • james

Geez… who would have thought that you had to mess around with engines
and the like just to share code?? thats 1 thing thats easier in java.

Coming from a java background, I don’t find code sharing harder in
Rails than J2EE. Using plugins to share library code scales very
well, right from a few shared methods up to large code libraries.
Certainly no more difficult than using jars.

If you want to share more than just ruby code (including controllers
and views), then as James says, engines provide a sort of ‘super
plugin’ system. I don’t know of any equivalent facility in J2EE.

I suppose this is why ROR is sometimes said to be not very scalable?
Any comments on this?
I NEED to convince my boss that ROR is scalable (in terms of size not
number of hits). Any ideas what i can say? I write enterprise
(debateable) software for our organisation.

Rails tries as hard as possible to be as concise as possible, so you
never have to write more code than you need. This results in far less
code for the same functionality as you’d write in J2EE (rough
estimate, less than half the code). Less code = less maintainance.

Rails also makes it extremely easy to write both unit and functional
tests, building confidence into your code as your application gets
larger.

Tom W.

On Jan 9, 2006, at 7:48 AM, James A. wrote:

Geez… who would have thought that you had to mess around with

If you need to share models across apps and they are on the same

server why not take the simple route and use symlinks or
svn:externals. I am doing this to share a base set of models over 4
apps myself and it works great.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

On Mon, Jan 09, 2006 at 01:50:42PM +0100, Jean H. wrote:
} On 1/9/06, Chris [email protected] wrote:
} >[…]
} > App1 has a couple of classes, including models, that i would like to
use
} > with App2. I would like a change in a class to be felt in both
} > applications. How do i acheive this without copying and pasting
code??
} > At the moment im feeling i should have made the whole thing one
} > application, but that would be wrong.
}
} Once upon a time, there was something called “Poductize” which enabled
} you to do exactly this. Last time I checked it (had become||was
} replaced by) an engine.
}
} > Also is it true that 2 applications have to be hosted on 2 different
} > servers??
} On a shared host (pendrell.textdriven.com) I (along with many others
} no doubt) have at least 3 rails app served by the same lighttpd
} process. So I guess the answer to this is : not true.

Even more to the point, I have a Rails app running from a path on my
main
Apache2 server. I could have any number of Rails apps running from other
paths without the need for virtual hosts or anything.

} Jean
–Greg

On 1/9/06, Chris [email protected] wrote:

This is the kind of answer i was hoping for. I should have asked “are
engines messy?”

Your best introduction would be here: http://rails-engines.org; more
documentation is going up there as time allows. Also in particular,
the README for the engines plugin:
http://api.rails-engines.org/engines/.

Please read the original link I posted for clarification about when
engines are more suitable than, say, generators or plugins, because as
Ezra pointed out, if you only want to share model code SVN externals
are fine, and basic plugins are adequate for keeping those shared
files in a container.

What I qualify as an enterprise setting:

  • client-focused development (as opposed to, say, web 2.0
    personal-user-centric sites)
  • many developers working with version control and QA
  • james
    If you need to share models across apps and they are on the same

server why not take the simple route and use symlinks or
svn:externals. I am doing this to share a base set of models over 4
apps myself and it works great.

I think the advantage of this is that your app still feels like a
‘rails’ app. I tried developing with engines on a serious app, but I
really didnt like the way it split up my models and controllers.
Views, however, are a different story. I think if you absolutely
need that, maybe Engines are better.

Do what feels right to you though.


rick
http://techno-weenie.net