The PHP Singularity
An anonymous reader writes "Jeff Atwood at Coding Horror has a post about the awfulness of PHP — or, rather, a post about posts about the awfulness of PHP. He points out that PHP has been the whipping boy for the developer community for years, and while everybody seems happy to complain about it, nobody seems willing to do anything about it. He writes, 'From my perspective, the point of all these "PHP is broken" rants is not just to complain, but to help educate and potentially warn off new coders starting new codebases. Some fine, even historic work has been done in PHP despite the madness, unquestionably. But now we need to work together to fix what is broken. The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.'"
And now, a post about a post about posts about the awfulness of PHP.
Which would make these comments posts about a post about a post about posts about the awfulness of PHP.
---
Recursion: First you curse, then you curse again.
What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.
Yeah, lets start by making PHP case sensitive.
Another day closer to redwood heaven
People do something about it EVERY DAY: they use something else.
Rubbish - PHP is brilliant.
The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.
I think he's proposing that somebody starts a marketing campaign to trick/convince all the PHP developers to switch to something better because clearly, Outstanding = Great PR.
I hear that this Streisand guy does a great job of bringing things to the attention of the general public; he'd be perfect for the job.
It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others. There is no "fixing" necessary, just phasing out -- and the only code related to PHP that needs to be written, if any, would be interfaces for better languages, so that old, impossible-to-rewrite code can be extended with something that is not PHP.
Palm trees and 8
if php is broken what is javascript?
if one is happy with PHP and has still not encountered peculiar problems?
PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both). If you code well, there's very little to complain about with PHP. I've hired java guys onto my php projects before, and they were up and running in a week or so because we were coding with some structure instead of slapping together hacks.
And personally, I wouldn't want it any other way. I don't want language designers deciding they know what I want to do better than me. What I want, is the flexibility to build things as I see fit, and to do so quickly. Production is my goal. If you can help me build my projects elegantly/etc, then great, but getting it built quickly is always my priority.
It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others.
None of these languages use standard C-style syntax. That syntax is one of several reasons why PHP is so ubiquitous: any reasonably competent C/C++/Java programmer can adapt to it quickly.
Any good programmer will be able to make awesome PHP code. Bad PHP written applications are just the result of lack of passion, knowledge, and in some cases don't forget it, pressure from the customer. Combine bad programming skills, no experience with other OOP languages, pressure and "I don't care how it is done, I've done it and it works that's enough"... and you get the result. I'm tired to read and hear that PHP is shit. -- ParaBug
Is anyone aware of an alternative php interpreter that does not require tons of external dependecies? I have been playing with porting various stuff to less usual operating systems and PHP has definitely been one of the most dificult things I have undertaken. It requires quite a lot of other packages to first be ported.
Just replace standards with languages.
"A person is smart. People are dumb, panicky dangerous animals and you know it." - K
Years ago I was involved with PHP, and the core developers have no real interest in making anything better, or, more specifically, accepting any criticism. I'm not the only developer to be pissed off when decisions are made "off line" and passed down. There was no sense of community. In conversations with other would be contributors, the general consensus was the PHP was headed up by a bunch of pissy children.
Don't get me wrong, I think PHP is a powerful environment and a lot of things have been done with it, but it suffers from a lack of rigour. If they could decide *what* the hell the language wanted to be, that would be helpful. If they could clean up the extensions API that would be helpful too. PHP's extensions are so powerful but there is no abstraction, your extension is essentially a PHP internal module.
All in all, PHP has had power and potential for years, but the reason why ruby even had a shot was that the PHP project can't get its act together to address, or even acknowledge, its short comings.
The one big redeeming feature of PHP is you set up a single DB server (or even multimaster) plus multiple webservers, and bam! You're sharing objects/sessions among the webservers. Doesn't matter what webserver the next request hits, the session's there.
By contrast, that simple thing is something that other environments struggle with. I remember ads for "Share Java POJOs" as if that was a huge deal, and the CEO of some firm that did that said people told him that was a godsend. I'd imagine it's the same for Python and Ruby.
1. Java. Huge memory footprint. Admins hate it because it doesn't conform to certain Unix conventions.
Try this: Download any one of a number of open-source Java CMSs or ERM systems. Then watch the Java exceptions flow down your console screen. Good luck figuring them out. Static analysis rules, except when it doesn't.
Java's great if you're writing an desktop app for geologists trying to find oil or a backend bank system. For your average, ho-hum, billion-dollar website: not so much.
2. Ruby: You go to war with the webserver they give you, not the one you want.
3. Python: Great language and library. A shame it was hobbled by the whitespace issue, which meant that some programmers didn't check it out who should have. Anyway, it's hard for Beta to get traction against VHS.
Anotherwords, PHP is good enough. "Worse is better."
Since the three environments above are monolithic, if there's a problem, it's a problem for every client logged in. PHP, by contrast, follows a Unix minimalist philosophy: if a PHP FCGI instance (or even an Apache mod_php instance) crashes, it's just that one instance. No problem, user hits F5, reloads, PHP's stateless, you get the session back, keep calm and carry on.
When Marc Zuckerberg or a number of other entrepreneurs started hacking out Facebook, they started out with PHP, just because it's light and fast, and easy to get something up on the wall. Nobody cares about the elegance of Python or Ruby, it's all about time to market.
Finally, nothing about "you can't debug PHP", in today's discussion, please. You can very well step through PHP code. Use Netbeans and something like xdebug. Or Eclipse.
PHP: Paraphrasing Churchill, it's bad, but the alternatives are worse.
I'm not a lawyer, but I play one on the Internet. Blog
The article is completely devoid of anything original, useful, interesting or information. It's just a collection of links of previous rantings but with boring metaphors and analogies.
1. No it isn't
2. Not really
3. C is increasingly a bad structure for languages, as improvements come in
... FTW! \o/
now we need to go OSS in diesel cars
In what way does it "live in the browser"?
systemd is Roko's Basilisk.
Going to Perl where I can get a simple concise syntax that is always the same among different programmers and does not have any idiosyncracies and enforced consitancy everywhere.
http://saveie6.com/
Although this complaint is merely a cry for PHP to receive fixes in its code, I have read on the web that a major issue with PHP has to relate to hashes. According to LWN.net, a denial of service can occur when the hash functions are put into excess which will cause the system to become unresponsive and cause denial of service.
Yes, I do agree with my peers. The largest benefit to PHP is its C-like syntax, and TIOBE.com lists C as the top language followed closely by Java, C++ and then Objective-C, which is C with Smalltalk.
That's what major version bumps are for.
People will stick with the old major version if shared web hosting companies don't allow hosting customers to run an app for one version and an app for another version on the same hosting plan. Even outside PHP, that's one reason Python 3 isn't taking off as fast as was hoped: the operating system doesn't know which major version to execute when the user double-clicks a .py file.
If PHP were as awful as the author claims, "Some fine, even historic work has been done in PHP" would not be possible.
Coders without the most basic grasp of object oriented designed, initial variable initialization, white-space use, code flow, etc are the problem. Languages that try to force coders to not be retarded are not the answer. It's very easy to spot coders you should never hire if they use a language that lets them reveal their ignorance and lack of organization skills.
It's far easier to modernize code while maintaining the same core language than it is to completely start from scratch with a new language.
While PHP's OO functionality is pretty lousy up until 5.3 when it finally got late static binding, it is perfectly sufficient and no excuse for crappy spaghetti code.
Work Safe Porn
Am I the only one that's already starting to see similarities between PHP and COBOL? Both languages are designed for "non programmers". Both languages have a multitude of projects written in them.. and I suspect in 30 years, some of those web applications will still be running on "legacy" x86 hardware rather than ARM or whatever we'll all be running then and every young programmer will be complaining on their blogs or whatever about how bad of a language PHP is and why anyone ever made any project in it.
Dead on. As an old PHP user I'd go further and say PHP's story is a cautionary tail for all those "alternatives". PHP is open source but really controlled by Zend. To wrench that control away from them would not be worth the effort.
Ruby and Rails (what I use currently) are just this side of out of control. Assembling a stack that works (an often unique collection of Gems, Ruby, and Rails versions) is touchy and when you get one that works you don't want to futz with it much. So the community has created ways to lock down everything and swap out whole dev environments when you work on different projects.
This is a little understood problem with OSS. Either the contoling party is asleep at the wheel or it is community controlled and tetering on the verge of chaos. Always look at control and community before picking an alternative.
I would be less quick to blame PHP than blame the fact that many PHP programmers come from "Web" developers. People who started with MS Paint and some HTML, then some CSS and then jammed in some PHP. After a while they got pretty good at small PHP 50 line programs. But when faced with huge projects people like this just aren't prepared. A great programmer could use PHP just as well as any other language.
But the second half is that PHP should be bad at times. Often a simple unstructured script is the best. It needs to do a simple thing quickly and well. There is no need for templating, language abstraction, unit testing, separation of data, logic, and view. So if you are a bank deploying a mission critical system then it should be rigorous and perfect. But if your blog about car tires needs a widget that reads from your odometer then hack away.
I would say that all arguments that condemn PHP should whither under the light that Facebook was developed primarily in PHP with MySQL. Even now they have their Hip Hop that converts PHP to C++. Arguing against PHP is like saying that Carbon Fiber is a better material than steel for car frames. Absolutely true but most cars are still successfully made from steel for a wide variety of reasons. Next time I need to win an F1 challenge and it had better be Carbon Fiber. But for the next ride to the grocery store and I just don't care.
So to circle around one could argue that the best cars are made from this or that but the reality is that what made the truly terrible cars terrible was that the designer would have made a terrible car out of anything. So teach a "better" language to the people making messes with PHP and you will just have a different kind of mess.
I've programmed in every major language and several minor ones from the 1970's to the present day, never mind design methodologies. They all have their relative strengths and weaknesses, but at the end of the day, the only thing that really recommends one over the other is a) what's available, and b) what you're most familiar with. No widely used language is "broken" any more than any natural spoken language is broken. No one ever says, hey, this novel would be much easier to write if we were taking advantage of the greater expressive power of Indonesian instead of kludgy old Lithuanian.
Aside from juvenile cliquishness and fashion obsession, every language flamefest starts with people obsessing on some awkward feature of the dominant language du jour, and then concluding that all of their problems would be solved if we all switched to some other language without that awkward feature. Of course, tomorrow's language (or methodology, editor, coding standard, platform) has its own awkward qualities that will only become apparent once it collides with the real world on a large scale, setting the stage for the day after tomorrow's language. Rarely does anyone pull their head out of their compiler/interpreter long enough to recognize that it's the real world that's awkward, and no amount of switching between fundamentally equivalent machine-parseable languages is going to change that.
Instead, we keep implementing the same stuff over and over in one language after another until the pace of real progress slows so much that we can actually get excited that the document viewer we're trying to port everything over to is receiving a "major" new features in HTML5 that will allow it to get a little closer to matching the desktop GUI functionality of twenty years ago, only not as well and with the added requirement of several orders of magnitude more hardware power required to keep it going.
But by all means, let's get rid of PHP if that makes it easier to imagine that we're doing something besides reinventing the same old wheel and doing it badly.
Proud member of the Weirdo-American community.
The C-like syntax and wrappers for all sorts of handy stuff like POSIX threading, sockets, SSL, etc is why I like PHP. My biggest issue with PHP is that these functions are poorly documented (especially the SSL wrappers). I am not a language purist, I want something easy to use, gives me access to all the nifty stuff Unix can provide, and doesn't make me learn an entirely new syntax. If I was a professional programmer I might feel differently, but for MY needs at my job and for personal projects PHP is a good tool.
I really shouldn't have used someone else's email address for this account.
The assumption in TFA seems to be that PHP does something that couldn't be done otherwise now, or does it more easily, or something. But I don't think that's true. There are alternative languages and alternative ecosystems now. IMO, most PHP coders don't use PHP because they have looked at the alternatives and decided PHP is the best choice, or the least bad choice, or any other choice. People use PHP because either
1: It was forced upon them for some reason or
2: It was the first thing they found and it was good enough
If that's the case, it's irrelevant how fantastic the alternatives are.
Also, while PHP code can be truly terrible, people who are determined to write terrible code will do so whatever the tool. You can use almost anything as a hammer if you try hard enough. The myth that The One Right Language somehow makes bad programmers good is still alive, especially within the Python community, but it's stll a myth.
When good programmers have no choice but to use PHP, they'll find a way to build something that is workmanlike even if it isn't beautiful. When bad programmers program, the result is going to be bad regardless of the language.
Virtually serving coffee
... or maybe is all the cloud the problem. Maybe isnt just the language itself the problem, also the culture behind it, people that did it, that contributed to it, tools all around that helped or damaged it, and, of course, the ones that try to use it as a normal hammer instead of the double-clawed hammer that it is. Changing the language alone won't change the other factors, and a in a used enough language you don't take a photo, you get a whole process where all the factors take part, a full ecoystem is behind. i.e. take another language, like python o ruby, and try to put the same ecosystem behind it, fullfill the same requirements, with the same people, probably would get to the same place.
What are the alternatives? A closed/comitee ecosystem? Strong approval policies to accept contributions? Maybe some of the good things of PHP came because is not that way.
You can always take your prefered language, and build around it most of the tools/libraries/etc that made php popular, with as much points of common as possible, but with the bad parts (for some definition of bad) out. But there is more than just code what will make it succeed or not.
Python has *always* been obviously better than PHP (or perl, etc.) But if you have no skills, you look for the easiest path: the goal is to get the project going.
If your expertise is Perl, climbing the Python learning curve, gentle as it may be, isn't attractive, and becomes less so as your available time to engage in such things narrows. And so your project $sucks @terribly $$ and looks like APL But it works fine because you know how all that perl weirdness operates:
$_ = shift;
tr/+/
s/%(..)/pack('c', hex($1))/eg;
return($_);
For a new user with no skills (which really seems to be the primary group that ends up using it), the availability of PHP examples and the ease of putting a canned site up seem to be the primary enticements. Slap a canned site up, and bam, there you are. *Now* you can learn how it works (which accounts of a lot of strange things on the web, but I digress.)
So better isn't really the issue. Easier is the bottom line, it seems to me. Where are the canned sites in Python? For that matter where are the canned sites in Perl or Ruby or whatever?
If "better" were all it took, no one would be running Windows, for instance, but that's not the case.
Mind you... *I'm* not running windows, and I long ago abandoned Perl for Python (and I'm so glad I did), but I'm someone who actually has the time to explore and make choices without someone else hovering over my shoulder or otherwise being compromised. I don't think that's very common.
That was just a short list. Others exist.
If you want people to come from C-style syntax, have you taken a look at Perl? ;)
'Sensible' is a curse word.
I'm primarily a Classic ASP specialist, and for years I've been hearing in blogs and tweets about how awful Classic ASP is. And now I've started doing a serious amount of PHP work professionally, here we go again with the moaning and groaning of how awful PHP is. I refuse to call the _language_itself_ awful just because I encountered frustrations when working on someone's website. Instead I place the blame on the original developer because they did things such as:
- keeping their code really sloppy and unreadable
- not leaving comments explaining what the code does
- using ambiguous variable names that don't have any relevance at all to their purpose
- poorly named functions and classes
- jamming 7000+ lines of code into a single database stored procedure (with similar problems as described above)
- hardcoding things that should have been database driven with an administrative control panel
- OVERKILL on object oriented coding, thus sending you all over the damn place to fix something that could have been much shorter and simpler
- too many layers of technologies working together to accomplish something simple, so to fix, you have to read an page which uses a DLL, which calls a stored procedure, which queries a view, which queries another view, which queries another view, which queries a table, which triggers a......
This kinda stuff can happen in any language, and in time, you'll find another language to complain about. 5 or 10 years from now you'll be touting that Java sucks! Don't hate the code. Hate the coder who fled the scene of the incident and left you with a mess to deal with.
All languages (linguistic, programming, etc) suck for one reason or another. Trying to impose order or ideological structure on something that's inherently chaotic and entropic in nature misses the point -- languages exist to bridge gaps, and if a double-claw hammer is needed by some crazy loon for something, then one will be made -- look at the conjugations of the verb "to be" as a spoken language equivalent. Meaning and order change and deteriorate over time to suite the gaps of the day that need to be bridged.
Which brings us to PHP. Yes, it's a mess. However, it's a highly functional, easy to implement, powerful mess that a good programmer can write the code equivalent of Shakespeare with. So, instead of trying to solve a problem that doesn't exist if you don't have Autism, how about doing something useful like streamlining javaScript?
Love PHP. The list of successful php deployments is huge.
No hour on a horse is ever wasted. Winston Churchill
PHP may feel bad compared to currently-popular languages like Ruby and Python, but consider what it was an alternative to when it first came out: ASP and ColdFusion. Can anyone who worked in either of those honestly say that PHP is as bad, let alone worse? I certainly found it less awful than CF for web dev (and that's speaking as someone who'd been getting paid to program since before there was a web).
Village idiot in some extremely smart villages.
Ding, ding, we have a winner!!!
mod_php the Apache module.
Seems to me that the problem is that people outgrow what PHP can do for them, partly lured by PHP's own efforts to offer more than what it should do for them... but, even though they've outgrown it, they stick with it.
.NET, take your pick of oodles of alternatives. Instead, people just kept asking that PHP be extended to do a bunch of kooky crap that it never was meant to do.
When it came out, it was really handy for throwing in some server-side functionality into your HTML. Unlike Perl, where you'd have to have print statements all over the place, or load templates and replace keywords, PHP let you just in-line your functions with your HTML. (Sure, there were earlier solutions like this, like ASP but... ew!). So, it's a great first web-development language... like BASIC was for PC programming. Like BASIC, the problem came when you never realized that it was time to "leave the nest" and move on to something more rugged, J2EE, AJAX,
So, to address the original post, there's kinda no hope in trying to fix what's messed up with it, because there's *way* too big of an installed base... and most of what's messed up about it is that people are using it for larger projects than they should be.
From every Java project I've ever worked on, I always found myself thinking, "...PHP can do that." Can it do it better, though? Not sure. I lack the experience to make that determination. All I know is that I have yet to be given anything that PHP can't do that Java can. Not saying either-or is better here because we all know that these sensationalistic stories boil down to what's required for a given project. If it works, use it. Let's not have anymore of these stupid civil wars for crying out loud. There's more than enough clientele for us all. :.)
I would take a good programmer who uses PHP over a bad programmer who uses Java any day. When it comes down to it, every programming language has it's weaknesses, but a good programmer knows how to avoid them. I think that the reason that people think PHP is such a bad language is that it's so easy to pick up but hard to be good at it, so a lot of people who say they are "PHP Programmers" really just have a basic grasp of the language. And there will ALWAYS be bad programmers who are good at convincing non-tech folk that they are amazing, because all they can see or know is the end result. Bad programmers are bad programmers, language is irrelevant.
The OP thinks that the value of a language is chiefly technical, but that's not the whole story.
The value of a language is made up of:
- The value embedded in its ecosystem of developers - both core and users
- The value of its libraries
- The value/cost of deployment
- The cost of maintenance
- The cost of adoption - how much does it cost to bring a new person up to speed
- The technical elegance of the language
- The costs associated with a failure
- And probably some things that I've forgotten, or which are specific to a particular project
For a particular project, each of these things have relevance with different weights - so it doesn't matter how messy a language is if the value in everything else outweighs the problems caused by the inelegance of PHP (or any other language).
A viable replacement for PHP (or any language) has to provide 10x the benefit for a class of problems to be taken up at any scale; for anything less than that the risks of using the new language are outweighed. It turns out that this is very very hard to do: there are still many COBOL systems; new programs are still written for Fortran; and Lisp, and Lisp derivatives, despite their beauty, have not taken over the world.
What propels a language to glory is its ability to dominate a niche while that niche is growing, but once that niche has reached stability, or perhaps a critical mass, it's next to impossible to dislodge. Don't look to see PHP go away while traditional web is important.
So, if the OP is really interested in languages that are better than PHP, looking at web development as a whole is unlikely to be successful. But a language that engaged a growing niche which PHP will need to compete for at least has some chance of succeeding. The closest possible thing I can think of at the moment would be a language which was fantastically well-adapted to HTML5. Or maybe one that understood dynamic layout in its bones. Or was very well adapted to mobile or mobile web.
Other than those possible areas, to grow a language, it had better target a new form factor problem/niche - e.g. virtual reality/Google glasses.
No, it really isn't. It's just as good a structure as it ever was, which is very darned good indeed. That doesn't stop people from using it poorly, of course. Lousy c programmers are everywhere, just as lousy php, python, perl programmers are everywhere. Most c code I see on the net is awful. It didn't help that the original K&R writing style was quite poor, either. But good programmers have been past those hurdles for decades now. There just aren't that many good programmers.
As much as I like python, Groovy seems like the logical next step.
It's dynamically typed, it has a similar syntax, it can be procedural and oop, it has access to 99% of the java ecosystem. The learning curve from PHP to Groovy is much smaller than python I'd imagine.
Just replace Zend Framework/Symphony with Swing, Apache HTTPD with Apache Tomcat, remove $ from variable names, and while "this" may not be required, it certainly makes code easier to read and is more in line with php, and replace -> with a period.
Voila... the post-php world has arrived. With a language that has more similarities syntax-wise with Javascript, the flexibility of PHP with the option to be as strict as Java, and access to a wealth of superb libraries.
I'm god, but it's a bit of a drag really...
Ever since programming languages existed, they have been classified in 2 categories:
- Those every one bitches about,
- and those nobody uses...
Im a self-taught hobby user, I do not have any formal education with programming or computer science. My first language was Python even before HTML & CSS. So my opinion may be biased in favor of Python. It was in 2009 that I finally decided to dig in and learn some PHP and MySQL.
Personally, from my perspective, I think that PHP is a messed up looking language and not very intuitive for me to work in. I much prefer Python, though I do notice the difference in how well my CGI scripts performed compared to PHP versions. I am not familiar with any of the PHP or Python website framework tools. I build everything by hand.
I first got online in the late 90s and liked the philosophy of the web being an open place where anyone can publish anything they want. HTML was easy to learn and generally effective, but static pages end up taking a lot of time to maintain and a lot more time yet, should the design change. A dynamic database backed site, while a little more complex, can make maintenance and modification a bit easier and more fun. While PHP isn't ideal, it does work. I would like to see something more Pythonic available though. I think this would help lower the barrier to being able to build simple web based tools or sites for common users.
As it is there is already quite a lot to learn and grasp to begin to make an appealing website. Graphics and visual presentation, site/data organization, html, css, web host, general computer and internet, and then there are databases and scripting languages if the developer want to get the most out of their site or tools. I'm not saying this is hard stuff to learn. Though it is time consuming. I think though anywhere it can be made easier for the common user to learn, and learn properly, would be best for us all.
It tricks non-programmers into thinking it does by putting the code in the middle of the HTML page so it looks like the HTML renderer is executing the PHP, instead of having the PHP generate the HTML which is what actually happens and how every other language represents it
That's a web server. A browser is the client to the web server. Do you know you're not making sense?
This.
PHP feels natural for me, as a C guy. The library functions lack consistency, but then neither do 3rd party C libraries. You just learn how to work them and get on with your billable day. I can look at just about any PHP code and figure it out pretty quickly. A lot of it is written by mental midgets, but it is familiar enough that I can jump in and fix whatever needs to be done.
Meanwhile, all those other, functional languages venture so far off the beaten path as to make them look like gibberish. They often strike me as the product of overexcited college grads. It's like a little kid who just learned a new swear word and starts using it ten times in every sentence. Closures this, aspects that, ooh look ma I'm using list operators... academic functionality makes for cute sample code, but those of us with actual jobs have more pressing things to do than learn a new language and syntax. At the very least, PHP offers a good online manual with some very handy user-contributed snippets. Sure, some of them are ass and could benefit from some karma/moderation system, but I've often found a little 10-line function in those comments that saved me an hour of poking around, or that I could patch up and post my improved version. That right there beats all those "Look how easy RoR is" screencasts that ignore all the actual things programmers need to know to write secure, production-ready code.
-Billco, Fnarg.com
mod_php the Apache module.
As much as I try, I can only get mod_php to load in a web server. My browsers don't seem to know quite what to do with it.
Do not fold, spindle or mutilate.
I'm not a computer scientist, I'm not smart enough to know that PHP sucks.
I do know that if I need some kind of quick dynamic site on the web, PHP is the best and only choice.
Reasons:
cheap web hosting
simple db connectivity
fast
low memory footprint
simple syntax
no 'secret conventions' or config files
simple deployment
'just works'
Alternatives?
JAVA: JSP pages, servlets
Ruby: Rails
Python: Django, Cherry PI
Perl: Mason (ever install this!), CGI
Others?
Nothing else even comes close to PHP for what it does right.
Sure PHP is a non-designed, hodge-podge of functions but it fills a void no properly designed language has been able to fill.
No language is perfect, if you can name a language you cant complain about, you haven't used it enough!
reported as spam
You run Apache in your browser? Did you purchase that UID?
I am usually updating other people's code and the biggest mess and waste of time is writing Javascript code from PHP and forgetting what file you are in or "forgetting" . "that" + "each" + "language" . "does" . "things" slightly differently. Just different enough to make you hate them.
And while I'm at it, in general, why can't all the lanugage just agree on the basics. They all implement foreach, and they all have to have a different syntax. wtf? seriously, are the authors of these languages so egotistically that they can't follow eachother on the basics.
The community of programmers splits sloppily into "I want something understandable and easy to use" (VB6, PHP) and "I want something internally consistent and aesthetically pleasing from a mathematical standpoint (Powershell, C++, Pascal).
Neither side is entirely right, or wrong. Any good programming language should be both consistent AND immediately understandable by a human with only programming language concepts as background knowledge. Thus far, such an animal is imaginary, despite what the Python folks think.
There's a subset of self- absorbed, arrogant twits that believe that if a programming language is "too simple," it's just wrong and You. Just. Don't. Understand. REAL. Programming! I tend to filter them out as noise and recommend you do the same.
Please do not read this sig. Thank you.
Of we assume that OOP is a good paradigm in general, then there should be some way to construct server-side software in OOP, and not worry about the transport in HTTP. And whereas PHP has OOP bolted on later, maybe this language had it from the start?
While Python and Ruby are good, I'd like to talk about a gem i found called Wt
Wt is a spin off of Qt, but rahter than being client app focused, it is web app focused. it is programed in much the same way as Qt, but uses the Boost API proper, not some boost-inspired API.
It supports AJAX and you can even mark C++ functions for export to JS so they run client-side.
The problem is, if you're not used to thinking OOP about websites, and not used to Qt or Boost, the, your learning curve might be a bit longer than you'd like. Also, deployment is not as simple as dropping PHP files into the right spot in a file system.
http://www.webtoolkit.eu/wt
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
I am one of those "stupid" PHP users. It's not the first language I learned, nor is it the last. I'm well aware of Python as an alternative for developing web apps, and I've tried it, but I really do prefer PHP.
One reason is flexibility in flow control. PHP has do ... while loops. Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.
I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more. I mean, who the hell are they to tell me what I should and shouldn't do? This tradition of "I know better than you do" seems to permeate Python, and leaves a bad taste in my mouth. PHP gives me the freedom to do what I want -- and that includes doing mysql escaping badly. That's not a freedom I will use, but it's there nonetheless.
People are right to criticize PHP's mysqli library, but there are plenty of good wrappers available that hide the problems, or you can just use prepared statements exclusively and avoid the whole mess. Again, PHP doesn't preach at you with a "I know better" attitude, it just gives you all possible choices and lets you take it from there. PHP tutorials are wrong to teach mysql without teaching security and injection prevention, but that doesn't take away from the language -- there are bad Python tutorials out there too.
Also, PHP's tradition of having a standard installed system makes it trivial to ship code. If a certain class isn't part of the standard PHP installation, you package it with your app -- and you know for sure what your user's environment will look like. True, there are the configurable php.ini settings, but those are trivial to check and adjust within your code. With perl or python, one shared hosting company might have certain packages installed while another one does not, so companies shipping apps go insane trying to figure out what they're allowed to rely on. Users without root might, or might not, get to bring in certain things on their own. And if they can pull in the right packages, the process might be too complicated for the given user, or might require shell access which the hosting company disallows.
The fact that there are so many successful PHP apps running on shared hosting (wordpress, vbulletin, etc) is a testament to how simple the language made it to ship and deploy such apps. It's historically been easier for a webhost to support PHP than to support Python, so more of them do it. From the developer's perspective, you know a given PHP app will run the same on all installed sites since they all have the same base libraries. From the user's perspective, it's dead simple to deploy the app with nothing more than an FTP client. No need for root access or any weird tech stuff. From the webhost's perspective, a trained monkey could deploy PHP on a server -- not just today, but 10 years ago.
I hate to put arguments in my opponents' mouths, but so often I've heard Python types attack the quality of those PHP apps. In my opinion, though, you can't argue with their success. PHP delivers what users need, and in the end that's all that matters.
I made a PHP/MySQL library that prevents SQL injection & makes coding easier!
Ignoring the "worse is better" and whitespace comments, I'd say from the comments here that the way to go with your project is to make Python scripts easier to deploy and manage on LAMP. Specifically, I'd make sure that user sessions were not managed under a single, monolithic instance; also I'd implement a way for Python to effortlessly share web session data between instances (in a way that doesn't compromise security).
Another commenter suggested Groovy as an alternative, although I'd bet that suffers from Java's monolith and memory footprint issues.
PHP seems to be the new language to hate, just like JavaScript once was. There are things wrong with it, but really, it's not that bad!
The reason why a lot of current PHP code sucks is that many popular CMS started back in the days of non-OO PHP and were written by people who had no idea about design patterns. Software like Wordpress, Drupal and Joomla (which are all widely deployed) were originally written in procedural PHP 4, misusing PHP's power as templating language. Software like that, where programmers mix HTML, database calls and business logic can never be fixed, only rewritten.
On the other hand, modern MVC frameworks, like Zend or Symfony or CodeIgniter provide a sane environment for writing excellent PHP code. Those illogical functions that many complain about, like mysql_real_escape_string and mysql_escape_string are hidden behind a database abstraction layer, so the coder never has to touch them. Sure, that doesn't make PHP better, but it makes it perfectly usable.
Also, using a proper MVC framework (or writing one yourself) allows you to structure the code in readable and maintainable object-oriented manner, and then still use PHP as a very powerful templating language! So, you get the best of both worlds.
people don't complain about things they don't care about.
I meant that syntax has improved in quality since C to the extent that C itself is a bare minimum of language quality.
I'm writing an app using Linux, Apache, PostGreSQL, and PHP. Part of the reason I chose those technologies is that I believe they stand as good a chance of being around in 10 years as anything else I might have chosen. By the way, the app is replacing (and improving upon) something I wrote in 2001.
That lives on the server.
PHP doesn't really use standard C-style syntax, either. It pretends that it does - sometimes badly at that, like faking casts, letting you write (int), but not letting you use "int" as a keyword in any other context. But most of the rest of it is not really very C-ish.
Any reasonably competent C/C++/Java programmer can just as well adapt to Python or Ruby after being told what the equivalent of curly braces is in those languages. If he can't, he's not a competent programmer.
wrappers for all sorts of handy stuff like POSIX threading, sockets, SSL, etc
Which high-level language doesn't have any of these in its standard library, though?
In fact, I'd argue that the huge problem with PHP is that it tends to wrap the underlying C APIs very thinly, exposing them practically as is, just with implicit type conversions for arguments. Which doesn't make sense at all in a high-level language.
Use ASP then, you picky bastards!
Uh, 2000 called...
a) They want their tech back.
b) I did warn them about 9/11, but I don't think they believed me.
Actually, when I first saw PHP - the first thing that struck me was how much it resembled an old Active Server Page.
#DeleteChrome
If you don't understand why Classic ASP (or rather VBScript) is awful, you're simply not qualified to judge PHP. Nonetheless, please read the article linked from my sig; it explains in details why PHP - the language itself, and its standard library - is awful on its own merits, regardless of who writes code in it and how they do that.
I had no idea PHP was so bad and irrevocably broken.
I wonder why so many people have used it and continue to do so?
Ever since programming languages existed, they have been classified in 2 categories: - Those every one bitches about, - and those nobody uses...
Sounds clever, but it's plainly false.
C, Java, C# are among the most used languages today. Very few serious programmers will say that they are stupid or awful. And, many criticisms aside, most programmers respect them - even love them. I program in all these languages, I like them all, and I hate PHP with passion. It's not an issue of popularity; PHP, its community, its history, all of it, is a tale of terror.
In what way does it "live in the browser"?
In the way that the GP post "doesn't know what he/she's talking about".
...considered harmful.
Perhaps a lot of the problem is that we are putting too much of a burden on our app languages because we are trying to stretch the HTML stack beyond what it is suited for, user-interface-wise.
I suggest a new "GUI Browser" (or pluggin) be created that handles desktop-like GUI's well so that we don't have to hand code every keystroke and mouse-stroke. About 90% of all GUI actions are predictable enough to be made into a declarative language (perhaps a markup language) so that we shouldn't have to micro-manage so much in our app code.
We've given the HTML stack 15 years to match desktop-like needs, and it fails and fails again, creating jittery, vendor-sensitive, and crashy crap. HTML5 is only an incremental step. The GUI Browser would be a single code-base for all vendors, sort of like Flash/Java-Applets Done Right.
Table-ized A.I.
I sort of like that. When the PHP docs fail me I can turn to my C and Unix books for documentation on these wrapped functions. However, I can see how many people would not like that.
I really shouldn't have used someone else's email address for this account.
Or at least it does in PHP 5.2, but in 5.3, not so much. There have been many of these little idiosyncrasies over the years, enough that my company moved our core product to Java long ago. Stupid stuff like that makes it impossible to upgrade the PHP version without major QA and developer time to address all the new "fixes" the PHP folks decided to introduce in the latest minor release. Meanwhile, my C and Java code from 2001 still runs just fine. That said, when I am coding something for fun, not for profit, I usually end up with PHP on the server side. PHP is coded by amateurs for amateurs. Keep it far and away from any critical systems and it can actually be kinda fun.
apt-get install redhat please god - Me (take it easy, I love Debian)
I guess the question at that point is, why not just write in C? You don't really gain a lot of convenience from PHP, but you lose considerable performance (IIRC, the only "scripting" language slower than PHP was Ruby, and even then only until 1.9).
I don't know what all the bitching is about php works well enough for me and im a shitty programmer (imo), but whatever my problem with php is I get around by using another methodology, mostly javascript or ajax
It didn't help that the original K&R writing style was quite poor
That's because they never intended for it to be used for anything other than UNIX. Ain't their fault everyone else said "CAN HAZ PROGRAMMING LANGUAGE?".
* Create new language that has C-like syntax. (If you don't want C-like syntax, you'd probably be using Python or Ruby instead anyhow.)
* Borrow the good and neutral stuff from Php, overhaul the ugly parts.
* Make sure it includes "web-friendly" string handling, something that JavaScript lacks.
* Simplify the type system, or perhaps toss a hidden type flag (marker) altogether, using situational typing instead.
* Merge associative arrays and objects. They are too similar in a dynamic language to make different "kinds" of things. Allow both dot syntax and square bracket syntax for indexing, like ColdFusion does, because each works better in diff situations.
* Make a better Switch/case statement, perhaps allowing the old-style also for C familiarity.
Table-ized A.I.
"PHP, its community, its history, all of it, is a tale of terror."
Not if you know what you're doing. The fact that you listed C and Java, C# together speaks volumes.
C, Java, C# are among the most used languages today. Very few serious programmers will say that they are stupid or awful.
C - correct, not many people bitch about it nowadays. That's probably because it has changed only incrementally from what Ritchie and Thompson first came up with. The big OOP extension project in Bell Labs turned into C++.
Java - everybody bitches about Java. The language is no longer simple, the libraries are sprawling, class loading is complex and error prone, client side applications are slow and difficult to develop, enterprise frameworks are fragmented into various camps because of design errors by Sun. Et cetera.
C# - people called it a Java clone, which it pretty much was originally. Like Java, it results in sluggish load times from client apps. And it only has adequate commercial support on Windows.
What you say works well in a UNIX-like environment. Windows, on the other hand, doesn't see #! lines; instead, it looks in a registry that maps the end of a filename to an application. It took until Python 3.3 for PEP 397 launcher to get implemented and added to Python.
Very few serious programmers will say that they are stupid or awful.
Huh? Have you just fallen off the turnip truck?
C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.
C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.
And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).
Sometimes it's best to just let stupid people be stupid.
And then, there is PHP, that nobody even care to bitch about anymore, since it's so bad everybody agrees on how bad it is... But everybody still uses.
It is not completely new, it is just one entire new level on the game.
Rethinking email
It's not that a PHP developer sees the double forked hammer and a normal hammer sitting side by side, ready to use to get those 3-nails in, and foolishly chooses the double forked one. It's that the normal hammer in question will take forever to configure before you can start using it, you have to read a complex set of instructions to learn how to use it, and then if you don't use it perfectly the right way, it won't work at all. I agree with most of the article author's points... and hell, go ahead, build a better language that keeps in mind the reasons PHP is still so popular... but if you summarize your whole argument with a flawed analogy, then maybe you won't ever quite hit the nail on the head. Granted, maybe I took my analogy into flawed land... Analogies are hard.
Then allow me to rephrase it in a non-spam way: People use PHP because hosting with PHP is cheaper than hosting with languages other than PHP.
I've been using PHP for years, and not two days ago I decided it's probably worth learning python and switching to that for server-side scripts. I got a python cgi script working in about 10 minutes. Then, I just wanted to be able to run python scripts from arbitrary locations on my site. Looking into that, I could not find a single explanation or tutorial website to help me out. Is that just not how python works? Can anyone point me to some resources that will help an amateur familiar with PHP, learn to completely replace PHP with python, on a commercially hosted webserver?
I hate pointers in C, the lack of regular expressions in C, and string handling in C. I think of PHP as "like C without all the stuff I hate about C". I'm sure language purists will be astonished by that statement. I realize PHP isn't fast, but it seems to be fast enough for the stuff we use it for.
I really shouldn't have used someone else's email address for this account.
It sounds more like you're used to what you're used to and don't want to change. Meanwhile thoose "overexcited college grads" don't want to be weighed down by the 20 years of trash thats part of the PHP code base... I'm a PHP dev now, and was a rails dev for 5 years - I'll take ruby/rails any day.
They want it back? Really?!?
If PHP resembles ASP, it is because PHP is a plain copy of ASP. With a few small points that needed extending extended, and a few small points that needed correcting made worse.
The only problem is that it came 5 years later, when ASP wasn't really needed anymore.
Rethinking email
Instead, to do the same thing you now have to write: return $var = &new ProtectedClass();
This, in PHP 5.3 would do "Return new as reference is deprecated". This would crash in PHP 5.4 IIRC.
Now, on that same page, I'm seeing a pattern of people doing the usual rant about the === thing, but this goes absolutely nowhere. It's equally stupid to write == in C in an if statement, but nobody is complaining about it. The rest of the argumentation is crap too. I just don't buy into such silly rants.
PHP is a garden of paradise compared to Java, which has three or four thread models (Android has another couple), at least four layers of I/O (original streams, better streams, and two NIOs), multiple GUIs (AWT, Swing, and all the third pary stuff which fixes Swing's glaring deficiencies that make it useless), and so on. Not to mention the steaming pile of web overengineering which includes JSP, JSTL, EL, and so on as part of J2EE, plus all the third party stuff like Struts and Hibernate. Struts has two incompatible versions (one works with Java Faces, which is like an overengineered JSP) and Hibernate changes all the time. If you like MVC, I have lost count of the MVCs available. If you just want to overengineer for the heck of it, you can use Spring AND Hibernate at the same time. It's like wearing a belt AND suspenders.
Compared to this, PHP is a sane and rational alternative for web developers.
Oops I meant server not browser.
To be fair, he said C#, not C++
Closures this, aspects that, ooh look ma I'm using list operators... academic functionality makes for cute sample code, but those of us with actual jobs have more pressing things to do than learn a new language and syntax.
Fortunately, the "closures this, aspects that, list operators!" group makes a ridiculous amount of money cleaning up the mistakes and horrible non-engineering of the people who "just want to get things done".
Dewey, what part of this looks like authorities should be involved?
Oops, you are correct. My apologies to the original poster. But then, C# is Microsoft, so I think it's fair to say that you can find programmers out there that say it's stupid and awful. :) [I actually haven't used the language to a significant enough extent to have an opinion]
Sometimes it's best to just let stupid people be stupid.
Sure we do, but I wouldn't call it bitching, more 'giving suggestions and positive criticism' , ok well , with occasional bitching :-)
People dislike what they use, because they always look for something better ( it's human nature )
That's why things keep improving, because the community demands it.
If no one is complaining about your software, you have no idea what to improve.
You say you like Java : Java is a good example of how community process improved something which was really awful to code in and dreadfully slow , into something which is literally used everywhere ( I love Java btw ) .
PHP has it's uses : it's very lightweight , and very fast , and as such , ideal for many basic sites.
Not to mention the price tag in comparison to J2EE.
Java is as fast as C (or nearly as fast) for most tasks. Java is indeed slow on the desktop and for graphics in general (compared to native code), however, this is not generally where Java is used.
Saying Java is slow in general (and saying it repeatedly) only serves to show your ignorance in this context.
So yes, I will claim that Java is not slow (despite your protestation not to do so), and furthermore, I will claim that you have no clue what you are talking about.
This isn't really about PHP sucking. It's scripting languages vs non scripting languages. For some reason people feel less manly if all the can do is script. Programming is programming. No one is forcing anyone to write crappy PHP code. PHP does not have to be written like an old ASP page where you hope in and out of PHP tags. Modernize how you code PHP all you like. I started out with Perl->PHP->C#->C++. When I am coding in PHP I can replicate practices learned and use in other languages. Choose the tool that suits the task. There is no one answer for everything.
Language wars are so 20th century. Can we grow up? The perceived differences between languages are much larger than the real ones, and the quality of the programmer and the programming methodology and environment are ten times more important than the choosen language.
Great software is written in every language, just like crap software is written in every language. Get over it.
I personally happen to like PHP, but if you want to use Python or Ruby or Java or Brainfuck, then I don't care. Whatever works for you.
Assorted stuff I do sometimes: Lemuria.org
Java can nearly as fast as C for very small pieces of code where the runtime can do straightforward JIT compilation, that is true. If you define that as "where Java is used", then your claim is true. However, for code of any size or complexity, Java slows down tremendously. Why do you think Java is "slow on the desktop"? It's because desktop apps are applications of size and aren't trivial pieces of glue code.
Or, to put it another way, if Java isn't inherently slow and is "as fast as C" as you claim, why would there be an exception around desktop apps or "graphics in general"?
Sometimes it's best to just let stupid people be stupid.
If you are paying 5.95 per month for hosting I am sure it is worth every cent.
Got Code?
C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!
What works ain't broken. What is broke doesn't work. Nuff said move along rant at something else.
In order to form an immaculate member of a flock of sheep one must, above all, be a sheep.
There is a very simple reason that I still use PHP quite a lot: there's a thriving market for it. If you are a good, responsible coder who knows how to navigate the pitfalls of PHP, people will pay you, and pay you well, to do it. Feel free to complain that PHP is a messy, crappy language; I'll agree with you all the way to the bank.
If at first you don't succeed, destroy all evidence that you tried.
for certain jobs.
It is great to mock up use cases for testing or producing engineering code.
It is great for reverse engineering certain functionality to see what works and then use that to provide the basis of a formal functional specification.
No need to worry too much about connectivity and services as it mostly works, perhaps not as low level for key tasks but close enough.
It offers raft of flexibility in a fairly robust, performant, scaleable, cross platform way and lets you experiment.
All in all I believe it meets and exceeds its objectives with a high degree of quality.
I have to say I rate PHP highly in many areas and above all it just kinda feels nice.
Perl definitely has a C-like syntax. It was the first language I learned after C and C++.
C# got lots of goodies,especially if you come from dynamically typed and functional languages. Shame it only officially runs on windows. I wish MS embraced or at least blessed mono properly.
c# got stuff like anonymous functions/classes/lambdas/expressions trees/type inference/ and oter things I that I missed. Yes maybe java is a more enterprise and solid langauge, but c# is quite exiting.
If only they stopped insisting on having capitals at te beginning of eac method, arhh..
if (!signature) { throw std::runtime_error("No sig!"); }
I'm told someone who wants to be hired as a web developer needs a portfolio of web applications that hiring managers can play with. How much should a job seeker expect to have to pay to host his portfolio site?
Ruby is used by a wider group of people and in a wider area than it ever has been. Also, there's a lot of other really great languages out there you should consider before you idolize one language as perfect. Erlang and Haskell are amazing and certainly worth checking out. Not to mention node and the javascript revolutionaries. A lot of people get stuck on their first language I encourage you to branch out and try Ruby at least. You'll find a much different language than you seem to think. I personally had the following progression in my love affairs with languages:
I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
Thank you sir, that was exactly what I was thinking.
I would say that Java is the worst though. I can't count the number of programmers and managers who have to deal with it's terminal bitchiness every day. You didn't even mention all the security vulnerabilities that have caused it to be disabled by default on so many of our corporate customer's machines these days.
Java == Unreliable insecure miserably unproductive busy work.
I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
No where in the original article or the high scored posts does anyone actually say what is wrong with PHP.
Saying PHP is like a double-clawed hammer doesnt mean anything. I would much more equate it to a normal hammer or hand tool. Other languages like Java or C++ have seemed more like a router: they can do a wide variety of things but you need an assortment of bits, templates, and jigs for any basic chore.
I have used PHP and I dont see what the complaint is. It provides specific functionality and is supported on many servers.
It works and it is easy to use. Is it the syntax? The performance? The reliability? What?
I HAVE MOD POINTS! POINT ME TO SOMETHING GOOD AND I WILL MOD IT UP!
oldhack: "Security is a waste of money until shit hits the fan. 5 minutes later, it becomes waste of money again. "
Firstly, apologies for calling you ignorant / clueless in my previous post. it was unnecessary and uncalled for, I was overreacting to your comments.
In regards to your above comments, I would tend to disagree and perhaps claim the opposite (but the situation really depends).
With JIT, Java can often be nearly as fast as some small C programs (sometimes even faster), but equally likely, a highly optimized C program can beat Java for number crunching in specific domains (linear algebra for one, I believe, but don't quote me).
For complex programs, a well written Java program will often have better performance than a C program (assuming similar development times) since Java can be coded cleaner / faster and the micro gains you could realize in a C program are less prevalent. When you extend this to complex multi-threaded programs then I would expect a Java program to be both much more robust and better performing (as well as far easier to code) since multi-threading in Java is very well implemented.
This is why, for instance, you see a lot of large e-commerce sites written in Java, but few are written in C (although there are some examples of specific parts being written in C, such as messaging queues).
The reason Java does so poorly on the desktop is that there is a significant initial load time for any Java program as it loads the JVM and all of the classes, as well as an increased memory footprint due to the JVM (as well as the fact that a Java program would generally use more memory than a comparable C program).
In regards to graphics, the issue in Java is that you are necessarily going through an abstraction layer and not working with the OS or hardware libraries directly. This results in inefficiencies and poor graphical performance.
Overall, the point I would like to make is that the notion of Java being generally slow is outdated and not true. Java does have issues on the desktop, for the mentioned reasons, so I would never recommend it for that purpose, but this is not really due to the execution speed of the JVM or the language itself.
Modern ruby is the cleanest, most elegant, expressive and fastest of the big 4. It offers a bigger standard library (gems(40,000) vs cpan (25,000) vs pypi (1,022)), a wider selection of interpreters and platforms (IronRuby, JRuby, Rubinius,Cardinal, etc), not to mention much better documentation and educational resources.
Ruby is used by a wider group of people and in a wider area than it ever has been. Also, there's a lot of other really great languages out there you should consider before you idolize one language as perfect. Erlang and Haskell are amazing and certainly worth checking out. Not to mention node and the javascript revolutionaries (which some people abhor.) A lot of people get stuck on their first language I encourage you to branch out and try Ruby at least. You'll find a much different language than you seem to think.
I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
Take a page from the Not Matt's Shit people.
The general excuse is there are too few maintainers. Perhaps the true problem isn't that too few people want to contribute, but rather the core team needs to be replaced.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
Get your tool analogies right: If you are using pliers to turn bolts you are doing it wrong.
C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.
So they added garbage collection, and everybody hated managed C++. In fact, I never heard a competent C++ programmer complain about the lack of garbage collection. Everyone I know is happy with smart pointers as a means of managing memory. When you use C++ you do it because you need/like control over these things.
Real Java programs freeze occasionally for a second or more to perform garbage collection. That simply kills user experience and makes people hate a program. That is why high-quality software cannot be made using Java (or equivalent systems like .Net).
Very few serious programmers will say that they are stupid or awful.
Huh? Have you just fallen off the turnip truck?
C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.
C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.
And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).
And what do you suggest, Ruby? That is what serious programmers use right?
I mean, it kinda seems more like you are the dipshit.
C++ really isn't that bad once you understand pass-by rules and where stuff is allocated. And it's really, really type safe. Probably as type safe as ADA was back in the day. Being a compiled language greatly limits the types of errors you're likely to encounter at run time, and cppunit so far has been one of the nicer unit testing frameworks that I've had to work with. Boost is moderately usable these days, though I still find myself wishing that some of their libraries were better documented. I'd still rather roll my own socket server, but that's actually kind of true of Java as well.
Java's mostly fallen from my favor because its versioning problems seem to be almost as bad as Ruby's (And that's pretty damn bad.) That's mostly if you're working on an Apple machine. You can manually work around at least some of the problems on an Apple, but that's already defeating the main selling point of the language. Admittedly I've had to deal with it on some fairly esoteric platforms, but its primary selling point was "write once run everywhere," which it fails at. Plus Oracle's recent behavior has me wary of all of their products now. Like I needed another excuse. I do like the design of Java mostly, though I really do miss destructors when I'm working with it. The implementation just puts me off.
You haven't really lived until you've had to support a project that requires two libraries which require two different versions of ruby to work.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Java, on it's own really sucks. It's painful and counter-intuitive to write in. Output is slower than dirt, and you have to compile it before you even know if your code works. Even then, you're really only guessing at it. For web applications... it's okay for web services, but I wouldn't use it for the kind of stuff that php does well, like content management. I've been there, done that, salvaged the wreckage. Groovy seems pretty cool though.
This signature intentionally left blank.
I was making the arguments that others make to dislike the languages, not my personal feelings. There's no such thing as a perfect language. The arguments against Ruby (as I understand them, I haven't used the language all that much) is that it's very slow and the community is full of asshats.
Sometimes it's best to just let stupid people be stupid.
In what kind of rosy-tinted world do you live, where budgets are allocated for "nice to have" stuff like clean code and proper docs ? To a non-programmer, if the stupid thing works most of the time, it's done. That means you take the little prototype you demoed at last tuesday's meeting, slap the corporate logo on there and bite your tongue because the PHBs aren't going to give you another 3 months to rewrite the whole thing as a cleanly designed, production-ready app. Sure, my own pet projects undergo continual refinement, because I take pride in my work, but when I'm on someone else's dime, all those good intentions fly out the window and the only question coming from management is "when can we invoice the client", not "is everything up to your O.C.D. standards".
Sorry but that's just the reality of capitalism. It's not about doing things right, it's about selling crap to idiots.
-Billco, Fnarg.com
I am writing music notation software in pure Java 4.2. I tested it on my old G4 Mac 867 Mhz. My code can highlight and playback 32nd notes at fast tempo, displaying an animated anti-aliased score. Java is not slow if you don't create too many short-lived objects so the garbage collector does not pause your program for too long. There is never a pause in playback. Verbose? Objects and their content must be clearly defined; this helps the programmer understand the "interface" and the code layout. Less comments are required. Java FX alleviates the need for verbose code. Yes, Java runtime takes more memory than a native program but not a crazy amount.
The whole POINT of PHP is that it works DESPITE bad coding practices.
If the programmer were capable of GOOD programming practices, they'd be using Python!
paintball
If "most tasks" means reading some XML document or HTTP post and writing it to a DB... then yes, Java is about as fast as C.
This is probably what most people who write software for a living do, so it works. I should also mention that pretty much any language works here, they are all fast enough for this (some differences, but close enough that it just does not matter.)
If you are talking about a program that does some simple CPU calculation like listing prime numbers, it will also be somewhat close (although a decent C implementation should be slightly faster.)
If you are talking about something more complex, this is not so true. There are types of solutions that are simply not available to you in a language which does not allow you to manage the layout of your address space. It becomes more important when your address space is much larger than physical memory, such as a modern 64-bit program (not that current implementations actually give you 64-bits of address space), or a 32-bit program from the era where 64MB of memory was normal.
For the quick example:
If you have a task that has a large but limited number of possible results (enough to more than fill physical memory) the obvious choice is to make a list, and if you need to add or update a result you look it up (which means you either crawl the list, or you sort it and search it.)
This is nearly optimal in Java, or pretty much any language which manages memory for you.
There is a better (as in far faster) solution available in C though. You can allocate enough space for all possible results and calculate the index of the result you want. All pages (a 4k block of memory corresponding to a Page Table Entry... which is basically hardware memory managment) end up being noted as zero filled and no physical memory is actually allocated until you write a value to that page (you do not use malloc() for this, you use the operating system allocation functions.)
Why is this so much faster?
Because it completely avoids all of that time intensive sorting and searching (or list crawling.)
The C lookup is a very quick calculation that probably involves numbers which already reside in a register (or at least some level of the CPU cache.)
The Java lookup requires that you read from memory enough to do a binary search on each list (not to mention when you add to it and need to resort the list... even fast insertions in a sorted list are not that quick.)
The C version will usually use less physical memory as well (not assured as there is a pathological case where one value on each page is updated.)
In a complex enough program, this can easily lead to a run time which is several orders of magnitude lower than the Java version.
You may contest by saying the Java version is not performing 10,000 times as many operations, so how can it be so much slower?
The answer here is that CPU speed has very little to do with how quickly most programs execute these days. It is almost always memory bandwidth or latency that will be your limiting factor.
The calculation involving a couple of numbers already in a register is extremely fast, the random reads from main memory are not. In needing to transfer more from memory for the lookup, you are also competing with the information the program really does need to read from memory (and any overhead the JVM imposes.)
There are many other things which you can do in C but cannot do in Java, but this is one of the easier to understand ones.
In short, if you write the same program in C and Java, they will be somewhat close in speed. You can however frequently write a C program that is much faster, produces the same results, and is not possible to write in Java.
Removing control of memory from the programmer restricts the solutions which are available to you quite a bit.
I should also note that managing memory is not really all that much of a burden. If 10% of your code is memory management, you probably botched it badly.
I'm a signature virus. Please copy me to your signature so I can replicate.
None of those languages are stupid or awful, they all have their place.
C: Any even reasonably decent compiler will bounds check for you if you ask it to, there is simply no point outside of a debug build in most cases.
All of the errors you mentioned are an error in any language. Reading or writing past the end of an array is as much an error in Java as in C, not initializing a variable is an error in both Java and C (the NULL pointer.) You can trap the page fault in C if you want and pretty much give the exact same result anyway, but a crash is a crash. It does not matter to your user if it is the operating system noting an access violation on some memory, or a Java program encountering an exception that it cannot recover from.
C++: Yes it includes everything (you want kitchen sinks?... what color?) I will admit though, I recently was very glad that TR1 regex exists in C++, it saved me from having to write that program in Perl (in true C++ style, it even offers you the choice of any popular regex syntax.)
Mostly people who primarily write C++ do not use the entire thing, many basically are writing C with just a few extra features in use.
Java: Significant defense against a bad programmer (part of why it is so verbose.) It is a godsend for large projects where you may have many programmers of unknown quality.
If you turn a new (or simply bad) programmer loose in your large complex Java code base for a few weeks they will be unproductive.
If you turn a new (or simply bad) programmer loose in your large complex C++ code base for a few weeks... I hope you have backups.
I'm a signature virus. Please copy me to your signature so I can replicate.
You'll find a lot of people who don't really use c, c++, c# or java who will demolish each of those languages for different and somewhat cliche reasons.
That said, from those who actually use the language, you're bound to find less absolute hate and more specific complains about problems that are solved in "easier ways" with other languages.
"Science can amuse and fascinate us all, but it is engineering that changes the world. " - Asimov.
C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.
Null pointers are a reality in many modern'ish languages: C#, Java, etc. Granted, they're nowhere near as unforgiving as C/C++. The big difference is that these days a competent C coder is expected to know a bit more about the underlying gotchas and security considerations of the language than ever before. It ends up working out since it weeds out the web guys. It's more than simply knowing C, it's *knowing* C. The same can't be said. and doesn't have to be said, for the rent-a-coder slinging C# or Java.
C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.
The learning curve is hardly insane but it does exist, anyway you say it like it's a bad thing. Again, it helps to weed out the casual coders. As for no garbage collection, wtf? Conscientious manual memory management, smart pointers, accepted idioms and best practices (e.g. raii), and a strong grasp of the language are sufficient. I understand that formal garbage collection is on the horizon, but it will be opt-in and is only intended for the very few edge cases in which it's truly useful. Interestingly C++ wasn't mentioned in the comment you to which you've replied. C# was and yet is curiously absent in your criticisms.
As for Java....no comment. Same for C$.
Okay, instead lettuce discus alternatives
What is faster but still includes strict ahead of time (dancing around the word compile time, since a JIT can eat source about as well as some intermediate format) type-saftey, GC, safe arrays (or, better, collections of some sort), and is object oriented? I've not done colmparative research but I'd immagine something like C# might fit the bill, but considering that I don't develop on Windows I suspect be subject to a less polished runtime environment. I don't expect python would be faster, but I'm open to suprises.
Last, if it helps, I wasn't taught Java in college. Heck, it is the first OO language I learned (self taught) and I went years thinking it was the scum of the Earth. Turns out that I found some good stuff there. Heck of a lot faster than perl and easier to code up solutions to Project Euler problems in. Missed some tricks from C, but once I learned how to properly program in an object oriented fassion things got a lot easier. Just don't want you to think I'm a Java zealot.
md5sum
d41d8cd98f00b204e9800998ecf8427e
Every fault you mentioned comes with a valuable tradeoff. PHP's tradeoff for its faulty design is that it gets morons programming faster... This is only beneficial if you twist that word along the ridiculous dimension.
Heh. Anyone complaining about C# is likely complaining about something other than the language (e.g., politics, patents or CLI). The language itself is very expressive... I'm from a Java/C background, and find C# allows me to be much more expressive (almost to the same level as python and related) while still retaining absolutely awesome type-safety.
Closures are best avoided. They're not well understood (even by professionals), they're hard to read and understand, and (while occasionally handy) have extraordinarily limited use.
Of course, closures are the new hot thing right now so they're misused all over the damn place! I've even heard morons say that they can't imagine developing without them. Odd, as they got along just fine before they discovered them!
There have been a few times when I've been tempted to use closures. In every case it was because I had made a stupid design decision. A bit of extra thought and a bit of re-factoring and cleaner, faster, easier-to-maintain code was the result.
That is to say, in my experience, closures are a "code smell". If you see a place they may be convenient, stop immediately and re-think what you're doing!
That they're poorly understood is the only real reason closures and the whole "multi-paradigm" language fad has gained so much traction. If this discussion is any indication, developers HATE anything that's easy to use and they HATE that newbies write bad code. (Hint: they'll write bad code in any language, they're new to it!)
When I was 10 or 11 I was very nervous about letting people see my code. Why? If they saw how easy this programming thing was, then they wouldn't think I was smart or special in any way. I grew out of it, but it doesn't look like a lot of developers here have.
They WANT complexity. They don't want tools that are easy to use -- then they wouldn't be special! They love writing cryptic code that's difficult to understand. After all, they understand it, so that must mean they're 'smarter' than everyone else! They WANT to latch on to the latest fad like they've been waiting for it their entire lives, it makes the feel like they're "ahead of the game". Hell, why else would perl get so much love and php so much hate? Php is great for the same tasks that perl is great for, yet the easier-to-use language is panned and the one that practically encourages you to write unreadable code is praised!
Once they mature, they're learn that writing code that's easy to read and maintain is the single most important thing you can do. They'll learn that you don't get modularity for free just because you're using OOP (quite the opposite, in fact) and how proper modularity let's them write clean code that's easy to maintain. They may even learn that anyone who writes a FactoryFactory needs to be hung in the public square, and why doing something clever is a horrible idea 99.96% of the time.
So, yes, development by fad (using closures in languages like c# and js, AOP, hell, even OOP) is a horrible, horrible idea. It makes insecure developers feel important, sure, but that is the only benefit it brings.
Required reading for internet skeptics
A language can't be fast or slow, that's up to the platform. I can compile java the language into a binary. Likewise I can run a C app in real mode DOS that requires expanded memory access and it would be very slow compared to an platform that has access to 64 bits of memory.
Heh? C# has been running on linux for a long time. It's called the mono project.
That's not even remotely the browser. That's a module for the server.
Do you mean runs in the server's process so it doesn't have to start an interpreter every time it's invoked?
C: Unsafe at any speed.
C is not unsafe, your programming techniques are unsafe. C gives you a lot of control, but at the assumption that you will implement the safety checks yourself only when needed. That's why the language is so blazing fast in the first place. Safety checks eat cycles and make your binaries bigger.
I certainly wouldn't use it by choice, but if it's what my project needs, I wouldn't shy away from it.
C++: Overly complex
Complex as it may be, the complexity is, for the most part, justified. The language remains widely used because it's fast and powerful. You can't have those without sacrificing ease of use.
insane learning curve
To learn to use the language efficiently to it's full potential, yes. To learn to use it as an effective tool, no.
But really, the tools being difficult to use shouldn't be a deterrent for a professional. If you need the benefits of C++, you learn it despite the difficulties, or you can't be as competitive as the people who do.
no garbage collection
That's just not true. There are plenty of GCs for C++ and the standard library does give you a very basic reference counting for when GC is an overkill.
And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).
Being slow is not really a bad thing for a language. I'd kill to be able to write every single piece of code in Python and not have to see another pointer ever again.
That said, I don't really feel that Java gives me anything over C++. It's certainly not faster, and productivity wise, it's fairly similar. It's not inherently safer to use, and while C++ does give you some pretty unsafe capabilities, you can just not use those, while retaining the option if you end up needing it.
I'm not really sure what kind of issue you have with Java libraries through. If a certain library doesn't give you what you want/need, what's stopping you from using another that does?
Sure we do, but I wouldn't call it bitching, more 'giving suggestions and positive criticism' , ok well , with occasional bitching :-)
People dislike what they use, because they always look for something better ( it's human nature )
That's why things keep improving, because the community demands it.
If no one is complaining about your software, you have no idea what to improve.
You say you like Java : Java is a good example of how community process improved something which was really awful and dreadfully slow , into something which is literally used everywhere ( I love Java btw ) .
PHP has it's uses : it's very lightweight , and very fast , and as such , ideal for many basic sites.
Not to mention the price tag in comparison to J2EE.
You've basically decided that you'll be stuck with software engineering as it was in the 70s and to hell with progress, because that's what you're used to. If you truly believe that you can be a good professional without continuously learning, I've got news for you: in no other engineering discipline I know of would that be true. Doctors and even nurses won't be renewed their licenses without proof of continuing education. Civil, mechanical and electrical engineers need to keep up with new technologies both in the design and the end product sides of the process. Even educators often need to do continuing education or their licenses will be taken away. This "academic functionality" you speak of has been, for the most part, engineered as a solution to oft faced problems. Problems you're apparently unaware of. Problems that make you less productive, make your code harder to maintain, and lose money for your employer.
A successful API design takes a mixture of software design and pedagogy.
Singularity. Isn't that the next stage of evolution where nanotech and AI give us perfection and eternal life? Who would have thought the PHP community was at the forefront of machine intelligence?
Couldn't agree more. I'd actually argue that the "just get it done" mentality is only applicable to cute sample code. When you get even a 20kloc "production" code developed that way, it's usually a copypasta mess where 5% is probably publication-quality thedailywtf.com-grade material. When it gets to 200kloc, you've got a product that can't even be installed without hiring a consultant.
Then it grows to order of 1Mloc, and you get Lotus notes where just a test deployment will take you a week if you're lucky and have never dealt with it previously. All completely gratuitous complications that are a clear indicator of how broken a code base it must be -- there's no fundamental reason why you can't have a working test system after installing the fine RPMs and not mucking much beyond that, thank you. Zimbra is about as far as I'm willing to endure with an "enterprisey" deployment. Anything more than that means that someone somewhere likes things complicated just to keep themselves (or their contractor buddies) occupied at all costs.
A successful API design takes a mixture of software design and pedagogy.
Java certainly isn't assembly language, but to be honest, the only time I ever find it to be *slow* anymore is if I forget to give the JVM more ram (damn you, Sun, and now Oracle, for refusing to give us a default option that says, "just use as much ram as you need until Windows runs out of physical ram and starts swapping too much"). Since sometime around 1.6, if there's any meaningful difference between the performance of C# and Java under Windows in any use case not involving DirectX, I haven't really seen it. C# compiles to intermediate object code that gets compiled to native code before running. Java compiles to JVM assembly language, which gets compiled to native x86 code at launch prior to running. Different nomenclature, same difference.
The only area where Java really still falls on its face compared to .Net/C# is Swing... and Swing's problem isn't really *performance* anymore. Rather, it's the fact that Swing still firmly inhabits the "uncanny valley" where it mostly looks and acts like Windows, but doesn't inherit Windows' settings/history/context... so if you change the default scaling of Windows, or set custom favorite directories for the file dialog, or things like that, Swing doesn't change to reflect them. But actual speed hasn't really been an issue for a few years now. At least, not on anything quadcore, with at least 8 gigs of ram and running Windows or Linux (I'll grant that the Mac version of Java might still suck badly).
If you're unable to understand as simple concept as closures (no, it's not complex), you're not a professional, you're a CS drop-out.
Judging by your (mis)use of word "closure", you're indeed one of those. I mean, you don't like closures, but are you ok with non-capturing anonymous functions?
Do you really find something like "Vector result = new Vector(); foreach (Person p : people) if (p.age minAge) result.push(p.name); return result" less smelly than "people filter (_.age minAge) map (_.name)"? I guess you should only find the filter part smelly, as it's passed a closure, unlike map, which gets an anonymous function without free variables, so it must be OK.
Really, do go and educate yourself. Calling closures "hot new thing" just shows your ignorance. Even Rasmus already understood closures and included them in PHP, you're the only one struggling with a 50 year old concept of "function + variables in scope = closure".
> Fortunately, the "closures this, aspects that, list operators!" group makes a ridiculous amount of money cleaning up the mistakes and horrible non-engineering of the people who "just want to get things done".
And then the real engineers step in for yet more money to clean up the unmaintainable academic crap created in round 2. ;-)
>PHP's biggest problem - to me - is the lack of a FastCGI-style environment where code is already running and requests are just fed to the running daemon.
Wha? PHP has plenty of frustrating problems, but that's not one of them.
Setting up FastCGI with PHP ranges from easy to fancy. If you want easy, just install VirtualMin.
Here's some guy with a custom setup:
http://voidweb.com/2010/07/the-perfect-lamp-stack-apache2-fastcgi-php-fpm-apc/
PHP with FCGI most decidedly does not go out of existence at the end of an HTTP request. The daemon stays there, ready for the next request. Also, why do you say APC is immature? Works pretty well in my experience. If you set the memory allocation right for the cache, the PHP code stays entirely (95%) in the cache.
As for going from bytecode to machine code, yeah, OK. But how's that different for most uses of Python or Ruby--for the web. There's a Python C compiler, but people don't compile their web scripts.
I'm not a lawyer, but I play one on the Internet. Blog
Right hammer for the right job.
Why would you need multi-threaded programming for CRUD operations on a blog site (like Slashdot)?
Somehow or another, the executive mansion of the most powerful country on Earth seems to get by without closures, "cool" error handling (exceptions up the kazoo), and parallelism. (Whitehouse.gov runs Drupal, which is a CMS running on PHP and dumb old database like MySQL.)
The world is also bigger than just Java. For my banking, I want Java on the backend. For other stuff? As situation requires.
I'm not a lawyer, but I play one on the Internet. Blog
Where I work, we write code in C, C++, and Java. Without fail, the Java code takes less time to write and has less bugs.
In regards to your example, you have basically described a HashMap, for which pretty much all modern languages have an implementation. If you can calculate the index of the value you need in C, then you could calculate the hash lookup key in Java and use a Map.
I do not disagree that C has options available to it that are unavailable to Java, and that you can almost by definition produce a faster C version of any program compared to the Java version. However, the magnitude of the difference will be generally small, and for actual written applications (not just theoretical ones), it is reasonably possible that the Java version could actually be faster (especially if the time to develop each is equal).
So to call Java slow is generally not a true statement.
...... I'm tired to read and hear that COBOL is shit.
But it's really shit.
At work I use some stupidly expensive per licence software where the vendor decided in 2003 to just sack most of the C programmers and rewrite the entire thing in java. Now years later they've got the interface redone in java (it is a nicer interface though slower and uses insane amounts of memory for just a GUI interface - 2GB), but the backend remains in C apart from some java modules that are not quite ready for production use. I think it's about the right tool for the job instead of one language to rule them all.
C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!
Exactly. And that's why our kernels and drivers never need monthly updates for 0-day security flaws.
You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
Google will help. Or the internet movie database.
Of course since I'm correcting the correction the odds are good that I've misspelt something, and that my point that it's not worth going around being a grammar nazi will be lost.
Comment removed based on user account deletion
There is but not for short production runs where it would cost more to set up automation than it would to do the entire run. It's carbon fibre reinforced plastic and items are fabricated in almost exactly the same way as glass fibre reinforced plastic, for instance those carbon fibre squash raquets, carbon fibre tubing, carbon fibre fishing rods etc etc. Doing only 100 left tailplane segements for a new jet fighter model is cheaper to do as individual items than to set up automation for just about any choice of material.
Can we please drop the incorrect analogies and get back to PHP?
They're major impact has been to foster silly arguments and language wars.
I say we dump this text crap and go back to switches with blinky lights.
Who's with me?
The problem isn't that nobody is willing to do the work, the problem is that people are not ALLOWED to do the work. Or worse, people who don't know as much as they think they do have the power to stop others by not allowing check ins that would fix problems. The upper tier of the dev team is full of themselves; They don't want to listen to others because they want to do things "their way" even when others have shown this to be incorrect. And they REFUSE to educate themselves, the PHP core dev team is like people from the deep south or something.
- d
Well, you seem to forget that you can complain about parts of something while loving the whole of it. Didn't you ever complain about something your girlfriend did because you were terribly annoyed at that moment?
I shouldn't give it away, but let's just say it's a bad idea to go hunting with the guy that used to be CEO of the company that supplies that software before he got into politics. We're gradually shifting stuff to better stuff from startups that's probably written by those original sacked programmers.
C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!
It looks like you have a point, but look at it this way:
PHP is so awful that nowbody would dare use it for any serious stuff, like business websites!!!
PlusFive Slashdot reader for Android. Can post comments.
Missed some tricks from C, but once I learned how to properly program in an object oriented fassion things got a lot easier.
You should tell some one. As it stands now, no one can agree on what OOP even means, let alone how to "program in an object oriented fashion".
Hell, two of the most commonly cited "essential properties" of OO, encapsulation and inheritance, are opposed to one another! Not only is the paradigm ill-defined, the most common definitions are fundamentally incoherent!
Why this fad didn't die in the early 90's I'll never know. Objects can be handy. Let's keep those around. Oh, and bring back agents; those made sense. OOP, on the other hand, needs to die and die quickly. While we're at it, the GoF need arrested and tried for crimes against humanity -- and anyone who's ever created a FactoryFactory tried as an accomplice. I can only begin to imagine how many billions of dollars they must have cost the global economy...
Required reading for internet skeptics
Benchmarks show Java is only 50 to 100% slower than C. Hotspot and GC are on long running application way more efficient then C regarding memory management. So check your facts before telling lies
You made the rather important omission of C#. Or do you say that all Java's criticisms apply to it?
== Jez ==
Do you miss Firefox? Try Pale Moon.
What's the new trend? Flames for PHP. Let's everyone join and destroy this shameful thing which is clearly aimed for noobs, not for us! .so libraries I care about, has great DB interoperability, has a syntax I can work with, works good with apache. Why complain so much? Just point out what you don't like and request for changes. All this "I hate php with passion" seems very strange to me.
But after 15 years and tens of thousands of lines of code in POSIX C, C++, Delphi, Perl, etc I found I like PHP the most! Why?
Personal preference here:
-Great syntax. Yes, great syntax.Which for me means:
C-like blocks, not the delphi's funny stuff, not python's space-based block detection!. Who didn't try to remove semicolons or blocks for fun when they first wrote their first compiler? Well this isn't for fun. I want {.} not tabs and spaces. Why change something that works so good? Even friends who like python have nothing to say about this 'feature'.
-sane array syntax. Not Perl's @,$,etc maddness.
-lots of supported interoperability with OS shared libraries. And this code runs fast.
-reliability. I don't recall seeing a segfault from a PHP process. Where I frequently see our python (2.6) processes segfaulting.
-mod_php. Reliable. Works.
-PDO database abstraction layer. I mean Oracle's OCI support was working fine even for external LOBs from 1999 in PHP3, but PDO was a step in the right direction.
-Modern features added lately (closures, etc).
-Great, and I mean great, documentation. That alone is a big plus.
-Several good and easy enough Frameworks (I don't mean Zend)
So we have a language which is reliable, supported, has modern features, can call most
-S
I Just read a description of some software that read "lightweight Java..." and then I started laughing.
One of the reasons why PHP is still so popular is because you can get a hosting account at any cheap vendor, upload a PHP file, and expect it to work immediately. PHP has become an absolute necessity for webhosts to support, even Windows/IIS-based. Try finding one that doesn't support it.
Tumbleweed blows in the wind. In the distance, a bell tolls.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Esperanto?
It's an "engineered" spoken language that intentionally removed most of the inconsistencies and unnecessary rules of organically-derived spoken languages.
Table-ized A.I.
Civil, mechanical and electrical engineers need to keep up with new technologies both in the design and the end product sides of the process.
Counterpoint: we now have advanced composite materials that are a hell of a lot better than wood and all sorts of wiring designs that are more efficient, safer, and generally better than what we used in the 70s.
And yet most new houses have at least a wooden frame and still have three-prong good ol' 120VAC outlets throughout.
Why do you think that is?
And before you say that's not a fair comparison, look at it this way: you can't change the electrical system without breaking compatibility and pissing off a lot of homeowners, and wood's usually good enough to get the job done.
Both reasons apply to PHP.
(Conterpoint to counterpoint: wood can easily go up in flames, and 120VAC is dangerous when used by children. Both of these points *also* apply to PHP.)
The real litigious bastards...
That's great, but not terribly demanding by modern standards. If you had written it in C++ using smart pointers & standard containers, it would run faster. End of discussion.
Au contraire, mon troll.
I read about these things, I've experimented with a lot of them, because I've been a coder since diapers. This is what I do for fun, oddly enough. I've read about and toyed with closures until it "clicked", but even then I still couldn't find a legitimate use for them. Sure, there were a few "hey I could pull this stunt" moments, but it was nothing more than a cheap hack, in lieu of a slightly more laborious but classically understood approach.
If there is a common problem that is elegantly and optimally solved by closures, I have yet to encounter it. Unless that problem is having too many spare CPU cycles and not enough recursive stack frames.
-Billco, Fnarg.com