Musings on an Erlang GUI System.

Niclas Eklund Niclas.Eklund@REDACTED
Mon Feb 17 15:04:39 CET 2003



Hello!

Is it complex to use CORBA? Let's compare a gen_server and CORBA
implementation.

I assume that most users would encapsulate the gen_server operations. I.e.
implement something like:

%% my_server.erl
start(Env) ->
   gen_server:start(?MODULE, Env, []).
start_link(Env) ->
   gen_server:start_link(?MODULE, Env, []).
stop(Ref) ->
   gen_server:call(Ref, stop).

foo(Ref, Arg1, ..., ArgN) ->
   gen_server:call(Ref, {foo, [Arg1, ..., ArgN]}).
foo(Ref, Arg1, ..., ArgN, Timeout) ->
   gen_server:call(Ref, {foo, [Arg1, ..., ArgN]}, Timeout).

handle_call({foo, [Arg1, ..., ArgN]}) ->
   my_server_callback:foo(Arg1, .., ArgN);
handle_call(stop) ->  
   {stop, normal, ok, State}


The above is automated by the IDL compiler. On the other hand, the
user must write the IDL specification, but that requires less work:

module my {
  interface server {
     void foo(in <type> Arg1, .., in <type> ArgN);
  };
};

The implementation of the call-back modules is similar. Hence, not shown
here.

erl> {ok, Ref} = my_server:start([]).
erl> my_server:foo(Ref, Arg1, .., ArgN).
erl> my_server:stop(Ref).

erl> Obj = my_server:oe_create([]).
erl> my_server:foo(Obj, Arg1, .., ArgN).
erl> corba:dispose(Obj).

When using Orber it's also possible to activate typechecks for local
invocations and IIOP-tracers during tests/debugging.

 -"But what about, for example, Erlang<->Java/C++?"

For CORBA, simply use the other ORB's IDL compiler and implement
the "call-back module". For non-CORBA implementations one can, for
example, use Jinterface or Erl_interface. The complexity is, IMHO,
roughly the same.

Java "Hello World" example:
http://java.sun.com/j2se/1.4/docs/guide/idl/jidlExample2.html

Available CORBA Language Mappings http://www.puder.org/corba/matrix/


/Niclas



> >   I saw freso a while ago - IMHO fresco has the right architecture but the
> > *wrong* transport medium - CORBA for the transport of data between the
> > client and server will give a large performance hit and adds an incredable
> > amount of unecessary complexity - If the'd just have erlang terms or lisp
> > S-expressions or UBF to communicate it would be great.
> 
> Actually I don't see why CORBA need be a performance hit: the Internet
> Inter-Orb Protocol (IIOP) it uses is just a pretty-efficient binary
> protocol over TCP sockets. It *should* even be a little more efficient
> than e.g. Erlang, since IIRC the type information is agreed at both
> ends and doesn't have to be included in the messages.
> 
> I think the real CORBA performance trap is to end up doing too many
> RPCs, by choosing protocols based on traditional local-objects
> programming style instead of more coarse grained IETF-style network
> protocols. There is a nice paper about this phenomenon called "A Note
> on Distributed Computing":
> http://research.sun.com/techrep/1994/abstract-29.html
> 
> The CORBA complexity hit is probably the real problem!
> 
> Cheers,
> Luke







More information about the erlang-questions mailing list