Sunday, May 18. 2008PHP vs. JavaComments
Display comments as
(Linear | Threaded)
I'm sorry but I could not disagree any more, PHP is the promised land for the "not invented here"-syndrome. How often do you see large libraries re-used? Just look at all the hundreds of ORM/db-layer implementations we have lying around.
And trying to make the fact that many php-devs don't have a formal CS background and "need to look at other peoples solution to figure it out themselves" as a good point is just beyond me.
IMHO you often do not benefit as much of reusing code in PHP as you would in other languages because:
- you don't want to go the whole way (ORM is a good example there) - the code you need is so small that you can write it yourself But then still the best practices make the solutions very similar again. Even if the code is different (if the developers are experienced ones). Therefore "not-invented-here" might not apply to the actual code but to the concept. Regarding developers without in-depth computer science background: I think this is one of PHP's assets and fundamental differences to other languages: PHP tries to make coding so simple that even inexperienced users can do it right. These guys show their solutions and look at other's. This gives you a lot of simple examples you can work with as a starting point. IMHO this is an important aspect and always has been a driving force for PHP's success...
Well yeah there are a lot of PHP Developers without a CS backgrounds and that produces a lot of un-reusable code. I know some people who are not able to code PHP but able to find solutions by copy and paste some scripts. But if you have to change them later it´s horroble.
Right. But IMHO this is still better then the same persons trying to code something from scratch...
Well, I have a degree in computer science (MSc conversion course) and trained in Eiffel, Java and Visual Basic. I now use PHP as my language of preference because it avoids all the fiddly bits about connecting up the programming language with the internet, all of which has nothing to do with any real programming I want to do, and similarly all that messing about with the join between HTML and Java which is servlets (yes, I've programmed with them). With regards to borrowing: yes, I do from time to time - and reusability is in the programmer's book of virtues - as well as making my own stuff. I do the former where the nature of the beast is well-established and the latter where it is either a specific function of a new application or I'm just adapting something well-known to meet particular needs.
So you're saying that its a good thing that php developers often poison you're code base with code they found on the net?
imho this is the kind of mentality php should be struggling to distance itself from. If you only have people who copy code without understanding it, you are of course right. This is what you don't want. But then it's the people, not the fact that they let themselves be inspired by code they find on the net. Smart developers will search for proven solutions and they will see very soon if a piece of code is good or bad. They will isolate the best ideas and code something new which is hopefully better.
This post is pure, unadulterated flamebait. A lot of theoretical yapping without a single real-world example.
You are right in the aspect that i did not give examples and used a word like "not invented here". Will never do it again.
However, have a look at Plat_Forms. Cheers, Gaylord
A litte quote from "How to become a Hacker" from Eric Steven Raymond:
"2. No problem should ever have to be solved twice. Creative brains are a valuable, limited resource. They shouldn't be wasted on re-inventing the wheel when there are so many fascinating new problems waiting out there. To behave like a hacker, you have to believe that the thinking time of other hackers is precious — so much so that it's almost a moral duty for you to share information, solve problems and then give the solutions away just so other hackers can solve new problems instead of having to perpetually re-address old ones." I think this quote fits to the article
... and in our case, the thinking time of the hacker who solved the actual problem once, is valued even more by hundreds of people takign this solution and building their code according to the precious hacker's ideas.
Problem solving is not only the code, it is the ideas behind it. And especially in the PHP wolrd, if the idea is great, the code might only be a few lines...
I think you must use PHP where you find it useful,
Java and C# can be also use where you need to write compile code. Happy coding.
ColdFusion takes half the time to code and is more scalable than PHP. The only benefits which PHP have are that it is free and that it is popular.
Furthermore, it is multi-threaded and can use any Java class as easily as if one were writing directly in Java.
HipHop for PHP transforms PHP source code into highly optimized C++. It was developed by Facebook and was released as open source in early 2010.
HipHop transforms your PHP source code into highly optimized C++ and then compiles it with g++ to build binary files. You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features – such as eval() – in exchange for improved performance. Facebook sees about a 50% reduction in CPU usage when serving equal amounts of Web traffic when compared to Apache and PHP. Facebook’s API tier can serve twice the traffic using 30% less CPU.
True, HipHop is cool for companies like Facebook. In my experience, most performance problems result more from bad architecture/design than from pure php execution speed. When you have optimized out your code and scaled already to a couple of hundred servers, HipHop might be an option. But below that, i would discourage its usage since it is not only "eval" that is not working...
nice post but your have discussed java rarely yea php is powerful in web because its servers are cheap as well as development is far more cheap than dot net but you are comparing php versus java come one php is just web programing what else do it build but java it is used in enterprise level possibilities are endless but take a look at some features of java networking, multi threading, game development, software development, web development, algorithm problem solution and many many more do you still think you are comparing a scripting language with java
Oh sorry. Did i forget to mention that i am talking web development here? But on the other hand: Service Architectures more and more tend towards Webservices and Applications become more and more web based (even ERP and CRM these days).
But true: When it comes to sophisticated algorithms and number crunching, PHP is not the language of choice. On the other side, there are A LOT of very successful browser based massive multiplayer games built in PHP. Multi Threading is something PHP lacks on purpose to stay simple. There are methods in Web Application design how to get around this while keeping the application itself simple. Algorithm problem solution with big computing requirements is usually left to external systems written in C/C++ that are then either embedded into PHP with an extension or via webservices. Therefore: Yes, PHP is not a general purpose language. And yes: Its execution is not the fastest. See it more like a glue language to connect different C-Libraries and Webservices in a very simple and elegant manner. For this purpose, it works great!
PHP is definitely a lot cheaper in the long-term, compared to Java (infrastructure, tools, developers, project times)
|
Calendar
QuicksearchCategoriesBlog AdministrationTop ReferrersChoose Language |
|||||||||||||||||||||||||||||||||||||||||||||||||


Tracked: Apr 23, 08:54