I want to create a new moodle module but i want to create it in JAVA.
Is it possible ?
How should i proceed ?
It is (sort of) possible in that you could potentially write something that used web services, and you could create an applet that worked in Moodle. But I wouldn't reccomend either.
Why do you want to do this?
Dear Ivan,
The web services that Marcus mentions are documented on:
http://docs.moodle.org/22/en/How_to_create_and_enable_a_web_service
Which means you can use SOAP, XML-RPC, REST and others. A quick Google gives:
http://ws.apache.org/xmlrpc/client.html
http://docs.oracle.com/javaee/5/tutorial/doc/bnbhf.html
http://www.oracle.com/technetwork/articles/javase/index-137171.html
I have also attempted to use in the past:
http://php-java-bridge.sourceforge.net/pjb/
But could not get it working and in the end resorted to using the in built HTTP Server in Java for the application I was creating.
I adore Java and prefer it over PHP (sacrilage I know ;) ) - however, you would expend less time and effort simply learning PHP for your application.
Cheers,
Gareth
I am interested enought in Java to have authored several books on the topic and been a developer in that language for a living. However despite that degree of investment I decided it made far more sense to climb the relatively shallow learning curve of learning PHP. For web development I consider PHP to be a better tool as the Java tools (JSP etc) are the overly engineered span of satan (I can come up with a more technical evaluation, but you get my drift)
- Now I know.. I thought your name was familiar Marcus, the Java 2 Programmer book... ha! Again, I changed jobs and did not complete certification, but I had barely started it, Java was not needed in the new job, which was a waste really, should have continued, but that is another story. Interesting turn of phrase though, I thought it was an overly complex set of tools designed by people who were forcing users to gaze in awe at their brilliance, being more in love with their own skills than making considerations about user friendliness.
Yes, thats me, MarcusJavaCertGreen... Colin you are so right. I tell my students that the one massive advantage that Java has over PHP is that Java jobs tend to pay better.
I totally agree Marcus. I've done some SOAP WS in Netbeans on a Glassfish server and it is a total nightmare, far too complicated and adds so much overhead with the XML and converting compact binary data types into strings. So decided to revert back using RMI and optimising it for my MSc project as it was a tightly-coupled system. Having said that, the Netbeans 7 makes a good job of easing the pain.
However, I do wish that PHP went through a compiler first as '500 server' errors are really hard to track down when you've missed a '{' or have a slight syntax error.
To check for syntax errors, you can always run "php -l [phpfile]". You'll need to run it on every file, but if you're coming from compiled-language-land, it should be easy to whip up a make/ant/maven file (or do something like "find . -name \*.php -exec php -l "{}" \;")
I don't agree on the 'span of satan' or 'nightmare' comments,there are enough good frameworks out there that make it easy to also get the simplest of things done using Java. I even helped develop one of them; JAG.
EJB 1.x before X-doclet, now that was a nightmare
That said I can understand the preference for PHP for Web development.
Because it's less stringent it's easier to write crappy code in PHP, but that's almost always more a reflection on the coder (instead of a developer) than anything else.
What I miss the most in PHP is the tools that make 'professional' developent possible.
I had a stab for example at setting up the Moodle project I work on in Jenkins, to run the Unit tests and execute Sonar for quality assurance. That failed misserably because the php tools could not handle a project the size of Moodle.
Anne (Certified Java Programmer by using the Exam Cram Book(s) ).
Ivan; programming languages tend not to differ very much.
As a C, Java as well as PHP developer I can tell you that using PHP instead of Java is not at all a steep learning curve.
So my advice; since Moodle is written in PHP, use PHP instead, but keep the best practices you learned while _programming_ Java and don't fall in the script-kiddie-coding-pitfall that PHP has.
Anne.