I forgot. Why do we hate* Java?

On 2/20/06, Peter M. [email protected] wrote:

Hi Bill,

The Flex business looks like it has a nice interface. Maybe it is
Rails for Flash. I’m going to read more about it.

I bet you’ve started thinking “this Peter guy never gets anything done
on store.rb”. Well it seems like it is true but I want to build a good
product. Especially for those who have to admin the store. I don’t
want to build osCommerce or Miva for Rails.

Understandable, but they’re both pretty successful, so they can serve as
guides.

I wonder what you think of the options for building a backend.

  1. Spend the time to build the DHTML libraries necessary for a rich
    gui interface.
  2. Write a Java app that interfaces with the rails site by web services.

I’d pick 1. Must admit, I am watching Flex since it could make a
pretty powerful admin.

Yes, probably most of it is out there in the DHTML world but I’m
http://labs.macromedia.com/
Bill G. (aka aGorilla)


Bill G. (aka aGorilla)
The best answer to most questions is “it depends”.

These days, I’ve been leaning towards favoring some of the more
flexible languages/frameworks for the user-facing portions of
applications and more formal/rigid frameworks for integration with
other enterprise resources.

If we had time and budget, I’d love to redo our user interfaces with
Ruby/PHP/Ajax and have that talk to our Weblogic infrastructure, which
integrates w/ our enterprise message bus. Too many of our apps have
been J2EE front-to-back. While I appreciate the stricter typing,
well-defined framework, it also pains me to hear users complain about
how long it takes to do UI changes.

However, I haven’t quite figured out where exactly to draw the line…

architecture
already or is there still some way to go?

Best regards,

Karl

This is certainly a valid architecture. The Ruby language has a
very nice C extension library. (And having wrestled with the Perl
equivalent, I can’t stress the “very” hard enough). What you would
do is develop your C service, wrap it into a Ruby library using the
extension api, and then require ‘my_cool_library’ in your rails app.

-Derrick S.

“[The Perl source is] an interconnected mass
of livers and pancreas and lungs and little
sharp pointy things and the occasional
exploding kidney.” -Nat Torkington

Kenneth L. wrote:

how long it takes to do UI changes.

However, I haven’t quite figured out where exactly to draw the line…

I see two approaches:

  1. leave everything that is done by EJB in place and replace everything
    that is done by Servlets and JSP by Ruby and Rails. If the EJB-stuff is
    pretty static or is almost completely bound to Java for some good
    reasons
    that is the way to go.

  2. have a look at the EJBs as well. What can be done better in Ruby,
    what
    can be done better in Java, what has to be done in Java? Move some of
    that
    stuff to Ruby as well. If some parts of the business logic keep
    changing
    rapidly and these parts are not extremely performance critical, that
    might
    be a good way to go. You have to invest a lot into architecture and
    documentation
    in this case, because you do not follow the obvious line of 1.

I have to add something concerning Java:
A. I said EJB, but it does not have to be EJB. You can also use Spring,
Hybernate
or a standalone Java-App. I just assumed it is EJB in your case
already.

B. If you do a lot of numeric calculations, Java has the huge
disadvantage
of obfuscationg the code by the necessity to write
a = (b.multiply©.add(d.multiply(e))
instead of
a = bc+de
(unless you can work with Java’s primitive types). This really hurts
and
causes a lot of bugs. But you can possibly get a preprocessor for Java
that allows you to write the code in a more natural way even for
BigInteger,
Rational etc.

Derrick S. wrote:

This is certainly a valid architecture. The Ruby language has a very
nice C extension library. (And having wrestled with the Perl
equivalent, I can’t stress the “very” hard enough). What you would do
is develop your C service, wrap it into a Ruby library using the
extension api, and then require ‘my_cool_library’ in your rails app.

I have heard it multiple times and this is something that can be useful.
The restriction is that it is based on C and it is really a drawback
against
C++ for many things. I mean C++ used carefully and in a pragmatic
way
.
I want to have Strings, Hash Tables, Arrays with dynamic length and
numbers with arbitrary precision that can be used for arithmetic with
+,-,*,…
C does not provide this in a easy to use and general way. I know that
C++ can become a pain when it is done overly dogmatic by creating tons
of useless object just to be object oriented. (For being fully object
oriented
I use Ruby, not C++.) Then again, the bridge for calling C++ from C
is not trivial to my understanding. So: for small stuff or stuff
existing
in C the C-Api of Ruby is great. For bigger stuff it might be
considered
to have a look at the C/C+±bridging.

But again, this is one approach. The other one is to run the
C+±app as a daemon or service or so and to connect to it from
Ruby using Corba, RPC, XML-RPC, Soap or your homegrown
TCP/IP-communication.