Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having been programming in PHP for a year, I now want to start learning Java. I am in a Windows environment.

I want to develop a GUI with Java that would query a MySQL database. I know I would use JFC to accomplish this, but my questions are:

  • Will it be difficult to adapt to Java?
  • Do I benefit for learning Java because I know PHP?
share|improve this question

closed as primarily opinion-based by gnat, GlenH7, Dan Pichelman, Tulains Córdova, MichaelT Feb 3 '15 at 3:07

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

If you're developing GUIs for windows, you're better off with C#, its syntax is very similar to this of Java, but it does more than Java ever could on windows. – Mahmoud Hossam Jun 2 '11 at 23:48
Also check out this question:… – Jay Elston Jun 6 '11 at 18:14
up vote 8 down vote accepted

Learning programming is much harder than learning any particular programming language. So, it will not likely take you nearly as long to become productive in Java as it did to become productive in PHP (if that was your first language). One piece of advice: You need to try and learn "the way" of Java - not just its unique syntax and libraries but also the conventions of the Java development community.

I think what you may find more challenging than the difference between Java and PHP is the difference between web and desktop programming.

share|improve this answer
"Learning programming is much harder than learning any particular programming language. " -- agree totally, but, consider also that Java and PHP have very different models -- PHP is a scripting language strongly tilted toward web development, while Java is a general-purpose OO language. – TomG Jun 3 '11 at 0:17
Do you have good pointers on learning "the way" of Java? – chiborg Sep 5 '12 at 7:11

It certainly depends on what kind of app you are talking about. To get a basic "hello world" CRUD app with Java and MySQL up and running, you really should not have much trouble at all.

PHP might help a bit, but for the type of starter app you would be building at first, you should be able to do it just fine and learn a bit along the way.

share|improve this answer
More specifically, the features of the app would be: Search, and display data in the GUI. All the data would come from a Mysql database. I want to use this Java app to manage a website of mine. – Ryan Jun 2 '11 at 20:47
@Ryan So why not to create a private web-based panels that only you can use? since you already know PHP. Why to spend too much time learning Java and Swing? – Chiron Jun 2 '11 at 22:36

I hope this is a coherent response...

You should not encounter too much difficulty learning Java if you already a solid foundation in the fundamental aspects of programming. There are some idiosyncrasies of PHP, however, that you need to be sure to look past when moving to another language.

Java is deeply object-oriented, and the Java development "culture" subscribes deeply to OO methodologies. PHP's OO was an afterthought added on, and is only beginning to fully mature. The PHP "culture" sometimes tends to care less about deep OO hierarchies because the language doesn't encourage it. PHP code tends to be an inconsistent mix of procedural and OO code, wherever the two are best suited. (This is not a criticism; PHP is my primary language these days too)

My suggestion would be this: Approach Java as though you are learning programming anew, though you already understand the important and fundamental flow control structures and atoms. Do not attempt to write Java code like it is a PHP web application, where the language sort of encourages a linear and procedural program flow. Use the time you spend learning Java to develop a strong sense of OO hierarchy and application architecture that you can spend years coding PHP without having to worry too much about.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.