2

I am looking forward to developing a social web application using Java in backend (to support operations from Cassandra database) & php in the middleware. Is this kind of approach beneficial ? Any downsides of the above strategy ?

Are there other better options to ensure a scalable architecture ?

Edit : What do you guys think about doing it completely in JAVA (J2EE)?

4
  • You tagged JSP as well, but this contradicts with your question since JSP is a front end technology. Can you please elaborate how JSP fits in this requirement? Commented Jan 13, 2011 at 14:44
  • 1
    I thought JSP people might suggest to prefer JSP and build on just one technology using Java, if that might be beneficial in any sense Commented Jan 13, 2011 at 15:18
  • by the way, I have a question to you, how did you increased your reputation so high ? :) I mean how many lives as a stackoverflow user ? :) Commented Jan 13, 2011 at 15:20
  • Just by contributing 10~15 (good quality) answers per day. Commented Jan 13, 2011 at 15:45

3 Answers 3

4

Mixing PHP and Java does a few things:

  1. You lose the benefit of the tight integration between PHP and MySQL, as Java will fit in the middle (with probably lots of complex spaghetti code).
  2. You introduce a complex Controller layer between the PHP View and the Java Model, which could be easily handled by leveraging open source MVC projects such as Spring MVC or Struts 2.
  3. You create a larger barrier for new developers who are introduced to the code, since they will have to learn both programming languages.

I, personally, advocate the Struts 2 MVC architecture, with Spring integration to handle your data access using Hibernate or IBatis, or to whatever service/backend you may be connecting your model layer to.

If you are tied to PHP, I would suggest sticking with pure PHP and MySQL, since you have an entire community to help with troubleshooting, support, and technical help when you are looking for other developers to join the project.

Sign up to request clarification or add additional context in comments.

2 Comments

Had I been using PHP with MySQL there would have been no question of using Java in my mind but I am using Cassandra as database which provides Hector a Java based client for querying the database. Thus I was thinking building the backend using Java. There are also php client for this but not so much developed and mature
Since you have the requirement of using the Java backend, then I would definitely recommend using a full java-based technology stack like: JSP/Spring MVC/Java Model on top of the Hector client. In my opinion, this would multiply the output of any java programmer you would have on the project. Then you could also use an open-source java servlet container, such as Tomcat or Glassfish. The java developers would also be more likely to know this technology and be able to provide support for the infrastructure.
3

The downside is having multiple programming technologies for a product that, from the way you described it, hasn't even started yet when a single one could fit the bill for the time being until you completely define how the program is going to evolve and change. How you think things are going to turn out today it not how they will turn out when the project is finished. By creating a tiered / multi faceted program runtime environment, you will be creating a debugging, scaling, and development nightmare. Get off the ground and then redefine your requirements to see if these massively complex structures are needed.

Comments

1

I generally think it's a good approach if you can manage the added complexity. The benefits are:

Then again as Geoffrey Wagner pointed out, it adds a lot of complexity and you should be very sure you need this kind of setup.

2 Comments

I agree with your point of, "If you can manage the added complexity". It seems like a daunting task from my perspective but you and your company could be much more well equipped to handle the additional programming overhead. Java is very powerful and PHP is a great front end, but both can do the job of the other at the sacrifice of performance and ease of coding going both directions.
I don't think this kind of set-up creates programming overhead. In my opinion, the problem is more to provide infrastructure which supports this kind of set-up and have equally good know-how in both environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.