Making Blender in Java

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

kAinStein
Posts: 63
Joined: Wed Oct 16, 2002 3:08 pm

Post by kAinStein » Tue Oct 23, 2007 1:12 am

First, I wanted to point out that I see this as a theoretical discussion. I'm not taking anything into or out of account.
Briggs wrote: I havn't ever coded in Lisp, but I have written code in another functional language (Erlang) and I don't see the great difficulty in using such languages for large projects.
Oh! I didn't say that it is impossible... And it's not about programming paradigms. Of course you can use Lisp, Erlang or say Tcl. But you also could take C++, Python or Java for it. Those would certainly attract more coders or at least make it easier for people to extend Blender: It's simply easier to get familiar with the code due to the organisation.
As a matter of fact I see quite a few advantages.
Just curious: Which where?
What is it about lisp that makes you doubt its suitability for large projects?
First there is a codebase of over 200,000 lines of existing C code IIRC. Then there are not as many tools as for C/ C++ from which someone could choose (profilers, etc.). I don't doubt that there are a few and that they are reliable - but can't compete with corresponding C/C++ or even Java tools. In addition you need quite a lot of people that know the language well and can produce readable code (and one goal should be to make it easier for people to extend Blender). Lisp is a bitch sometimes regarding this aspect and chances are that code gets unreadable after some time and so unmaintainable. If you need external libs (take FFMPEG as an example) you might not only use the library but also have to maintain the language bindings. In addition Lisp also offers OO concepts for coding but slightly differently than people are used to with say C++, Java or Python. So some people will use it (nothing against it) and others don't - this might cause problems even if you've got strict coding guidelines. Also the code (or module) organisation is not as good as in other languages. And the last reason that I can come up with right now is that C is not any worse than Lisp is - so why would someone like to switch the programming language?
Regardless, the reason Mirai was written in Lisp probably has a lot to do with the fact that it actually started as a product of Symbolics Corporations graphic division called S-World (their whole bussiness was lisp machines). Given that it's code survived as Lisp for over 15 years I really doubt that Larry Malone (Mirai's chief architect and who, from what I hear, is still working on it, albeit only for private clients these days) will be rewriting it any time soon.
Might be. At least it sound reasonable.

TheGreatestMale
Posts: 0
Joined: Fri Dec 28, 2007 10:07 am

Java code executed in Blender

Post by TheGreatestMale » Fri Dec 28, 2007 10:31 am

I would also like to see Blender embrace the Java community by enabling the execution of java code in the same way that python scripts are executed. Java integration would definately open up blender to a much wider audience. After all, when I was getting my graduate degree in Software Engineering we studied C/C++ and especially Java, not python. While getting my biology degree I found many, many other programming languages in use. And while studying informatics, more programming languages to choose from. My point is that, while specialized languages can help accelerate development in a given specialty, using all of these languages is a systems integration nightmare and ABSOLUTELY slows the progress of science as a whole. It would be much better it these platforms, such as blender, supported a well-established cross-platform and cross-discipline programming language such as java so that systems integration could occur much more rapidly and society could benefit much quicker from the integration of a diversity of applications. I find the mentality of 'my language is better so were going to use it exclusively,' very unproductive. I do also agree with others in this posting that the chances of the blender community enbedding java capability very unlikely in the near to short-term future.

tbaldridge
Posts: 0
Joined: Fri Jul 11, 2003 9:56 pm
Location: TX

Re: Java code executed in Blender

Post by tbaldridge » Fri Dec 28, 2007 6:29 pm

TheGreatestMale wrote:I would also like to see Blender embrace the Java community by enabling the execution of java code in the same way that python scripts are executed. Java integration would definately open up blender to a much wider audience. After all, when I was getting my graduate degree in Software Engineering we studied C/C++ and especially Java, not python. While getting my biology degree I found many, many other programming languages in use. And while studying informatics, more programming languages to choose from. My point is that, while specialized languages can help accelerate development in a given specialty, using all of these languages is a systems integration nightmare and ABSOLUTELY slows the progress of science as a whole. It would be much better it these platforms, such as blender, supported a well-established cross-platform and cross-discipline programming language such as java so that systems integration could occur much more rapidly and society could benefit much quicker from the integration of a diversity of applications. I find the mentality of 'my language is better so were going to use it exclusively,' very unproductive. I do also agree with others in this posting that the chances of the blender community enbedding java capability very unlikely in the near to short-term future.
Java may be the industry standard for general programming, But not for 3D programs. Python is by far the most supported language for 3D (and 2D) graphics apps. Maya (iirc), TrueSpace, Nuke, etc, all use Python.

The biggest issue with Java that I've seen is that it is so incredibly verbose:
http://www.ferg.org/projects/python_jav ... -side.html

I've dabbled in Java many times, but that alone was enough to tick me off. 9 times out of ten a C program re-written in Python will be smaller. While a C program rewritten in Java will be larger.

Another strike against Java and Python is the fact that C is very optimizable. Sure, most of the Blender users have a 1Ghz or higher, But some don't (only 1 of my 6 computers are over 1Ghz). We still have to develop for these lower end machines as well. Say what you want, but well coded C will always be faster when it comes to handling complex data structures. Never mind doing some awesome tricks like writing .blend files (almost a memdump), or loading images via mmap. These are standard coding methods Ton has used since the beginning, that makes Blender one of the fastest 3D programs out there. Converting this to Java (or any other language besides assembler or C++) would slow it down.

Show me how to load a struct (or a class) from disk using mmap (so it isn't cached several times by the OS) from Java, and I might change my mind. Until then I say, Blender in Java will be dog slow.

tbaldridge
Posts: 0
Joined: Fri Jul 11, 2003 9:56 pm
Location: TX

Post by tbaldridge » Fri Dec 28, 2007 9:22 pm

And to further illustrate my point, here is a nice site I ran into a few months back.

http://shootout.alioth.debian.org/gp4/b ... lang2=java

Sure, Java is close to the speed of C in pure math. But, when it comes to some things like memory usage, Java stinks. I found this benchmark interesting as well:

http://shootout.alioth.debian.org/gp4/b ... lang2=java

Java it seems is faster than Python, but at the expense of memory.

TheGreatestMale
Posts: 0
Joined: Fri Dec 28, 2007 10:07 am

My reply...

Post by TheGreatestMale » Sat Dec 29, 2007 9:58 am

tbaldridge wrote:And to further illustrate my point, here is a nice site I ran into a few months back.

http://shootout.alioth.debian.org/gp4/b ... lang2=java

Sure, Java is close to the speed of C in pure math. But, when it comes to some things like memory usage, Java stinks. I found this benchmark interesting as well:

http://shootout.alioth.debian.org/gp4/b ... lang2=java

Java it seems is faster than Python, but at the expense of memory.
I think that you have illustrated your point adaquately, but missed my point "entirely". Why respond to my posting if you are unwilling, or unable, to address the issue or point, if you will. Sure, python may be great for 3D but it sucks for financial, healthcare, or web applications. And what if I wanted to integrate say, a healthcare application with a 3D application? Python wouldn't be the answer 'thats for sure', Java with JOGL would be a much, much, much better option! Like I said, if Blender ever wants to become a standard outside of the 'relatively' small open-source 3D community it MUST embrace interoperability at the programming level. If we EVER want the vast majority of programmers to code, or even use for that matter, 3D applications such as Blender, you must go to them, not expect them to come to you. I am not saying Blender should abandon Python, I am saying it should be a priority of the Blender community to embrace other programming languages besides Python, such as Java. Otherwise, Blender will never be more than a toy to play with but not seriously use for any real-world applications, at least by the mass majority of developers that 'could' use 3D in thier applications. Another example: It is like having a harddrive that won't integrate with a CPU which won't integrate with the memory or keyboard. Whomever comes up with a way to integrate these various pieces of hardware will have a far more powerful tool than the sum of it's parts. The same thing is true for software: when you can integrate Blender with Java etc you will have a much more powerful application that the sum of its parts. Hopefully the Blender community will have enough 'Vision' to see this fact and start actively moving toward greater programming language interoperability.

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing » Sat Dec 29, 2007 12:38 pm

Fact is that Java will get integrated only when someone works on integrating it. Until then it is nice to talk a lot, but it'll be only that - talk.

There is a very simple reason why Python is integrated, and that is that the people working on it know how to do that. I'm every now and then working on integrating Lua, but that's only because I actually do something about it - just talk wouldn't get me anywhere.

Java may be mainstream in for *programming* healthcare stuff, but in the end, Blender is a program for endusers, not programmers perse. That said, a programmer may be the enduser, when trying to integrate it into something larger, but that target group will be relatively very small.

Again, talk is good for talk, for integration to happen you actually need to code.

/Nathan

stiv
Posts: 0
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Re: My reply...

Post by stiv » Sat Dec 29, 2007 2:36 pm

TheGreatestMale wrote:Sure, python may be great for 3D but it sucks for financial, healthcare, or web applications. And what if I wanted to integrate say, a healthcare application with a 3D application? Python wouldn't be the answer 'thats for sure', Java with JOGL would be a much, much, much better option!
Heh, there is my laugh for the day! Rather than even attempt to correct the misunderstandings involved in that, let us just point out that Blender is written primarily in C. It has an embedded Python interpreter to provide scripting facilities.

And ditto to what jesterKing said about stuff getting done when someone does it.

NielsBlender

Re: My reply...

Post by NielsBlender » Sat Dec 29, 2007 5:26 pm

TheGreatestMale,
TheGreatestMale wrote:Otherwise, Blender will never be more than a toy to play with but not seriously use for any real-world applications
If Blender switched to Java as their 'main-program-language';
I would forget about Blender and it won't take even a millisecond to switch that bit!

Niels

ps.
It is wise to follow the one with wisdom instead of trying to follow the frequency of 'all people' which is the equivalent of just noise.

NielsBlender

Post by NielsBlender » Sat Dec 29, 2007 5:54 pm

TheGreatestMale,

For the record;
As soon as Java-sources(.java) and thus applications can be converted into true machinecode(ModelSpecificASM) supporting the same platforms Blender does now, it would be a choice to consider... ;)

Hope this helps,
Niels

ps.
I hope this is not new to you but; Java isn't the follow-up for the 'C-language'...despite what 'teachers joining the hype' have told you.

tbaldridge
Posts: 0
Joined: Fri Jul 11, 2003 9:56 pm
Location: TX

Post by tbaldridge » Sat Dec 29, 2007 5:57 pm

But Blender is primarily a 3D art app. Why would the medical industry need Blender? Java has OpenGL. What more do they need for 3D? The only thing blender offers are 3D modeling tools, which other industries never use.

You say that Blender must be moved to Java to be taken seriously. What other 3D apps use Java? Maya? 3D Studio Max? Lightwave? Alias Wavefront? Nope, those are all in C.

And that's the thing I find the funniest about this whole thing. Java is hailed in in universities as being the "industry standard". But show me a modern 3D commercial application written in Java. Sure Java is used by in house groups, but in the end, Java is too verbose, and too incompatible (i.e. needs the JVM instead of running as is). To be used by major commercial apps.

In fact I cannot even think of a commercial Java app I've used recently. Eclipse and Azeurus, both of which are free and dog slow, are the only things that come close.

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip » Sun Dec 30, 2007 5:35 am

tbaldridge,

Java is pretty common for enterprise business software.

However I don't see anypoint in doing anything of Blender in Java. If there were a large preexisting developer base of skilled programmers who wanted Blender in java and were willing to do the work to make it so that would be one thing, but there isn't.

Also as Linus Torvalds noted,
C++ is a horrible language. It’s made more horrible by the fact that a lot of substandard programmers use it, to the point where it’s much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C.
http://www.digg.com/linux_unix/Linus_Torvalds_hates_C

Similar reasoning applies to Java.

LetterRip

tbaldridge
Posts: 0
Joined: Fri Jul 11, 2003 9:56 pm
Location: TX

Post by tbaldridge » Sun Dec 30, 2007 5:56 am

Yeah, that's the funny thing about Java, because it is considered "enterprise" quality thus allot of programmers assume that just using will somehow make your program be of higher quality.

I've been programming for 12+ years now, and have worked with more languages than I can remember, and I have to say that C/Python are still my two favorite languages. Python makes it easy to prototype new concepts, and C is great where speed is needed (i.e. a renderer or modeling program).

The Industry leans towards C/C++ (and now to C#) more than any other language. So let me rephrase my questions, what well known, art related, well written, software on the market today uses anything but C/C++/C#/Python? I'm not finding any.

celeriac
Posts: 0
Joined: Fri Feb 21, 2003 11:31 pm
Contact:

Post by celeriac » Sun Jan 13, 2008 8:17 am

Languages: it's horses for courses isn't it ?

Having said that, Java & C++ are pompous, bureaucratic, ugly and inconsistent.

Python is pragmatic language. It's a bit annoying sometimes but it's a good choice for Blender. It makes sense to do the core maths and performance-critical stuff in C and open the rest up to Python. You can actually get stuff done in it.

LISP is great , as is Smalltalk (Squeak, OpenCroquet).

terrorist
Posts: 0
Joined: Thu May 21, 2009 5:57 pm

Post by terrorist » Thu May 21, 2009 7:09 pm

celeriac wrote:Languages: it's horses for courses isn't it ?

Having said that, Java & C++ are pompous, bureaucratic, ugly and inconsistent.

Python is pragmatic language. It's a bit annoying sometimes but it's a good choice for Blender. It makes sense to do the core maths and performance-critical stuff in C and open the rest up to Python. You can actually get stuff done in it.

LISP is great , as is Smalltalk (Squeak, OpenCroquet).
java is ugly and inconsistent? been using it for 10 years now and never noticed, oh well. there is actually quite a few things the java haters here posted that i just HAD to react to:

first, the python & java side by side - of course java is a lot more text heavy. but what type of dev tools are you using with java? eclipse or netbeans, maybe something else? both of those have code completion features that let you write a 40 char line with just a fraction of the text length. another thing is that this "side by side" comparison is a well-known manipulation. they intentionally use long and clumsy expressions. see this:

java

Code: Select all

int myCounter = 0;
String myString = String.valueOf(myCounter);
if (myString.equals("0")) ...
python

Code: Select all

myCounter = 0
myString = str(myCounter)
if myString == "0": ...
i would write it this way

Code: Select all

int myCounter = 0;
String myString = "" + myCounter;
if ("0".equals(myString)) ...
which is both shorter and safer (as the myString object may be declared null somewhre in the code thus generating an exception)

it is also not true, that java is slower than c/c++. of course, if you write a loop incrementing array values or something in c/c++ and compare it with the same in JVM on windows, you'd get a 50% slower result with java. but try that with the -server JVM option (default on linux and mac machines) and you will see how incredibly it improves the times of computation. sometimes it is even faster than the original c/c++, when the HotSpot server incorporates some of the results for repeated calcutations directly into the code. i ran into an example where an entire iteration of a computation was done in ~ 0ms (previous iterations took about 0.5s to compute) just because it precomputed the heavily used part. those memory usage graphs are also non-relevant. java reserves a big amount of memory (depending on what the user starts it with), say 64M for example. it is called heap space. this heap space contains all the objects, arrays and variables java works with. even though the program would have used only one class instance containing one array with 10 bytes worth of data, the java app would still be 64M big (with 99% of the heap space unused, although it may be configured differently). so running a port of an application in java blindly of course may produce such big memory usage differences. understanding this, java haters can't fool you anymore. in fact, java memory management is what it makes it much faster for big applications than c/c++ code (and that's one of the reasons java is used for enterprise applications so widely). no wonder that microsoft is going to copy this memory management feature into their programming language bundle

more importantly, check this out http://bytonic.de/html/benchmarks.html. it is the original work of a great 3D graphics innovator, John Carmack, Quake 2. it is completely rewritten in Java using JOGL and LWJGL as OpenGL bindings. with the latest version, it is FASTER than the ORIGINAL in the windowed mode (and blender is windowed, is it not?!).

i hope this won't start a flame over java vs c/c++. i do not intend that, as i have been in many such flame like that (and always won). what i intend with this is that you should not banish java as an option. after all it has the fastest growing community in the world and it will grow even faster after oracle acquires sun microsystems. they have great plans with java

to make it more clear, i do not suggest to rewrite blender to java. that is a non-sense even to me, a java enthusiast, with the huge amount of code blender for sure has. instead, i would like to see a java interface and inner support much like python has. even extend it beyond that. i could imagine integrating my java-based 3D software with blender, modeling objects in blender and posting it in real time, on the fly, to my application, without the need to restart it, export files or whatever else

thanks

terrorist
Posts: 0
Joined: Thu May 21, 2009 5:57 pm

Post by terrorist » Thu May 21, 2009 7:20 pm

LetterRip wrote:
C++ is a horrible language. It’s made more horrible by the fact that a lot of substandard programmers use it, to the point where it’s much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C.
http://www.digg.com/linux_unix/Linus_Torvalds_hates_C

Similar reasoning applies to Java.

LetterRip
now please tell me why similar reasoning applies to java? java exceptions mechanism greatly reduces introduction of critical bugs to the code, even for sub-standard programmers. java is not a horrible language. it is type safe after all. debugging and profiling is much much simpler and more well-arranged than any of c/c++ combo. java documentation is probably the best, most complete and most comprehensive documentation in the world. if it was horrible and so easy to introduce bugs into as you suggest, why would there be so many successful java projects with open contributions to them, how could it be that these extremely huge enterprise applications, that you yourself mentioned, exist? wouldn't it be almost impossible and non-cost-effective to build them if java was such a trash?

Post Reply