Ruby for presentation layer, C# for business layer - how to

For reasons not relavent, I would like to create an n-tier app as
follows.

Data Acess layer => NHibernate

Business layer => C#

Presentation layer => RoR

All of which might be spread across multiple machines in each layer.

I am looking for the best way to allow RoR to talk to my business layer,
dll’s etc hosted on another box.

The RoR box might be *nix \ apache or windows \ IIS \ Apache.

The C# box might be mono \ *nix or .net clr \ windows.

My immediate thought was web services to perform the execution of data
access and business processes, but is there a better way ?

Can I instanciate remote c# objects from RoR ?

Can I get an array of data returned from c# dll ?

Many thanks for any advice

BOb

Beggars the question why?
(I’m assuming you already have a legacy .NET/NHibernate back-end you
want to use otherwise this looks like a fine can of worms to open. Why
complicate matters with multiple environments when RoR (and .NET
actually but not as fast or fun) will do it all for you?)

Nicholas

We were thinking that compiled dll’s and .net will be faster than
interpreted RoR \ Ruby and also we have much more experience of C# than
Ruby \ RoR.

We dont like asp.net and the .net code behind style of web development.

Do you really think that Ruby can compete with C# in terms of speed and
breadth of functionality when used to write busines classes.

I am in the process of redesigning a VB6 windows app with 150 tables

500k LOC into a modern n-tier browser based app.

BOb

ntollervey wrote:

Beggars the question why?
(I’m assuming you already have a legacy .NET/NHibernate back-end you
want to use otherwise this looks like a fine can of worms to open. Why
complicate matters with multiple environments when RoR (and .NET
actually but not as fast or fun) will do it all for you?)

Nicholas

BOb,

When run in production mode using apache etc… your rails application
will be started as several threads at a point like the Application_Start
event in .NET. Only in development and testing mode is the Rails
application continuously re-interpreted for each request. There are lots
of good blog posts and articles about RoR performance and enhancements
thereof (caching being the first thing to come to mind) floating around
the Internet.

With regard to business-classes, you already have a head start with
Active-Record. Extend these classes to include whatever “additional”
functionality you require. But, as is usually the case with RoR, someone
has thought of this already and there are all sorts of mix-ins and built
in methods that will let you extend active-record to suit your
requirements. As a professional C# dev (by day, RoR by night :slight_smile: ) I’d
say active-record beats faffing about with ADO (nice though ADO is) and
really does save time.

Hope this helps,

Nicholas

BOb wrote:

access and business processes, but is there a better way ?
If you find a better way, I’d be interested in hearing about it. I
currently have
an app running like this:

RoR --SOAP--> C# --Proprietary Assembly--> Proprietary Data Store

I briefly looked at embedding Mono as a Ruby extension so I could try to
load the assembly and talk directly to the data store; but, didn’t think
it
was worth the effort since I don’t know how to use the proprietary API
anyways.

The setup as is works pretty well from the RoR end of things; I had to
do more work on my model, since I lose ActiveRecord’s magic. But, it
was actually much easier than I anticipated to do so. I mimicked
ActiveRecord’s methods in my SOAP model and was able to hook my
view and controller up to a MySQL model to make it easier for testing
and development and then back to the SOAP model for production.

(Actually production is currently running on the MySQL backend
because,) The only problem so far is that the webservice was very
slow once it actually had more than a few records. Next week we should
have an updated web service deployed that, I’m told, is orders of
magnitude faster.

Take a look at John L.'s RubyCLR bridge. It’s windows only, but combine
that with Ruby DRB and you may have a way to use .NET’s remoting w/
Ruby.

Note it’s still under very heavy development, so it may not be robust
enough
for your needs.

I haven’t done this with .NET, but you might investigate lightweight
technologies like JSON, Hessian, Burlap, etc. as alternatives to SOAP
for communicating between the layers.

dean


Dean W.
http://www.aspectprogramming.com
http://www.newaspects.com
http://www.contract4j.org