Rule engine in java & ruby (Suggest me a good approach) - java

I need to implement a rule engine either in java or in ruby (a independent project) which i have to integrate in a Java EE web-application so should I implement this in java because it will be easy to integrate or should I go with ruby on rails.

If you are trying to integrate it into a Java EE web-application then I'd definitely suggest going with a Java-based option. You want to minimise the proliferation of different application stacks as much as you can, and integration across different stacks is always painful.
I think you will also find that the Java libraries in this area (rules engines / workflow) are more mature. I'd suggest looking at Drools: It is open source and well-proven.
Alternatively, if you really want to use Ruby but still want to integrate with Java / use Java libraries like Drools then JRuby might be a good choice.

Related

Using java and Ruby on rails at the same time... possible?

I am currently developing a search engine and I have some implemented algorithms that are written in Java but also I need to get some Database communication which is easy thing in Ruby an Rails. Thus, Is there any way to use both language in the web application development
Regards :)
Easily. You can run Ruby on top of the JVM by using JRuby, or you can have Ruby communicate with Java by using RJB (Ruby-Java Bridge). Or you could reimplement the algorithms in Ruby.
Sounds like JRuby is the sort of thing you're looking for, although I haven't (yet) used it myself.
JRuby with Rails - including guides for Rails 3
https://github.com/jruby/jruby/wiki/JRubyOnRails
Making Java calls
https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby

Using Java & .NET in Projects Development

I'm writing this topic for learning purpose, not to start a flame war.
Basing on your experiences when It's highly recommended to use Java and not .NET, and when I must use .NET and not Java, also when I have the choice to use anyone of them in Projects development.
Thanks already.
The choice of language always depends on what you and your team know best and the problem at hand.
It's not common to do scientific computing with heavy numerical methods in Ruby or PHP; no one writes web apps in FORTRAN. The problem you're solving will affect the choice.
Your deployment environment will also affect the .NET versus Java EE choice. If you're a 100% Microsoft shop, .NET is an easy choice. If you have a heterogeneous environment, maybe Java EE is for you. If you like Linux, perhaps Java EE is preferred over Mono.
.NET and Java EE have evolved to solve similar kinds of problems. There's almost a 1:1 correspondence between features in the language, except for some advances like closures that .NET has added.

Should I try to reuse Ruby code in a Java project?

I'd rather not "reinvent the wheel" and I've found a Ruby project that provides functionality I need in my Java app (there is no preexisting Java project that does what I need - trust me, I've looked). So, best case scenario, I am able to run the Ruby code from my Java code (ala JSR223).
However, this Ruby project depends on having several gems installed. I'm not at all interested in converting the entire Java app into a JRuby app, but I'd like to be able to leverage this project. Is there an easy way to load the code from a gem into a ScriptEngine, or am I just asking for headaches?
JRuby is a solid platform and integrates well with Java. But Rubygems do not integrate so well with Java build tools.
If any of the gems include native C code, then forget it, you can't use them from JRuby.
If all the gems (and all their dependencies) are pure Ruby, it is technically possible to use them from JRuby, but you will have headaches getting them packaged in JARs so that the JRuby runtime can find them.
Mostly I'd say no because of complexity. Although it's subjective, I'd personally rather take the time to re-write it anyway--you can make improvements and when you're done, you'll understand it better.
One option you might consider is splitting your application into two pieces, which interact using either something like pipes/files (or simply stdin and stdout) or some sort of an RPC mechanism. Whether an approach like this makes sense really depends on what the Ruby library does - creating the interface between the two applications might be more complex than actually reimplementing the stuff in Java.
I've reused Java code from JRuby, I don't see why this can't go both ways.
Another thought, can you run the Ruby code and then just tack on a web service or set of web services to call from the Java app? Sinatra makes it ridiculously simple to write a web service wrapper for ruby code. And Java has no shortage of tools to call Web Services.

python vs java on web service development?

i am currently using php as backend language in webdevelopment. but im wondering what you need to install to get running with python and java.
with php i need apache and mysql.
can i use those for java and python too?
i cant find good guides equivalent to LAMP/MAMP/WAMP so i understand the parts when using either java or python. would be great if you could give me some good links on the installation and what is required.
and i have read that its easier with python. but is this the only advantage of using python instead of java. cause with java i can create java applets, desktop and mobile applications. they all tend to have java installed. but not python.
so why should i use python instead of java.
I can only give suggestions for web development in python:
Use Tornado - A non blocking web server.
Use Jinja2 - A templating engine.
Use MongoDB - A schema less database server | You can also use any RDBMS according to your requirement.
Above 3 tools are enough to build a web application in python.
or you can always choose Django - The giant web framework with all the features required to build a scalable web application in python.
You need to look into the Web Application Framework subject. Some SO pointers:
simple-webserver-or-web-testing-framework
web-application-frameworks-c-vs-python
django-vs-other-python-web-frameworks
what-web-application-framework-for-java-is-recommended
can-anyone-recommend-a-simple-java-web-app-framework
...
Good luck.
web2py is a python web framework that is completely self-contained, runs portably off a USB drive even. The manual is available on scribd, and after an hour or two of tutorial you will have a pretty good idea of what a python web framework will be like. I can't comment on Java at all.
EDIT: Django and web2py are very, very similar. I think I prefer web2py because it does more for me that I don't have to do, but from the POV of, say, Java frameworks, Django and web2py may as well be the same thing.

Webservices - Java or .NET?

I need to implement webservices in an upcoming project and wanted to know what are the main points to base the decision on whether to implement using java or .NET
I'm a C++er...
If you're a Java shop use Java. If you're a .NET shop use .NET.
There really is no difference that makes one of the two languages superior to the other in regards to web services.
Possible consideration - .NET pre 3.5 only provided support for SOAP based services, but I believe the 3.5 WCF offers REST and SOAP now.
There's no real difference from programmer's point of view (implementation).
For me, a reason to pick Java is that all tools and infrastructure are free/open source. OS, deployment web server, databases, IDEs and developer tools.
I have plenty of experience with both, and both will certainly do the job.
However I tend to prefer Java over .Net for things like web services for the following reasons:
It's cross-platform, which gives you much better options on the hosting side (e.g. running a big Linux cluster on Amazon EC2)
The library ecosystem is larger and more mature, especially on the server side.
I prefer the more flexible open source philosophy to "the only way is Microsoft". Vendor lock-in is always a bad idea for your enterprise architecture in the long run.
You can optionally use awesome languages like Clojure or Scala on the JVM
Ultimately though, I'd go with the one your team has the most skills with. This will determine what you are most productive with, which is usually most important if your main objective is to deliver value quickly.
It's a personal decision, usually determined by the technology already in place or the skill set of the developer(s) writing the services.
i've never really developed web services in java, but i have in .NET and if you're using Visual Studio they're an absolute cinch to whip up (i expect they're a little more difficult to do without the aid of VS).
if you're already working in java, and don't have any .NET stuff in place, stick with java - it'll save you a lot of money (if you were to get Visual Studio in, as i mentioned), and possibly some time involved in learning the specifics of .NET
In my experience, Web Services are a bit more tightly integrated into Visual Studio than they are into Java's editors.
The Eclipse IDE doesn't even have JAX-WS (Java standard web services stack) support built in, opting to use Apache Axis 1 instead.
Netbeans supports JAX-WS, though.
I personally prefer .NET to Java for many reasons I don't want to go through, since it doesn't really matter and is more a personal preference than a strict guideline I can recommend.
If you have Java infrastructure in place or using a platform other than Windows for your server applications, I strongly suggest Java. However, if you don't have anything in place and running on Windows platform, .NET is pretty cool in that area (WCF/ASMX/WSE/...).
As you say you're a C++ - er you'll probably find .NET easier as you can target it directly from C++.
I'm a Java guy, but I think Web Services are easier to code in .NET. Visual Studio takes care of everything, in Java it takes a bit to get started.
A bit of a problem in some projects with JAX-WS is, that SUN ships the "old" version 2.0 with Java 6. If you want to use the current version, it's some work to make it run with Java 5 and Java 6.
If your app must be portable, you should obviously choose Java. Otherwise I would say it's just a choice of your preferred language, since the above issues are really small (maybe you want to choose Axis or something else anyway, I haven't worked with something other than JAX-WS yet).
IMO if you want to do SOAP, then its a heck of a lot easier to use .NET and WCF. However, I've found REST to be a bit tricky with WCF, and had to implement a custom XML parser to do it instead of using their built-in one.
You probably want to consider your hosting environment too. If you are going to serve this from Windows hardware, you can drop .NET WCF web services into IIS. If you are going to run a Linux/Solaris server, then it isn't even a question...
I suggest implementation with JSP ,it provides a robust platform for development
I prefer JSP to ASP or any microsoft techonolgy!

Categories