Forum: Ruby on Rails Scaleability and Sharing of code between apps

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Chris (Guest)
on 2006-01-09 12:39
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
E48d29dc8fedb2878fa518d41cc63d88?d=identicon&s=25 Jan Prill (Guest)
on 2006-01-09 13:05
(Received via mailing list)
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 http://wiki.rubyonrails.com/rails/pages/EdgeRails 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
75da740d43c5780539214f24ce1148a6?d=identicon&s=25 Jean Helou (Guest)
on 2006-01-09 13:53
(Received via mailing list)
On 1/9/06, Chris <evilgeenius@gmail.com> 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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-09 14:17
(Received via mailing list)
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
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Chris (Guest)
on 2006-01-09 16:07
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.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-09 16:51
(Received via mailing list)
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
Cd8c9864d88bcafc164d8fdb820cc451?d=identicon&s=25 Chris (Guest)
on 2006-01-09 17:05
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
2f46d76f0e5db4dc318b03be07ebaac4?d=identicon&s=25 Tom Ward (Guest)
on 2006-01-09 17:49
(Received via mailing list)
> 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 Ward
675475d0b65710be6d992eb5eb2c61c2?d=identicon&s=25 Gregory Seidman (Guest)
on 2006-01-09 17:52
(Received via mailing list)
On Mon, Jan 09, 2006 at 01:50:42PM +0100, Jean Helou wrote:
} On 1/9/06, Chris <evilgeenius@gmail.com> 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
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-09 17:58
(Received via mailing list)
On Jan 9, 2006, at 7:48 AM, James Adam 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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-09 18:07
(Received via mailing list)
On 1/9/06, Chris <evilgeenius@gmail.com> 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
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2006-01-09 18:07
(Received via mailing list)
>         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
This topic is locked and can not be replied to.