PHP or Java ? Positive and negative points

Asked

Viewed 8,631 times

-5

I’m using the PHP not long ago, and even using a framework, enjoying the Object Orientation me yet nay have the perception to see the limitations of language. For example, if one language supports more connections than the other, or if one is easier to create a secure system.

Situation

Let’s say I own a set of colleges (FI). I have 4 faculties in the 4 corners of SP. I left my comic centered on a single point and wish to create hotsites and access pages unique to the faculty to mark events, tests, jobs and etc. For students, a whole control of grades, jobs, and be aware of the events that will take place in the 4 faculties.

  • 2

    This type of question is not accepted by the community. Read Gorilla vs. Shark

  • There is no way to compare the two languages without specifying a specific problem. So in addition to being outside the scope as said @Andrey is based on opinions and too broad your question.

  • @Andrey I apologize and thank you for the "touch". I signaled pro moderator delete.

  • No problem. = ) Now that she has an answer, I don’t know if it is possible to delete it. Your question will probably just be closed.

  • 2

    I confess that I voted in favour of the question Gorilla vs. Shark, and the title of this question here referred me to that question almost instantaneously. But when reading the contents of this one I wonder if it is not possible to accept it. What is so bizarre about it that we should close it? What’s her big difference to that: What C++ can do that C# can’t?, for example?

  • @Math opens meta discussion on the question.

  • 3

    @Math this kind of question needs to be very well asked to not attract opinions. You need to have a very clear focus, give a defined parameter of what you are looking for. Advantages and disadvantages in general, without any context is exactly the reason to fall into the Gorilla X Shark. It is possible to ask the question in a way that it can be useful, the AP needs to strive to make clear what it accurate. And why is it so important to be very clear on this? Precisely so as not to give room for useless answers, to avoid opinions rather than facts. It’s not the kind of question, it’s her way.

  • The question you mentioned What C++ can do that C# can’t?, is a very specific question and is not a comparison of which is the best. This question by title and content wants to know which language to choose, which one is better or worse. What happens, as you can see in the answer below is "depends", it turns out to be too broad and based on opinions and so on and seeing Gorilla vs Shark is also outside the scope.

  • 1

    "large social network" and an "ERP" are too broad terms, if you do not know how to weigh what is best between Java and PHP, I am sure you are not planning to build either of the short term, I suggest you start with something really close to your reality. What, you’re really trying to do?

  • @bigown So yes :) That is, if the AP can ask something that does not attract opinions it can know the difference between the two languages, in a specific way.

  • 1

    @Math I’m doing this discussion. But it’s more important to know that PHP is not as effective as Java. In what kind of situation I should think about migrating language.

  • @According to the dictionary, effectiveness means: "Achieve the planned results. Achieve the goals, achieve the goal." That is, the two can be effective, depending on what your goal is. As for "when to migrate from language", I think it can be considered too broad, at least I don’t know if I could answer satisfactorily. I think your question is salvable, but I still can’t tell you how to ask in a way that is objective and therefore acceptable by the community, probably because I still don’t understand where you’re going.

  • 1

    Allan, I think there’s still a lot more information missing so your question can be reopened. Like this Math, the examples you gave are very vague and generic (you said yourself "let’s say..."). Well, you said you already use PHP. And in Java, do you know how to program? If you don’t know and have a problem undeserved To solve, you don’t even have to think: use PHP. Then study Java calmly, and you will begin to notice the difference between the languages, and the limitations of each one.

  • Now would be good ?

Show 9 more comments

1 answer

10

That being said, for your question whether PHP is always faster than Java, the answer is depends. Any comparison between two different languages will probably have this answer.

Note that your simple test leaves out many things that can directly interfere with the outcome. The fact that you have compared a web application (php running on Apache) with a "standalone" program (Java running directly over jre) and with a C program (compiled, and therefore "naturally" faster). You would have to at least be comparing JSP running on Tomcat (which is the web face of Java) with PHP to have a test that starts "roughly equivalent".

And that’s just the beginning, but I’m not going to dwell on the problems with your testing method. Remember that all these languages apply optimizations that can make a lot of difference in certain scenarios.

I’m going to focus on your question of which language is most appropriate, and the answer again is: it depends. I’ll assume we’re talking about web applications (php, jsp, apache, Tomcat).

The question is, why do you need a system that answers so quickly? Why is speed the most important factor for you, to the detriment of safety, reliability, robustness, ease of maintenance? A large portion of web applications and websites (99% percent I would say, but I have no respect reference) do not need to respond quickly as desktop applications respond, even more if we consider the variation in the quality and speed of networks (Broadband, 3G, Fiber).

If you have equivalent knowledge of Java and PHP, then I simply suggest you use both. Nothing prevents you from working with two different languages, especially if you’re a freelancer. By the time you do the project analysis, you can already decide, based on the scope, what you will use. The good thing is that you will always be "training" each one of them, which can be useful when some project or vacancy requires any of them in specific.

The biggest one, however, as far as I know, is a higher consumption of processing and memory in the case of Java (especially if it is web), which makes Java hosting more expensive, but otherwise I would say that both are equivalent in resources and capacity (considering, of course, the differences in syntax, structure and deployment).

Finally, choose the one that feels best (or both) and be happy. And, when you want, change.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.