PHP and Java differences and usefulness?

 1, php interests

  (1) on-write with
  is to say just one change each time the end user immediately see the effect, but java is much slower, after the code changes to recompile, and then restart jvm, but a lot of the time consumed by the center, ah, and restart the process, but will constitute jvm take care of intermittent users.

  (2) to write something fast

  php can be said to be very active, and a demand to give, not only to consider the latter part of the function and the amount of user problems, it is reasonably fast, and even you do not have to be able to structure, write directly will be very fast , writing a CRUD functions, perhaps 30-50 lines of code to get.

  The java on more slowly, in order to first look at what the structure is now fundamentally a spring, and is equipped with a variety of databases, filters, servlet, the decision is mybatis still hibernate;

  then consider the code between the delivery, and then consider the transaction, and then continue debugging, a change in the code probably is a few minutes of waiting time, it can be imagined.

  (3) surface clearer idea of
  what the surface is thought, is what you see is really made out of things.

  For example, echo "hello world", is the output hello world, but java is different, you might write in response ( Laibaoshopping ), perhaps written in modelattribute, but also perhaps is the return of the string, and then do not know how , it flashed onto the page.

  (4) take up less memory
  php is process-type deal with the problem, take up less memory appropriate, be able to say, you settle 50 projects in one machine without any problems, just not up traffic, do a set.

  And to die java, java each launched a project in itself would have run out of a lot of memory, such as on a 8g memory machines, usually ran two projects on the same subject.

  2, java interests

  (1) multi-component
  Personally, I think this alone overshadowed all other interests, because the multi-component, means that more people use, the public's sharp eyes.

  So, java must be good, it has precipitated a lot of things, not a new language can easily be replaced.

  What do you want, a good Find java components, you may have the function of demand, particularly with regard to the moment the most popular big data industry, java is the possession of a party. The php In such a scenario a bit powerless.

  (2) induction of convenience

  fact, this is very similar to the first point, also due to multi-component, so to use the thread pool connection pool is very convenient, about this high concurrent high-function scene, it is certainly necessary.

  Because the job is the reason java multi-threaded, so do not always need to initialize the many fundamental things, which eliminates much of the time, and therefore we can endure a slow process server is launched, because only once.

  The php is a multi-process, demand from scratch each time to load all the code requirements, and therefore can not be some common data stored in the memory, connection pool is not good to do, asynchronous operation is a big short board.

  (3) clear logic
  java, you can enter something from a can with IDE analysis to the deepest level of logic operations on each field, are able to understand clearly, this is actually a benefit to use interface, and complete goals.

  And then php can not do or say very few people do this kind of work expenses that King ( Lucky-SPECIAL ), php can be said to be half-half goal-oriented process-oriented development, the interface is difficult to clearly see what is returned, which is about understanding Code, it adds a big threshold.

  (4) early detection of faults
  compilation of java and is more time consuming, but if a significant fault, the compiler will not pass, which gives you an opportunity to check the code from scratch.

  The php is not whether you write more rotten, do not give you any tips, but many hours, often due to fewer write a; semicolon, leading you to troubleshoot hours.

  (5) to facilitate remote call

  no matter what kind, remote and local calls are very convenient to know the relevant information, and with the java language call is not the choice of simple http call, and the protection of certain connection, then greatly improved function.

  The php also has remote call, but relatively speaking, a lot of weak.

  Summary: php and java is not necessarily good nor necessarily bad, there is reasonable.

Guess you like

Origin www.cnblogs.com/monkey7788/p/12189744.html