Issues other than speed of execution in calling Java code from Jython or Scala
I am using neo4j as backend in my project. For frontend,I dont want to do it in java as I am feeling too restricted in it. I am consider 2 options which are a) Use Jython/Django as I can call my java code in it. So that I can simply provide a good API of my database code and call it. b) Use Scala/Lift as do same as mentioned in above.
The only downside to this which I can think of now is it may be slow as calling one language from another and this can be a factor in scalability. I would like advise on what other issues can be there 开发者_开发百科which can affect my project or this slowness alone can affect a lot? If too many then I would have to move to java only as neo4j suits perfectly to the project
P.S I am not inclined to any language.Ready to do it in any and I am not opting for Java not because I dont like but the thing is I am not sure about it because of cost factors and learning curve.Any advise on that would be cool.
My vote would be on Scala/Lift since they are a more natural fit for each other. I am not too familiar with the Jython/Django integration - but Django is written in pure Python so there might be overhead in interfacing between the two. With your Scala/Lift solution you use Scala for front and middle tier and it compiles down to Java byte code, which fits seamlessly with your neo4j database layer.
Here's the decompiled code of a Java and a Scala program calling method method
on a class X
, just instantiated:
public void callX();
Code:
0: new #2; //class X
3: dup
4: invokespecial #3; //Method X."<init>":()V
7: astore_1
8: aload_1
9: invokevirtual #4; //Method X.method:()V
12: return
}
public void callX();
Code:
0: new #7; //class X
3: dup
4: invokespecial #11; //Method X."<init>":()V
7: astore_1
8: aload_1
9: invokevirtual #14; //Method X.method:()V
12: return
I didn't even bother saying which one is which because, as you can see there's absolutely no difference in how Scala and Java call Java code. In fact, Java can call Scala code just as well, because it just doesn't know from bytecode that it was written in another language.
精彩评论