This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It's an implementation of the Python scripting language in Java. From my limited experience, it provides you most of the same benefits Perl can, but it (a) doesn't look like line noise, and (b) is easier to integrate with Java. [ April 08, 2002: Message edited by: Jim Yingst ]
for a java programmer, python is an obvious choice compared to perl. I did try out OO Perl before checking out python. Check out python2.2 (it has excellent features). then learn jython. Current version of jython is not same as that of python. SO you w'd'nt be seein the 2.2 features there. But that's fine. You have access to all the java libraries + most of the python libraries also come for free. But the documentation is'nt that good though :-( I found python to be a little addictive once i started doing some stuff with that! ;-) good luck.
Hello, I am a java programmer with 3 years of experience. I have been using perl scripts on linux. Does jython provide the same features and advantages as compared to perl? Going through the documentation, it seems quite interesting . Can anyone tell me more about the advantages and disadvantages of using jython as compared to python. Thanks.
Originally posted by Ajit Malleri: Hello, I am a java programmer with 3 years of experience. I have been using perl scripts on linux. Does jython provide the same features and advantages as compared to perl? Going through the documentation, it seems quite interesting . Can anyone tell me more about the advantages and disadvantages of using jython as compared to python. Thanks.
Yes, Python does what Perl does (generally speaking), but in a naturally more structured, object-oriented way. The advantages of Jython to Python include having immediate access to the Java class libraries and being able to run the script wherever there is a JVM. Disadvantages are that it may be slower and you cannot so easily interoperate with C/C++ (when running from a JVM). Note, though, Jython, as much as possible, is Python. You can write and debug using Jython and then run the same script without a JVM using the Python interpreter (again, with a few caveats). Thus via Jython, Python is actually more platform independent than Java. I speculate that the greatest value in learning Jython is to Java developers who don't know a scripting language, and who by learning one gain some tools they wouldn't otherwise have. Cheers, Glenn
http://www.jython.org/ that's the main place to start out at.But like someone said earlier, learn python first, because that's what jython is, just a more highly glueable version of it, and it was written in Java too http://www.python.org/ is the main page for Python, you can find pleanty of documentation of it there.Try out the download for the Python tutorial, it comes in PDF format, pretty cool. And also they have in the Jython section of the site a downloadable version of "Thinking in Paterns with Java",, if you don't already have it, it's some good reading.And it's apparently been somewhat updated to cater to Jython users out there. Ohh and by the way, two cool things about the Python language, it's got alot of cool libraries beside the basic ones Python and Jython comes with.There is also Vpython, V stands for visual, and Pygame, which has special libraries for game developement.And the other thing is, scripts written in this language are very much shorter than programs written in other languages And for you Perl progragramers, there's Parrot, which I didn't see when I stopped by the site, should be somewhere though,looks like it got bumped out by the new release of Python, I dunna know, ok, I'll stop talking your ears off now
Ok, but what can I do with Jython that I can't in java? Or why would I want to do something particular in JYthon that I wouldn't/couldn't want to do in Java? I still don't have a sense of how it "works" and what it can do for me as a current java developer
Joined: Mar 19, 2002
Umm,,,what can you do that you can't do?,,umm, well,, you can make Java a scriptable language.Very simple and flexible string manipluation.Python has a little bit of everything you might like from other languages in it.I really think you should go over to http://www.python.org/doc/ ,, download the documentation and find out what Python is all about,after all, what Jython is, is an adaption of the Python language, in short, it is Python Really,what it is about is intergrating a scripting language with Java.There are so many different functions and statements in it, even diferent kinds of lists, making your strings easier to manipulate later on in your code.But really, check out the Python tuitorial, find out what it's all about, it is pretty much the simplest language to learn, your not going to fry your brain checking it out, it's the ideal first language, and since it isn't you first language, you got it in the bag my friend And if it isn't to your likeing,awe well.
Because Jython is written in Java, it's hard to say Jython does things that Java can't. But, if you look at it from a syntax point of view, Jython/Python is a higher level, uses dynamic typing, supports operator overloading, dynamic code evaluation (exec/eval) and has a full complement of functional programming tools. Don't forget that you also get Python's simple, clear syntax. These attributes usually mean improved code readability, speedier development, shorter prototype/test cycle, and increased flexibility. I really get the sense that Jython is a great tool for trying to improve code quality too. The terse syntax, interactive interpreter and dynamic typing really help you see your design in a clear way. Here's some of the places where it can't be beat. Extending apps with higher-level (scriping) languages is unparalelled because of how transparent the Java/Python boundary is. Unit testing is great because of how quick it is to write test scripts and because you can set "respectJavaAccessibility" to false Plugging Jython into servlet containers works well because Jython syntax is very text-processing friendly. Hope this helps.
Concerning "respectJavaAccessiblity"... Yes, it means you can access private/protected fields/methods. Yes, it is good for unit testing, and there's an abvious warning that it's not intended for production, safety-critical apps. Concerning speed, Jython is slower than Java. I usually write apps in Jython, then convert only the time-intensive portions to Java. This conversion usually gives me a 9x improvement in that class. It's usually 10% of classes that hog 90% of the machine, so that selective Java coding usually makes for acceptable apps in less dev time.
Joined: Mar 12, 2002
Thanks for the answer.
Joined: Oct 01, 2001
Originally posted by Robert W Bill: Concerning speed, Jython is slower than Java. I usually write apps in Jython, then convert only the time-intensive portions to Java. This conversion usually gives me a 9x improvement in that class. It's usually 10% of classes that hog 90% of the machine, so that selective Java coding usually makes for acceptable apps in less dev time.
Sounds like an improvement over the old 80/20 rule... I like it! While I like the idea, I'm still concerend about the people who have to maintain "combination" apps after I'm gone. I have a button that says, "Write your code as if the person maintaining it is a homicidal maniac who knows where you live." It's a bit extreme I guess, but it reminds me that "tricky" code is often not a Good Thing - and that's kind of how I feel about mixing Jython and Java in the same app. Mr. Bill, are you aware of any "best practices" to reduce this potential problem? Documentation easily falls behind - or is ignored altogether... is there something else you would recommend? Thanks, Burk
Robert W Bill
Joined: Apr 08, 2002
I don't know of any proposed best-practices specifically for the python/java mixture. However, the sense of "combination" is minimal when using Java classes in Jython because Jython uses any java class without modification. Embedding Jython within Java is a notch more complicated. When embedding, A lot of people store their Jython scripts in creative ways (databases, remote servers, etc). This brings up one point where confusion often resides. Java has the classpath to locate classes and Jython has the sys.path to locate modules. This can get hairy, so it's important to clearly document how and why your sys.prefix, sys.path and any other properties related to these things are set. That's the trick to keeping homicidal maniac successors happy
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com