From PHP to Java. Any advice? [closed]

2020-05-11 09:40发布

I've been doing web application development for the last 3 years in PHP. I'm now on the verge to give Java a go. My last use of the language was nearly 8 years ago and was mostly academic.

I'm reasonably well acquainted with PHP's object model (version 5) and I have almost exclusively been coding in OO. I would now like to transport that experience and use it to develop in Java.

Where I'm coming from:

  • linux as a desktop and server
  • Vim/gVim + plugins as an editor
  • MySql for db
  • apache httpd
  • experience with a bunch of PHP frameworks, Zend+Doctrine being the ones I use most

What I've garnered so far about a move to Java:

  • I need an IDE: IntellijIDEA, NetBeans or Eclipse
  • I need to pick a development framework. Some recurrent names: Spring MVC, stripes, wicket.

Now I need some insight that could help make this transition smoother. But from the way people talk about it, Java seems to be an entirely new beast with its own ecosystem. It sounds as though moving to Ruby or Python would actually be easier, which is curious since, when I look at it, Java conceptually seems the closest to PHP, albeit stricter and precompiled.

As weird as this may sound, very few people have publicly documented their experience of such moves. I have searched google, amazon and stackoverflow for similar questions and the results leave to desire. I just can't believe that I would need to start the same as a newbie if I wanted to be productive as a web developer in Java fast.

Anybody is welcome to respond, but I somewhat think that people with some valuable experience in both languages would enrich this discussion the most.

  • What helped you get going quickly in Java?
  • What concepts are omnipresent in Java and absent from PHP and vice versa?
  • Some gotchas for PHP developers going Java.
  • How long before you felt the transition was complete?

标签: java php
7条回答
混吃等死
2楼-- · 2020-05-11 10:24

Strictly speaking, you don't need an IDE to work in Java. I've been coding heavily in Java for well over a decade (and heavily on other stuff for over 25 years), and I don't much like IDEs. Perhaps that implicit indicator of my age is part of the issue :-) It's a trade-off, like anything else.

I'll plug Stripes as a nice simple framework, but mostly that's because it's relatively small and limited in scope. The large frameworks like Spring are "kitchen sink" ecosystems, and learning Java with one of those frameworks may smooth some of the difficult parts but leave other basic aspects mysterious. Again, it's a matter of personal preference.

It's good to have somebody around who knows the language. Oh, and to that point, make a friend of the Java API documentation. As platforms go, the Java API has its ups and downs but for the most part the documentation is at least pretty thorough and pretty accurate.

You'll also want to get really familiar with JSP and its relationship to Java and Java web service architectures, because that'll be what you'll relate to your PHP experience most directly (I'd think).

查看更多
登录 后发表回答