开发者

Java book for experienced programmers (PHP)

开发者 https://www.devze.com 2023-01-27 19:00 出处:网络
I searched on few questions earlier asked here but my context is not matching exactly to them. I am working on LAMP from past few years. I recently learnt Java SL-314 Syllabus thinking my knowledge in

I searched on few questions earlier asked here but my context is not matching exactly to them. I am working on LAMP from past few years. I recently learnt Java SL-314 Syllabus thinking my knowledge in PHP and other PLUS some knowledge in core Java from Oracle website can be helpful. I saw Java document is very poor compared to PHP. In PHP, one can get everything basic from the php.net site itself. For a simple thing like showing the resultset data to servlet or JSP from plain java code, I need to search a lot and still I cannot get past ArrayList etc. I was looking for a code in Java like this in PHP:

while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
    echo $row["userstatus"];
}

I mean I want to use all fields the way I want.

I have a book, 开发者_如何学CJava in Nutshell but that seems too theoretical. I need small book so that I can read it soon. I want to develop web app using Java. For getting help from core java, I want simple example codes to do all normal work I used to do in PHP.

Please help me find simple Java book with example code which can help me do all normal stuff one do in PHP.


I strongly suggest you don't just try to do what you've been doing in PHP. Learn Java properly instead. You say that Java in a Nutshell is too theoretical - but I'm afraid it sounds like you're just being impatient.

It's well worth learning these fundamentals properly, rather than making assumptions about Java working like PHP. It will take you a bit of extra time in the short term, but will pay huge dividends later on. If you try to write Java like it's PHP, you'll end up with mongrel code which will be horrible to read and debug.

Learn the Java idioms. Learn about how the language works, in terms of classes, primitives, inheritance, methods etc. Learn the core areas of the frameworks - text, numbers, collections, IO. (Don't use the built-in classes for date/time manipulation though; use Joda Time for that.)

Once you've got the basics down, then you'll be in a good position to start learning more specific technologies, such as web frameworks. If you don't know the basics though, then as soon as you hit a problem you won't know whether it's an issue in the web framework or your core understanding.


Having recently moved to Java from other programming languages, I found little books like "Java phrasebook" by Timothy R. Fisher particularly valuable, as they contain many examples about pratical topics (strings, data structures, file management, db connection, xml parsing, threads,..): they will not make you a guru, but at least you can get immediately in touch with the language.


If you want to do the jump to Java, try getting aquainted to Project Zero or Quercus (simpler) first. Both are PHP-implementations atop Java and allow interfacing to other Java frameworks. This might allow you to more gradually transition between the two languages and environments.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号