Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

bobthecheese posted:

Most of the problems with php are, as you said, pretty much centred on people not reading the available documentation
Also that PHP's developers are incompetent

http://bugs.php.net/bug.php?id=32100
'You don't need finally blocks, just don't handle your exceptions, not a big deal'

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

EDIT - ^^^ what he said but more polite

bobthecheese posted:

That's what PHP 6 is meant to do, I think. Problem is that it's pretty much never going to get finished. For the large number of 'php developers' in the world, there are actually very few people developing php, which means that it takes time for features to get added/changed/updated.

While it's fun to rag on PHP for being poo poo, it's still a damned popular language, and actually quite powerful (when it's not being abuse by idiots). Most of the problems with php are, as you said, pretty much centred on people not reading the available documentation (which is really some of the best language documentation I've ever come across).

Doesn't mean it's not fun to pay out on it, though.

I realize that this may be an unfair generalization, but the impression that I get is that the large majority of PHP users are more concerned with having a rapid deployment language with lots of examples and frameworks that they can just copy and paste and it'll 'just work'. Again, anecdotal impression, this implies to me that the actual developing user base who work on the core language is quite small. This is also likely true of say, .Net, but there's a company investing time/money/etc into it regardless of the user base.

NotShadowStar
Sep 20, 2000

Scaramouche posted:

EDIT - ^^^ what he said but more polite


I realize that this may be an unfair generalization, but the impression that I get is that the large majority of PHP users are more concerned with having a rapid deployment language with lots of examples and frameworks that they can just copy and paste and it'll 'just work'. Again, anecdotal impression, this implies to me that the actual developing user base who work on the core language is quite small. This is also likely true of say, .Net, but there's a company investing time/money/etc into it regardless of the user base.

PHP is rapidly losing that advantage. For small stuff, things like Sinatra are way, way, way better than PHP, just as simple to deploy to any non-retarded webhost and even easier to get started developing on since you don't need the full LAMP stack that's loving retarded to get going. All you need is a Ruby interpreter and a text editor and you're off.

The only thing that PHP has for it is the same thing that Windows has, obtain a massive legacy base because it was the only thing around at the time that did something reasonably okay. Now they're chained to that legacy. So if PHP6 fixed everything and made it a decent language, stopped using the global namespace and fixed all the dumb poo poo in PHP it would have to break the huge legacy that relies on that dumb poo poo. Which wouldn't be worth it because even if you fix PHP it would be just another interpreted C-style syntax Java-class-style based language. Which at that point, you might as well write in C# or Java, or look at more interesting and less verbose languages like Ruby, Python and so forth.

NotShadowStar fucked around with this message at 23:21 on Mar 3, 2011

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

NotShadowStar posted:

The only thing that PHP has for it is the same thing that Windows has, obtain a massive legacy base because it was the only thing around at the time that did something reasonably okay. Now they're chained to that legacy. So if PHP6 fixed everything and made it a decent language, stopped using the global namespace and fixed all the dumb poo poo in PHP it would have to break the huge legacy that relies on that dumb poo poo. Which wouldn't be worth it because even if you fix PHP it would be just another interpreted C-style syntax Java-class-style based language. Which at that point, you might as well write in C# or Java, or look at more interesting and less verbose languages like Ruby, Python and so forth.

I agree that's the case as well. I'm curious what the endgame will be. Will it end up like COBOL/FORTRAN where too many 'untouchable' applications are running on it, and therefore stays around forever? Or will it be like pre-Borland Pascal and just disappear entirely?

wwb
Aug 17, 2004

Oh, that is definitely true of the .NET ecosphere. You just have microsoft finding creative ways to take a very slick, well thought out MVC stack and load it full of drag-n-drop fluff so converted VB6 developers can write web apps without the foggiest clue about http, html, css or javascript.

On PHP -- frankly the only selling point at this time is backwards compatibilty. You don't run php, you run wordpress or drupal that happens to run despite PHP.

In all fairness, back in the dark days in the early part of this decade, PHP was a decent choice. Your other options c. 2002:

a) ASP 3.0. Actually more of a WTF than php. Had cool features like "you should probably just reboot the server daily to make sure your poo poo runs. And sometimes that doesn't work" and "if you want to do basic web poo poo, like upload a photo, you'd better be prepared to shell out $$$$ for VisualInterDev, $$$$ for components and $$$$ for a dedicated server to run it."

b) ASP.NET 1.0. I'm not sure if anyone remembers how horrible early versions of ASP.NET or visual studio were. If you were doing anything seriously webby, you typically had to disable significant portions of the IDE. Moreover, no one really had their head around ASP.NET webforms as it was such a paradagim shift.

c) ColdFusion : perhaps the best of the breed back then from a technical level. Of course, writing logic in xml-style code is a WTF. And you were looking at $1200 to play ball, on top of OS licensing and such.

d) Java/JSP : probably the best choice for big apps. Though this was back when java was slow, java devs were rare and expensive and the frameworks were very young.

e) Perl cgi script. Remember lots of the basic web friendly CPAN poo poo didn't exist so you were probably parsing your own HTTP headers to get at the equivalent of $_GET[]. The most famous perl app of this era -- movable type -- actually was more of a compiler than a web app; it just generated your blog pages.

f) C++ cgi/module/ISAPI extension: if you really needed power, this is where you had to go back then. Now go find a graphic designer who could work with a C++ developer.

g) PHP: what, you mean you've something that automatically grabs poo poo out of URLs, kinda just works and I can splice it into my HTML rather than generating HTML in the back-end? And it's free?

Decision was kind of easy back then . . .

wwb fucked around with this message at 00:35 on Mar 4, 2011

spiritual bypass
Feb 19, 2008

Grimey Drawer

Scaramouche posted:

Will it end up like COBOL/FORTRAN where too many 'untouchable' applications are running on it, and therefore stays around forever?

It's already like this. Shops that use PHP do so because they can get a quick turnaround time with cheap developers. What was at first a cheap hack to make things work soon becomes a huge unmaintainable mess. The software is much slower to work on, but the pace of the business' demands continues. The developer becomes frustrated and quits. The company hires two new developers to replace him, who last for maybe a couple years then quit for the same reasons.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

rt4 posted:

It's already like this. Shops that use PHP do so because they can get a quick turnaround time with cheap developers. What was at first a cheap hack to make things work soon becomes a huge unmaintainable mess. The software is much slower to work on, but the pace of the business' demands continues. The developer becomes frustrated and quits. The company hires two new developers to replace him, who last for maybe a couple years then quit for the same reasons.

I think the real metric will be, how important are the applications running on the PHP platform? I mean, will the world collapse because bloggers can't post any more? I have an acquaintance who works on financial COBOL systems who has put off retirement for the last 5 years; his salary has nearly doubled each year. I don't see the institutions and organizations invested in PHP making that kind of fiscal commitment to keep the language alive.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Wells Fargo is merging in the data from Wachovia's databases with PHP

:ughh:

wwb
Aug 17, 2004

^^^Ugh. Though is that a case of them using PHP as a scripting language to merge the DBs -- which could be somewhat defensible -- or is it a case of them building the new combined wfc + wachovia web stack on some horror of a PHP script.

@Scaramouche : bloggers is the easy part. Scary part is the insane penetration of drupal into just about everything content oriented on the web now. Dear god why.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

wwb posted:

^^^Ugh. Though is that a case of them using PHP as a scripting language to merge the DBs -- which could be somewhat defensible -- or is it a case of them building the new combined wfc + wachovia web stack on some horror of a PHP script.

@Scaramouche : bloggers is the easy part. Scary part is the insane penetration of drupal into just about everything content oriented on the web now. Dear god why.

"Content-oriented"? I've not heard that before. What's an example of something that isn't content-oriented?

spiritual bypass
Feb 19, 2008

Grimey Drawer
It's mostly a bullshit MBA word, but you could get some definition for it by juxtaposing it with "data-driven"

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Hammerite posted:

"Content-oriented"? I've not heard that before. What's an example of something that isn't content-oriented?

I would guess maybe feature-oriented? The interesting question arises in that what would be a contentless feature. Maybe I should make a web site that does... something. You never know what it is, but when you push a button something happens. It might add two numbers together. It might open a garage door somewhere. I could call it SchroedingersDoubleSlitBlackBox.com

1337JiveTurkey
Feb 17, 2005

Hammerite posted:

"Content-oriented"? I've not heard that before. What's an example of something that isn't content-oriented?

Any site where viewing content created by the site owner or someone else is a means to an end rather than an end in and of itself. You can go to Amazon just to read reviews and look at book covers, but most people go there to buy stuff.

wwb
Aug 17, 2004

^^^^bingo. Granted this is becoming much more blurry these days -- just about anyone is turning on some social networking hoo-ha.

tef
May 30, 2004

-> some l-system crap ->

Hammerite posted:

PHP's many and varied shortcomings have been well-documented here and elsewhere. So it seems surprising to me that nobody has either (i) forked it and radically overhauled it (by breaking backwards compatibility);

Why fork php when you can use use an existing toolkit?

no-one beyond php programmers is really interested in writing cgi scripts anymore :v:

quote:

or (ii) set out to write a "better" version which has a less broken parser, more elegantly implemented language features, a more consistent standard library etc. Is there are reason why there isn't a "php, but better" out there?

the existing code is tied heavily to the zend engine. it is not something you can refactor easily, or cleanly.


quote:

So given that PHP does at least do one or two things right (you can write a script, upload it and it will work right loving now without needing to faff about - and it gets out of your way quite well if you want to do something simple, and has everything you might want in its standard library); but does a lot of things wrong, why isn't there something that takes the good things about PHP and loses the bad parts?

:spergin:


most frameworks are targeted slightly above 'hello world' - designed for projects that have database bits in them for example and try to make the larger applications much easier, at the expense of the toy ones.

it is a hard balancing act.

tef
May 30, 2004

-> some l-system crap ->

bobthecheese posted:

Most of the problems with php are, as you said, pretty much centred on people not reading the available documentation (which is really some of the best language documentation I've ever come across).

the thing is with the php documentation is: you know it is good because you are always looking at the documentation because you can't remember any of it. for trivial tasks, too.

other languages have pretty good documentation too, and having looked up stuff in c#, java, python and perl I can't say php has much edge beyond looking up function_name really quickly. but no-one else really needs that because they can remember the order of the arguments to the function.

php also has a plethora of bad ideas in the comment section to, just to make up for any useful information that might be there.



why are the php apologists are quick to blame users?

the language is inconsistent - some things work, some things don't (ahem foo(1,2,3)[1])
the library is inconsistent - it's not portable across php installations because of site settings, it has different naming schemes and argument ordering for many of the functions, and a litany of deprecated functions to trip up the newbie programer
the runtime has a terrible security history too, let alone some of the design decisions.


remember: php is maintained by those php programmers you are so eager to blame.

tef fucked around with this message at 05:19 on Mar 4, 2011

tef
May 30, 2004

-> some l-system crap ->
php is simply trading off security and maintainability for ease of hello world. the lack of any sort of library system beyond include files is something few other scripting languages suffer from.

tef
May 30, 2004

-> some l-system crap ->
and if there was some 'better php' out there you can be goddamn sure none of you php programmers would bother trying to use it

you won't even use something that might be better now if it involves a little thinking

McGlockenshire
Dec 16, 2005

GOLLOCKS!

tef posted:

the language is inconsistent - some things work, some things don't (ahem foo(1,2,3)[1])

FWIW, this is possible in PHP trunk (5.4?)

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
I love you, tef.

tef
May 30, 2004

-> some l-system crap ->
I should markov chain all my php posts together it would be as effective

tef
May 30, 2004

-> some l-system crap ->

McGlockenshire posted:

FWIW, this is possible in PHP trunk (5.4?)

wow, now that's a fast pace of development.

NotShadowStar
Sep 20, 2000

tef posted:

php is simply trading off security and maintainability for ease of hello world. the lack of any sort of library system beyond include files is something few other scripting languages suffer from.

Thing is, with something like Sinatra Hello World is even easier to understand than PHP

>gem install sinatra

code:
#hello_world.rb
require 'sinatra'

get "/" do
  "Hello world"
end
Done.

Don't even need to wrangle with the Apache beast
> ruby hello_world.rb
== Sinatra has taken the stage ...
>> Listening on 0.0.0.0:4567

tef
May 30, 2004

-> some l-system crap ->

NotShadowStar posted:

Thing is, with something like Sinatra Hello World is even easier to understand than PHP

to really beat php you have to have it easy to 'deploy' it to oversold shared hosting :v:

you know that bit where you ftp in and then work out how to chmod a file

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

to really beat php you have to have it easy to 'deploy' it to oversold shared hosting :v:

you know that bit where you ftp in and then work out how to chmod a file

code:
> git push heroku master

NotShadowStar
Sep 20, 2000
Depends if the shared hosting is loving terrible and doesn't have Passenger. Most do these days. It's not hard to find a $5/month shared host that does.

Once you have that, then it pretty much is as easy as FTP files over. You just need two, a standard 'config.ru' file that starts your hello_world, and then your hello_world. Someone doing 'hello world' doesn't understand what's in the config.ru, but they don't need to.

code:
#config.ru
log = File.new('log/sinatra.log', 'a')
$stdout.reopen(log)
$stderr.reopen(log)

require 'public/hello_world'
run Sinatra::Application
code:
#public/hello_world.rb
require 'sinatra'

get "/" do
  "Hello world"
end
Assuming that the webhost has Sinatra, which they likely do. Otherwise you can just FTP it along with the rest of your stuff, just like you would any other PHP framework and actually more secure because the framework files aren't readable from the outside. I'm pretty sure CakePHP works like that.

I'm just speaking from my extensive Ruby experience. Python might have something similar these days, but I check around once in a while and the Python community never seems interested in easy deployment outside of the dead mod_python. Or WSGI wrappers :suicide:

NotShadowStar fucked around with this message at 07:23 on Mar 4, 2011

dexter
Jun 24, 2003

NotShadowStar posted:

Assuming that the webhost has Sinatra, which they likely do. Otherwise you can just FTP it along with the rest of your stuff, just like you would any other PHP framework and actually more secure because the framework files aren't readable from the outside. I'm pretty sure CakePHP works like that.

CakePHP doesn't do that by default. While you can upload the entire CakePHP install (libraries and app) into /usr/local/www/cakephp and point your virtual host's documentroot to /usr/local/www/cakephp/app/webroot/, no one does that. There's an index.php and .htaccess in /usr/local/www/cakephp, /usr/local/www/cakephp/app and /usr/local/www/cakephp/app/webroot/.

I got so much poo poo for separating out our documentroot, application and cakephp libraries. Who would ever want to share an application code base and cake libraries between $y sites? :ughh:

Also, do they reference the fact that you probably should separate everything out and put the mod_rewrite rules in your vhost configuration? Hell no.

dexter fucked around with this message at 08:05 on Mar 4, 2011

A A 2 3 5 8 K
Nov 24, 2003
Illiteracy... what does that word even mean?

wwb posted:

In all fairness, back in the dark days in the early part of this decade, PHP was a decent choice. Your other options c. 2002:

e) Perl cgi script. Remember lots of the basic web friendly CPAN poo poo didn't exist so you were probably parsing your own HTTP headers to get at the equivalent of $_GET[]. The most famous perl app of this era -- movable type -- actually was more of a compiler than a web app; it just generated your blog pages.


Perl had CPAN and mature modules for web development before 2002. I started using Perl in 1995 and never had to parse headers. PHP was never a decent choice. It was always for the type of person who couldn't be troubled to put in more than the bare minimum effort to learn the environment and thought they could be a useful developer without having to touch or understand anything about the web stack outside of their script.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



tef posted:

wow, now that's a fast pace of development.

Hey, man, it'll probably be released in 2012 and then become common on cheapo shared hosts some time in 2014. You can't rush these things because it's so 'important'.

At this rate, PHP will become a decent language about 5 years before I retire. Of course, I'll still be using it then because now that my resume has been tainted by it, I can never escape.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Nobody with half a clue chooses PHP. But still, PHP may choose you. Experience the freedom of the marketplace.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

rt4 posted:

Nobody with half a clue chooses PHP. But still, PHP may choose you. Experience the freedom of the marketplace.

This reminds me of a rhyme my friend used to say about Judaism,

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



rt4 posted:

Experience the freedom of the marketplace.

Yeah, it looks like this:
Me: Yeah, I mostly work with PHP now, but it's a terrible language and I'd like to get back to C# or really anything else...
Recruiter: Are you willing to take a pay cut?
Me: fffffffff :emo:

I've had that conversation 3 times now. Kids, don't do PHP. It will gently caress you up.

Captain Capacitor
Jan 21, 2008

The code you say?

Munkeymon posted:

Hey, man, it'll probably be released in 2012 and then become common on cheapo shared hosts some time in 2014. You can't rush these things because it's so 'important'.

At this rate, PHP will become a decent language about 5 years before I retire. Of course, I'll still be using it then because now that my resume has been tainted by it, I can never escape.

A lot of my background is in PHP, but at one point I just snapped and couldn't take it anymore. I made a "trial run" weekend where I tried .NET, Ruby/RoR and Python and now I make a living doing Sysadmin stuff for Django sites. PHP has been completely banished from my Resume, referred to as the generic "Web Development" phase.

A A 2 3 5 8 K
Nov 24, 2003
Illiteracy... what does that word even mean?

Munkeymon posted:

Yeah, it looks like this:
Me: Yeah, I mostly work with PHP now, but it's a terrible language and I'd like to get back to C# or really anything else...
Recruiter: Are you willing to take a pay cut?
Me: fffffffff :emo:

I've had that conversation 3 times now. Kids, don't do PHP. It will gently caress you up.

PHP doesn't inherently pay more. There's such a huge supply of those developers. Maybe web programming in general pays more than other types of programming. When you apply for a Python job, you'll hear how hard it is to find candidates who know Python.

Zhentar
Sep 28, 2003

Brilliant Master Genius
I hope PHP continues to live for a long, long time, and continues to appear in thread like this one. It makes me feel a little better about working with MUMPS :smith:.

spiritual bypass
Feb 19, 2008

Grimey Drawer
I wouldn't care how bad of a language PHP is if it paid well. It doesn't.

The bullshit Munkeymon is getting is companies who say "maybe you have 10 years of PHP but you have 0 years of Java, so we're going to pay you like someone with no programming experience", which is obviously unacceptable.

raminasi
Jan 25, 2005

a last drink with no ice

NotShadowStar posted:

It's a huge mess to read and almost assuredly means that you're doing logic that's far too convoluted than it should be.

I know there's potential for some great line noise if misused, but am I really in the minority feeling that
code:
string whatever =
    foo == SomeEnum.First  ? "Something" :
    foo == SomeEnum.Second ? "Something Else" :
    foo == SomeEnum.Third  ? "Another Thing" :
    foo == SomeEnum.Fourth ? "A Final Thing" :
                             "The Default Thing";
is more elegant than (and at least as readable as) a corresponding if-else chain?

The Reaganomicon
Oct 14, 2010

by Lowtax

Munkeymon posted:

Yeah, it looks like this:
Me: Yeah, I mostly work with PHP now, but it's a terrible language and I'd like to get back to C# or really anything else...
Recruiter: Are you willing to take a pay cut?
Me: fffffffff :emo:

I've had that conversation 3 times now. Kids, don't do PHP. It will gently caress you up.

Deny knowing anything beyond the basics about PHP. Deny, deny, deny.

GrumpyDoctor posted:

I know there's potential for some great line noise if misused, but am I really in the minority feeling that
code:
string whatever =
    foo == SomeEnum.First  ? "Something" :
    foo == SomeEnum.Second ? "Something Else" :
    foo == SomeEnum.Third  ? "Another Thing" :
    foo == SomeEnum.Fourth ? "A Final Thing" :
                             "The Default Thing";
is more elegant than (and at least as readable as) a corresponding if-else chain?

You would be the minority that likes using languages without a switch construct.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



The Reaganomicon posted:

Deny knowing anything beyond the basics about PHP. Deny, deny, deny.

I think it's actually what rt4 said, which might be due to technical recruiters and generic HR people assuming knowledge is not at all portable between these strange acronyms they are told to look for on resumes.

quote:

You would be the minority that likes using languages without a switch construct.

Show us switch statement that can deal with greater than or less than and that would be a valid alternative. I'm OK with what GrumpyDoctor wrote and the only problem I would have with it is that I don't trust all other programmers to understand the ternary operator well enough to not accidentally gently caress it up. Several people I work with would be totally lost, for example.

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
I think ternaries, especially chained ternaries like that example, can be very useful for assigning to final variables (or the equivalent in your language.)

If they're formatted carefully, chained ternary operators are not difficult or unpleasant to read. Nesting them is what you need to watch out for.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply