Java vs PHP for web applications
#1
Posted 16 January 2008 - 10:13 PM
Java
+ Good structure and documentation. Standardized class and method usage.
+ Perfectly OO
+ Strongly typed
+ No include problems, just have the classes in the classpath
+ Easy to use frameworks like Spring
+ Database libraries like Hibernate
- Big overhead for quick or small applications
- Virtually no shared hosters available
PHP
+ Easy for quick/small sites
+ Lots of hosters
+ Easier for beginners (?)
- Part OO, part procedural. OO part is not quite good.
- less libraries available
- hard to structure applications, need to include a lot of files. requires a lot of discipline
- function usage not consequent
- weakly typed, can introduce bugs and security errors
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#2
Posted 16 January 2008 - 10:45 PM
My Political Compass
Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.
#3
Posted 19 January 2008 - 07:17 PM
Is it a bad thing that it also supports procedural? You don't need to get into the whole OOP madness to write a short script when you need it. Other than advanced OOP stuff like observers or the useful stuff like namespaces I don't really see PHP needing much more really.- Part OO, part procedural. OO part is not quite good.
They are quality though. I'd complain more about the limited extension possibility for PHP on shared hosts (adding libraries is impossible without owning the server) that basically make coding for any library that is not included with PHP as well as enabled by default pointless.- less libraries available
How is that? It just needs you to establish your own convention rather than running around with one that the language imposes. One might argue that it's better that way for beginners and advanced coders alike.- hard to structure applications, need to include a lot of files. requires a lot of discipline
What do you mean by this?- function usage not consequent
I agree that it could use strict type casting as an option (throw an error when a variable specifically assigned as an int is overwritten by a string) but that's about all. PHP5 classes are more strict when coded properly, and thus easier to debug - but PHP still parses the basic structures that worked in PHP4 for that beginning level.- weakly typed, can introduce bugs and security errors
ARGUMENT FROM CREATION, a.k.a. ARGUMENT FROM PERSONAL INCREDULITY (I)
(1) If evolution is false, then creationism is true, and therefore God exists.
(2) Evolution can't be true, since I lack the mental capacity to understand it; moreover, to accept its truth would cause me to be uncomfortable.
(3) Therefore, God exists.
#4
Posted 20 January 2008 - 01:40 AM
supporting procedural is not bad, but mixing it with OO is smelly IMOIs it a bad thing that it also supports procedural? You don't need to get into the whole OOP madness to write a short script when you need it. Other than advanced OOP stuff like observers or the useful stuff like namespaces I don't really see PHP needing much more really.
i actually meant libraries coded in php, not the thing you use to extend the php runtime (like gd)They are quality though. I'd complain more about the limited extension possibility for PHP on shared hosts (adding libraries is impossible without owning the server) that basically make coding for any library that is not included with PHP as well as enabled by default pointless.
unless you have a good system (which beginners dont have), you can really mess up the includes in php.How is that? It just needs you to establish your own convention rather than running around with one that the language imposes. One might argue that it's better that way for beginners and advanced coders alike.
that function names are not consequent, and their usage differs a lot. for example, in one function you put the source first, then the destination. in another, it's the other way round.What do you mean by this?
i also have two new cons to add:
- no exceptions
- every class and function is reloaded for every page that is executed. a java application server loads the apps and keeps it running
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#5
Posted 20 January 2008 - 02:30 AM
I just wrote a site for a client, which contains several little php scripts. Nothing big, but you don't need any major programming to make a dynamic site with some powerful features. I think the best example of this is just the simple <? include(); ?>. With no programming ability I was finding it easy to manage and keep data up to date across a range of pages. And I don't know if you can do similar with java, or wouldn't have to because its all running in the app, but I think every beginner here should go out and learn a few basic php functions, because you don't need to be a programmer or doing anything complex for them to be really, really useful.
World Domination Status: ▾2.7%
#6
Posted 20 January 2008 - 11:42 AM
That's not really a bad thing the way I see it though, just yet another school of coding. It's simply using objects to support procedural code, so there is no need for half a million classes in a built up application. How clean the code will be in the end depends fully on the coder.supporting procedural is not bad, but mixing it with OO is smelly IMO
Well in that case you should know the site http://phpclasses.org and see that this really isn't a problem. There is enough libraries for anyone there, and quality too.i actually meant libraries coded in php, not the thing you use to extend the php runtime (like gd)
That really depends. In the end beginners just seem to shove everything in one directory regardless and while that might seem like a big mess of files it is less tedious for the beginner to learn that way, and over time he will realise that there are better ways of segregating files.unless you have a good system (which beginners dont have), you can really mess up the includes in php.
Yeah, this has been haunting PHP since version 3..that function names are not consequent, and their usage differs a lot. for example, in one function you put the source first, then the destination. in another, it's the other way round.
Dead wrong. http://uk3.php.net/exceptionsno exceptions
While reloading everything is a native behaviour of PHP, I believe opcode caches and bcompiler more than make up for this, also taking into account the general slowness of Java. The only problem here is that both need serverside configuration, which is not possible on shared hosts. Shared hosts also rarely go out of their way to actually enable different PHP features, simply installing it instead and just using it straight out of the box.every class and function is reloaded for every page that is executed. a java application server loads the apps and keeps it running
ARGUMENT FROM CREATION, a.k.a. ARGUMENT FROM PERSONAL INCREDULITY (I)
(1) If evolution is false, then creationism is true, and therefore God exists.
(2) Evolution can't be true, since I lack the mental capacity to understand it; moreover, to accept its truth would cause me to be uncomfortable.
(3) Therefore, God exists.
#7
Posted 20 January 2008 - 12:43 PM
now there you are wrong. jave being slow is a prejudice from it's beginnings, but these days it's almost as fast (and sometimes faster, yes it's true) than native apps.also taking into account the general slowness of Java
ok so it does support exceptions now, i didn't know that, and it's good. still, the standard functions that have been around before 5 don't use them (AFAIK).Dead wrong. http://uk3.php.net/exceptions
Anyway, I partly agree with you and Jeeves in that PHP is easier for beginners. Personally I find Java to be better when you're getting into bigger applications (web applications vs dynamic web sites).
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#8
Posted 30 June 2009 - 10:15 PM
And I've also found that PHP, classic ASP as well, are more efficient since they communicate directly with the HTML instead of using an intermediary. Maybe that's just me though...
NZ.org | BBPCG
Discord: The Astronomer#1314
Steam
#9
Posted 05 July 2009 - 02:12 PM
Try telling my unis Blackboard thatI'll go so far as to say Java is rather slowish but it's not so slow that there's a noticeable difference
Not only is it unbearably slow but has caused issues in firefox on vista disabling the WDM. And there is no way viewing a web page should ever f*** up your display and OS's window management. EVER.
And attending a uni that receives a lot of M$ sponsorship, I'll admit .NET does have its uses, but I'd still push PHP for general use.
World Domination Status: ▾2.7%
#12
Posted 10 July 2009 - 03:52 PM
#14
Posted 11 July 2009 - 03:37 PM
#15
Posted 11 July 2009 - 06:57 PM
Flash is great for specific things but an entire website is not one of them.
Edited by Beowulf, 12 July 2009 - 08:11 AM.
NZ.org | BBPCG
Discord: The Astronomer#1314
Steam
#17
Posted 11 July 2009 - 07:42 PM
QFTFlash is garbage for everything but games, video players and humorous animated videos.
My Political Compass
Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.
#18
Posted 11 July 2009 - 07:49 PM
Why? I understand the importance of proper markup better than most, but why in webmail?Webmail? No thanks. Use JavaScript if it has to be very interactive, but for goodness sake keep proper markup.
I don't think Thunderbird or Outlook are made of proper markup, yet they do fine
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."
#20
Posted 12 July 2009 - 11:23 AM
My Political Compass
Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users