Linked by Will Senn on Wed 30th Nov 2005 19:03 UTC
Features, Office This latest installment in the Core series from Prentice Hall PTR is a welcome arrival to the PHP/MySQL space. It is jam packed with useful information. At a little over 850 pages, this volume contains information on nearly every topic of interest in both the PHP and MySQL subject areas. The author, Marc Wandschneider, brings considerable industry experience to the book and it shows in the detailed explanations that fill every page.
Order by: Score:
Cue the PHP Bashers
by Anonymous on Wed 30th Nov 2005 19:55 UTC
Anonymous
Member since:
---

My beloved language gets trashed by those who think that every language should be able to compile itself and provide a object heirarchy comparable to that of Java. For the record: PHP was created for the web with simplicity in mind. It is not Java, Ruby, or C++, nor does it try to be. You may have an argument if comparing to Perl. You can program in an object-oriented way or procedural - whatever way you desire because it does not force you into a programming style. (Good or bad depending on who you are) My language userbase is mostly made up of newbies who've never programmed before and expect to put together a complex web application in 21 days - therefore my language gets trashed and so do the few hardcore web architects that use it. We don't simply "embed" PHP scripts in HTML, we use write-behind coding principles and however other slick way we want to show off. We produce fast, modular, secure code. Yes, in the PHP world you can have all three. There....I had to get that off of my chest. Cue the PHP bashers now.

Reply Score: 2

v ?
by Anonymous on Wed 30th Nov 2005 21:55 UTC
Maybe a little off topic, but ...
by WorknMan on Wed 30th Nov 2005 22:23 UTC
WorknMan
Member since:
2005-11-13

How does PHP compare with JSP? Do these two do the same thing?

Reply Score: 1

Charles A Landemaine Member since:
2005-11-11

PHP is less resourceful. JSP is used in large companies, but PHP can do 99% of what Java can do. Both have the same runtime speed nowadays. PHP with phpAccelerator is slightly faster, although you'll see a difference only on heavy-loaded web sites such as large forums. Development time is significantly faster using PHP than JSP, therefore PHP is prefered by small and medium-sized companies. PHP is open-source whereas J2EE is closed-source (SUN Microsystems). Both can access a wide variety of databases (PostgreSQL, Oracle, MySQL, etc...). Both use bytecode (code between script and compiled code). Both are OOP. Choosing between both as a user depends on your liking, philosophy. Choosing as a IT manager will depend on how much you can spend in workforce also.

Reply Score: 2

Anonymous Member since:
---

1. PHP is not nearly as fast as Java. A recent JVM performs about on-par with C++ (when programs are written for maintainability) and a little slower than C. Anything that needs to be fast in PHP has to be written in C, and developing those modules drastically reduces developer productivity. Try to write a TTS engine in PHP, and see if you can make it perform as well as freetts (http://freetts.sourceforge.net/docs/index.php#performance).

2. Development time for any nontrivial web application will be shorter in Java because of the vastly superior tooling support. It is far easier to drag and drop JSF components, with render kits outputting to HTML and WML, use declarative form validation, wire components to data sources with point-and-click, etc. than it is to bang out those features in PHP and debug a bunch of runtime errors.

3. There are several open source implementations of J2EE 1.4 -- Geronimo, Glassfish, JOnAS, and JBoss AS come to mind. PHP does not have equivalents to most of the J2EE spec, but is almost equivalent to the web technologies portion of J2EE (not quite because it has no equivalent for JSF, servlet filters, servlets, etc.). There are several open source implementations of that portion of the J2EE spec -- Tomcat, Jetty, etc.

Reply Score: 0

What version?
by Anonymous on Wed 30th Nov 2005 22:38 UTC
Anonymous
Member since:
---

The book seems good enough for me to buy it. But.. The review didn't mention what version(s) the book covered. PHP 5 is quite different from < 5, atleast when it comes to the OOP part.

Reply Score: 1

RE: Maybe a little off topic, but ...
by JaredWhite on Thu 1st Dec 2005 01:58 UTC
JaredWhite
Member since:
2005-07-06

Just to add to Charles' post above, PHP isn't exactly like Java on the OOP front mainly because PHP's core language is based around procedural C-like functions rather than a large built-in object hierarchy like Java. (IMHO, that's not a bad thing!) Otherwise, yes, PHP can do almost anything Java can do theoretically, so using JSP over PHP is mostly a "business" factor rather than a pure technical factor.

Reply Score: 1

gonzalo Member since:
2005-07-06

so using JSP over PHP is mostly a "business" factor rather than a pure technical factor

That's true, but still there're technical factors that do come into play.

JSP is just a part in the whole J2EE thingy, it's not even the whole 'web component'. As an anonymous poster said above, there's a lot of stuff more.
To make the point more clear, imagine you do the right thing with PHP and use some sort of templating system (e.g. Smarty) to keep presentation separated from logic. Then, you could compare that template system with JSP. (considering you don't insert logic code inside a JSP too)

Reply Score: 0

Java
by Anonymous on Thu 1st Dec 2005 06:35 UTC
Anonymous
Member since:
---

1. PHP is not nearly as fast as Java. A recent JVM performs about on-par with C++

BullfckingCRAP.

Java was not designed for web applications that need to execute in 0.1secs~. Also using C app through CGI is much more resource eating because of spawned new thread for each connection. PHP is lightweight and great for webapps that need to render the page in 1~ secs and do nothing more.

Reply Score: 0

RE: Java
by Anonymous on Thu 1st Dec 2005 08:00 UTC in reply to "Java"
Anonymous Member since:
---

Your understanding of CGI is incorrect. For CGI, the server forks a new process to handle the request. This has obvious scalability issues and is why servlets initially gained popularity.

However, I was not talking about CGI at all in my original post. I said that if you're developing something in PHP and need some computation to be fast, you have to develop that part of your project in C (or some similar compilable language). That is why the PHP XML libraries, for example, are not written in PHP whereas the equivalent libraries for Java are written in Java.

Reply Score: 0

RE: Java
by Anonymous on Thu 1st Dec 2005 18:11 UTC in reply to "Java"
Anonymous Member since:
---

PHP is lightweight and great for webapps that need to render the page in 1~ secs and do nothing more

Not that I like Java particularly, but you are comparing apples to oranges here. The standard model for Java web applications involves *constantly running* processes within the JVM that are then connected to by the instances of web requests in JSP (or whatever). Thus, Java doesn't have a serious per-page start-up penalty, because it is not parsing and executing a fresh process with the whole application stack each time there is a web request. (think: small front-end requests which simply handle GET/POST, etc... and passing off all the logic to the big backend). Obviously this means there is a bigger start-up time to the application as a whole. Re-starting Apache with a PHP application usually takes a few seconds, where a full Java web application might take a few minutes to fully re-start.

In order to truly compare PHP to Java in this setting, one would have to run a back-end tier in PHP, such as http://vl-srm.net/ or at least a set of standalone PHP processes with open sockets/pipes or some IPC mechanism, so that lightweight per-page PHP requests can connect to constantly-running business logic layers. Indeed, one wonders why this is not being done more often in PHP, because it could solve many problems, such as "application variables", multi-page database transactions, database connection pooling, lower start-up penalties for heavy applications, concurrency control, etc... Of course, most PHP developers don't really want to deal with these sorts of concerns.

I think in this setting PHP might still have faster raw speed, since it would also benefit from less re-parsing and execution of code, but I think once PHP were laden with as many libraries as Java, we might see things another way.

Reply Score: 0

Spaghetti
by Phuqker on Fri 2nd Dec 2005 11:45 UTC
Phuqker
Member since:
2005-07-17

I'm sure it's possible to write clean code with PHP, but every PHP app I've encountered has been utter spaghetti code because of its intertwined-code-and-markup model. This can be mitigated somewhat by abstracting your own custom objects/functions that generate sections of the page, but it's still ugly, ugly, and even uglier.

I prefer component-based (i.e., tag-library based) architectures, such as JSP, WebObjects, and ASP.NET. I'm particularly impressed with the latter two. Yes, yes, they are proprietary, and one is from the "evil" Microsoft, but origin aside, they are well-architected tools that produce some extremely clean code. (And for those who don't know, ASP and ASP.NET have nothing to do with each other. They are as different as C and Ruby.)

As for MySQL, I've never found it to be adequate. Yes it's fast, but it tends to be used by people who don't really understand proper RDBMS theory. You know, Dr. Codd, tuples, relvars, candidate keys, foreign keys, and all that good, important stuff. (Hint: slapping an auto-generated number column on your table does not make your data unique.) It tends to be used by people who want quick-and-dirty database solutions, because it lends itself to that. In my experience, quick-and-dirty may be great for your web code, but it's never a good idea in a database. Give me PostgreSQL, Oracle, DB2, InterBase, or MSSQL any day. I've used them all, and all of them are far superior to MySQL.

PHP + MySQL? I'll pass, thank you very much.

Reply Score: 1