Scriptiing The Enterprise With Java And PHP
jontr writes "There are many benefits of using PHP together with Java. In an article about JSR 223, Dejan Bosanac looks at origin of each language and describes future benefits for PHP and Java developers."
OK, that was not what i was expecting.
I was sort of expecting auto-generated scripts for star trek...it's time to go to bed.
If Mr. Edison had thought smarter he wouldn't sweat as much. --Nikola Tesla
If you want to do some quick and dirty job, use PHP. For larger projects, JSP and J2EE make more sense. I don't see any valid reason to mix PHP and Java together at all.
I didn't know that PHP didn't scale well. Then again, I just use it for hobby sites.
How does Yahoo! use PHP? Do they generate static HTML snapshots or something?
The article was really short....what will PHP5 do to help scalability?
More than enough BS
I just... cannut... dooo it, kaptain!... the damned server j'st dunnit have the POWAH!!! Filthy cyrix piece of jun'k. I've seen Klingon garbage scows with bet'er processin' units than theeeze. Ah mean, you cannut really expect meh to be able to run a business on THIS kind of processor!
Tho I may be able to give ya' warp three...
Informatus Technologicus
What makes PHP great is an impressive set of embedded libraries, easy integration in an already existing plain HTML document and POST, GET, cookie, session management.
Look at this beast: *SQL*, FTP, zip, flash, XML, gettext, image manipulation, LDAP, UNIX process control... all rolled-into-one language. Wow. Perl is, in that respect, with the right CPAN modules, as nice as PHP, but dare I say... easily obfuscated?
PHP had (still has in 5.0?) enormous deficiencies and bugs in its OO model. Works great for quick pages, but as the article says, does not scale well.
So, why insist on keeping PHP for large-scale sites instead of plain java? to use PHP's libraries, HTML integration and web-oriented features, that's it. An artist can draw a page in his favorite application, export to HTML, the coder only has to fill the blanks.
The language in itself has no advantages. If java had all these libraries and "native" web access, why would we consider "merging" these two languages?
Think of it, two interpreted languages joining forces to drain down CPU and memory...
(just my two cents)
All of the problems I have with the existing methods of JavaPHP integration look like they should be fixed.
Not being able to use references is the most crippling aspect of the SAPI interface - well that and the fact it is completely unreliable. :)
Q.
Insert Signature Here
Business Logic
Java - Good
PHP - Bad
Presentation Layer
Java - Bad
PHP - Good
Now if you can use the good aspects of both of these languages (ie. Java for business logic and PHP for presentation layer) then you get Good + Good.
Currently they integrate both unreliably and limitedly - This project is designed to fix these shortcomings (initially for PHP, but using it as a template for further scripting integrations).
NB: Troll complete
Q.
Insert Signature Here
With regards to caching, server farms, execution speed etc. PHP does indeed "scale" quite reasonably within its limitations.
However, if you are ever involved in building an enterprise level application using PHP alone you will become intimately familiar with its limitations, particularly it's semi-OO implementation (ie. no provision for protected members or private variables).
Compared with the equivalent Java based business logic, the PHP code is a nightmare to maintain. This isn't helped by it's restrictive OO model...
Q.
Insert Signature Here
Come on, why whould you want to slow down a very fast interpreted language by combining it with a very slow bytecode based language with function.calls.that.are.like.this.out();
What freedom and what was making it more time consuming than PHP?
I have to agree with the previous poster that JSP offers the same functionality as all of those nice libraries PHP comes with. I don't see where PHP offered such a significant advantage over JSP that you would choose it over JSP when developing a web client. I have used both JSP and PHP on several project and both worked very well but I wouldn't mix them together unless it was absoultely necessary. If you are starting a new project with Java, I would highly recommmed using JSP instead of PHP. JSP has come along way especially since the advent of JSTL (which I continually praise on Slashdot everytime a Java article is posted ;-) ). Mixing technologies should be done only when absolutely necessary (i.e. integrating C and Perl for necessary performace gains) as it's generally much more difficult to debug and maintain by a group of developers. Although there are alot of developers that are very skilled in more than one language, there are many who are experts in one language and are remedial in a few others.
I am not flaming PHP. Dynamic websites can be constructed quickly and easily and it is a nice language in which to develop. if you have an existing Java codebase and you wish to add a web client, I would strongly recommend using JSP instead.
OOGG lack much experience in PHP, but have much experience in stone age OO design.
OOGG confused by combined complaint of "restrictive OO model" and "no provision for protected members or private variables."
PROTECTED MEMBERS, PRIVATE VARIABLES ARE RESTRICTIVE OO MODEL. OOGG use simple stone-age example. OOGG HAVE STONE WHEEL. USE AS WHEEL. SOMETIMES, WANT ACCESS TO HOLE IN CENTER. Some programmer say that hole "protected implementation detail." OOGG think OOGG NO CARE WHAT YOU THINK AT DESIGN TIME. OOGG NEED HOLE ACCESS. OOGG NOT WANT BE FRIEND WITH ALL YOUR CLASSES, JUST USE HOLE!!!
OOGG not like restrictive OO model, INCLUDING not like often useless "protection" features. In general, programming languages ineffective tool for preventing stupidity. Should rather use club on head of stupid programmers. Darwinian process then result in smarter programmers, less outsourcing to foreign caves.
Object Oriented design has always given the illusion of ease. Simple C or perl based structured programming can get the job done in a far more intuitive way, especially in enterprises.
In an enterprise there might be many departments located in different places with different needs. There will be varying levels of security and many coders working on various modules and expecting them to interconnect stably. Many customized clients will connect to the same centralized databases and perform standard transactions after being authenticated. The authentication structure itself will be distributed (LDAP?).
So a set of standards should be made and well-documented on how the clients will authenticate and how the transactions will be made. Sample clients would be developed and distributed with their sources among the departments/branches which they will alter and customize. They could do all this with Java, C, C++ or anything else. Now since the universities are spewing out tonnes of low-cost Java developers, thats the language of choice. Quite unfortunate if you ask me.
"Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
One thing I like about Java compared to PHP is that I never have to recompile my servlet engine to add features. For example, I spend too much time getting pdflib to compile/install itself into php, but adding similar features to java requires dropping a single jar file in the correct directory. Same with imap support or anything else. It gets even better when you develop on your x86 desktop and deploy to a Sun machine or something else. The same jar file works everywhere, instead of figuring out how to compile on two platforms instead of one.
Database independence is already there also, you don't need to choose from 4 wrapper layers like PHP has.
Do the editors have a spell checker? Do they have bosses who care?
I feel fantastic, and I'm still alive.
I know this article is about combining Java and PHP, but has anyone noticed that JSP has overtaken PHP at least from the standpoint of session cookie default names. It didn't used to be like that. PHP always points out the mod_php numbers, but there is no direct JSP Apache module, only mod_jk which is for any servlet container. I think that's interesting.
A programmer is a machine for converting coffee into code.
but PHP was designed for page centric architecture
So? The "separation of presentation from logic" is often overdone in my opinion. It often results in having to make changes in TWO places instead of one when you add or alter UI elements, and you cannot switch from say desktop-targeted-HTML to PDA in a one-to-one manner anyhow. The application needs to be repartitioned for such often. People often get such "mantralets" in their head and have to be slapped out of it.
with very limited support for object-oriented programming
Some of us think that OOP is oversold. I have yet to see a convincing example or argument. OO fans cannot even agree exactly on why OO is allegedly better. For certain network protocols I suppose it makes it easier to swap implementation with another vendor, but only if both vendors use the same exposed protocol, which they often don't anyhow. You can wrap them in functions just as easily as in classes in order to provide the same interface.
Also, there was no system support for transactions,
Isn't that the database's job?
[no support for] software components
Huh? PHP is full of existing "components". The component model is often not appropriate for business logic/modeling anyhow IMO.
PHP does not scale well and there is no easy and standard way to make a cluster to achieve better scalability.
Tell that to Yahoo, who adopted PHP.
So, if you are PHP developer and your project is getting larger and larger every day, and the scalability is your main issue, try to force MVC
Hasn't MVC been discredited? There are a lot of complaints about it in techie forums.
One thing I really miss about PHP is named parameters. I would like to see the team work on that rather than things like "better" OO.
Table-ized A.I.
And in my opinion everbody who reads Design Patterns should be aware that most of them are really bandaids for symptoms of limited and limiting languages like C++ and Java. Learn Common Lisp CLOS and discover just how much Java sucks.
Amen! GOF Design Patterns are for people who either use shitty languages, or don't know how to use relational properly, or both.
After describing two ways that one can (somewhat inelegantly) bridge PHP with Java using current technologies, the author of this article then mentions Erik Hatcher's weblog lamenting something to the effect of 'it would be nice if this were not limited to serverside app development'. I find this interesting, because there is a great scripting language (Python) which already has a Java-compatible implementation (Jython) -- so compatible that the language is actually written in Java and runs in a JVM! Yes this means you can access just about any Java class from a Python script, and not only that, the final Python scripts are Java executables.
"First you gotta do the truffle shuffle."
I write all my webpages in C++.
Marxist evolution is just N generations away!
Are you insane???
"Suffice to say that PHP may not shine under YOUR design methodologies."
Ummm, well actually I have used to create several major sites - but I am not blinkered to it's limitations (and kudos to Rasmus and Co. for creating such a kick-ass OSS scripting language).
"I doubt any one language shines under all methodologies."
I don't know - they all seem to work OK in machine code... but thanks for stating the obvious...
"...that does not mean that it does not give decent performance under other design methodologies."
*SIGH* If you bothered to read my quote rather than just cutting and pasting it you would have noted that it was not referring to the performance of PHP but rather it's maintability.
I would have posted that drivel as an AC too...
Q.
Insert Signature Here
Note: I should probably have used the term "incomplete" (set theory, not opinion) OO implementation, instead of "restrictive OO model". So fair criticism Cavey.
"Some programmer say that hole "protected implementation detail" - indeed as they have another obtuse use for that hole that you in your particular cave of the woods has no idea about.
So instead of determining the reason for this restriction (if arbitrary it should be removed) you go ahead and f*ck with the hole on your "wheel".
Unfortunately, that wheel is part of a cart that is used to haul (lets say) Mastadon meat back to your tribe. The hole of the wheel has been enlarged by OOGG and continually falls off the carts axle.
The rest of the tribe beats OOGG senseless with his wheel, repair it's hole, and return home.
Not to indulge in your fantasy to far Cavey, but it seemed such a nice analogy to maintenance of a large body of code (neadertals roaming the forest, scratching their heads, clubbing the sales department and grunting occasionaly - perfect).
Q.
Insert Signature Here