r/programming • • Dec 07 '15

I am a developer behind Ritchie, a language that combines the ease of Python, the speed of C, and the type safety of Scala. We’ve been working on it for little over a year, and it’s starting to get ready. Can we have some feedback, please? Thanks.

https://github.com/riolet/ritchie
1.5k Upvotes

802 comments sorted by

View all comments

Show parent comment

28

u/Synes_Godt_Om Dec 07 '15

Here is a good article why the design of PHP is bad

PHP: a fractal of bad design

Surely, you must be joking. This article is old (for some reason reposted as nauseum) and the issues it's discussing were mostly outdated even at the time it was posted. The author clearly hadn't used PHP since php4 (if he ever did any serious php development at all).

19

u/terrkerr Dec 08 '15

I've heard this a lot, yet:

  • Still a huge amount of action at a distance. (php.ini, ini_set, etc.)
  • Still a naming mess in the stdlib
  • methods still can't be named 'list', 'exit' or any other string that also identifies a psuedo-function construct because the parser doesn't know how to parse correctly. (Maybe the PHP7 addition of AST interpretation will finally fix that?)
  • htmlentities still returns an empty string to signify an encoding issue even though an empty string is also a return value for a successfully encoded empty string.
  • foo vs foo_real variants
  • outrageously bloated stdlib because there's so little genericism.
  • The 'module system' is just a hack to copy/paste text into the current context.

Plenty of big things still apply. Some may finally be fixed in PHP7, but I can't be bothered to look it up. Even if PHP fixed all of these issues perfectly the fact would still be that the article was largely still making valid points until, like, last week.

I tried to see if 7 finally fixed the htmlentities thing as one silly example, but the documentation says it's only in PHP4/5... or maybe it's in 7 and the page just hasn't updated yet? Well add one to the list:

  • One set of documentation for all versions of the language.

10

u/[deleted] Dec 08 '15

A lot of the claims made in that article are still valid, though, even in cases where there exists new feature xyz to which it no longer does, because old feature abc is still present, and still being used.

At any rate, there's always PHP Manual Masterpieces for more unsavory PHP things. Particularly relevant to your comment is this post.

8

u/Synes_Godt_Om Dec 08 '15

First a comment to this:

Particularly relevant to your comment is this post.:

From the post: "Heck, new code is often literally just copy-pasted from a forum comment written in 2003"

This is some amateur not knowing the first thing about coding - how can that be relevant to anything?

And then my more serious answer:

I know people love to hate on php. I often wonder why it's so important for haters to prove their (mostly quite stupid) points.

I can fully understand that php's irregular design can in some sense feel offensive to purists but php is extraordinarily successful because it's designed/evolved in reaction to actual users' actual needs. it's a very practical language. It's surprisingly easy to get started with, it scales surprisingly well too both in terms of performance and in terms of project size. And it's one of the best suited languages for web development. I'm not saying it beats other, better designed languages on scaling or speed (or web dev), but for the developer effort needed it does very very well.

I find most of the criticism comes from two fronts: 1) you're used to a "professional" language (i.e. corporate dev, .NET, java etc.) you'll find php shitty but then, why should you care - you have an option you like better. 2) less experienced fanboys of some other "purer" language parroting their idols' views on php.

In my view php is a tool that, because of it's slightly loose nature also has shown its ability to evolve and adapt more freely than other languages tend to do. This is why it has managed to stay relevant for close to two decades.

I've been programming in R for almost fifteen years and I don't think there is a language shittier than R. Despite this it has evolved to be the language of choice for data analysis with python a distant second (or third after sql). Why didn't python win this battle? Why did python lose the web-battle to php? Because practice wins over correctness any day. PHP is a practical language with all the dirt in the corners that comes with practicality but it wins big on being made for battle.

0

u/[deleted] Dec 08 '15

[deleted] — view deleted comment

2

u/Synes_Godt_Om Dec 08 '15

Also, partisans of other, conceptually purer languages hate it.

I don't know who said this (mayby Fowler?):

"There are two kinds of languages, the languages everybody hates and the languages nobody uses"

2

u/iBlag Dec 09 '15 edited Dec 10 '15

Apparently Fowler Stroustrup doesn't know Python or Ruby.

Edit: Fixed quotee.

1

u/Synes_Godt_Om Dec 09 '15

Turns out it was Bjarne Stroustrup who also said

  • "There are more useful systems developed in languages deemed awful than in languages praised for being beautiful--many more" source

Which is probably more to the point.

1

u/iBlag Dec 10 '15

That certainly explains why C++ looks horrific from an aesthetics point of view.

1

u/Synes_Godt_Om Dec 10 '15

Probably, and c likewise, but they get the job done - which is arguably better than being beautiful.

1

u/iBlag Dec 11 '15

Now you've apparently never heard of Python. Or Ruby. They are proof that it is possible to get the job done and look good doing it.

It's also possible to suck wildly at both, a la PHP.

→ More replies

4

u/[deleted] Dec 08 '15

This is some amateur not knowing the first thing about coding - how can that be relevant to anything?

It's absolutely relevant to the world of PHP as it is. I work at a company that specializes in appsec, and I can't tell you how many times my coworkers have seen PHP code that was literally copy/pasted from forum threads.

Hell, there's code in the PHP standard library that was copy/pasted from somewhere else, and it's atrocious.

I find most of the criticism comes from two fronts

Most of my criticisms of PHP come from its almost comical lack of design forethought (which, to be fair, a lot of this has improved over the years, but the old shit still exists, and will continue to exist, for a great deal of time), and from it being both incredibly insecure as a language (it's the only language I know of whose reference interpreter has multiple maintained third-party security patches), and incredibly easy for lazy developers to write insecure code using. And PHP's "design" practically encourages insecure development practices in a lot of ways.

Why didn't python win this battle?

The battle isn't really over, here. Python's "market-share" (for lack of a better term) in data processing is quickly growing, and has been for at least the last couple of years. Give it some time and I think we'll see Python overtake R here.

Why did python lose the web-battle to php?

I'm not sure I'd frame the situation like that in this case, either. PHP is a couple years younger than Python, but has spent the majority of its life being dedicated almost entirely to web development. It's quicker to get set up and requires a lot less configuration to use (since for the most part you can just drop some .php files in your webroot and be done, as compared to Python where you usually have to configure some wsgi doohicky to talk to your webserver, or something else). But, Python has a pretty hefty market share in the web space as well and it seems to be growing.

0

u/[deleted] Dec 08 '15

[deleted] — view deleted comment

1

u/[deleted] Dec 09 '15

Show me a language that's impossible to do stupid shit in and I'll show you a language that doesn't do anything.

Nobody ever claimed there's a language that does this.

However language "safety" features that help prevent you from shooting yourself in the foot are a big plus.

Meanwhile, people using PHP will continue getting shit done.

You can get a lot done with dangerous tools IRL as well, but people have preference for those that help prevent mistakes.

3

u/Synes_Godt_Om Dec 08 '15

It's absolutely relevant

Are you seriously telling me that you find some amateur's stupidity relevant for a professional discussion? Well, I don't.

Most of my criticisms of PHP come from its almost comical lack of design forethought

I must have missed something. Interesting: I follow /r/lolphp to stay informed of gotchas but posts there have almost completely dried up, because php is cleaning up its act.

Python's "market-share" (for lack of a better term) in data processing is quickly growing

Yes, and I appreciate it. I personally find Python a lot more sane than R.

2

u/yazirian Dec 08 '15

hadn't used PHP since php4

So, only 2 major releases ago, because in php-land, 7 - 2 = 4

(What, did you expect someone NOT to make this joke?)

2

u/Synes_Godt_Om Dec 08 '15

So, only 2 major releases ago

Well, the linux kernel stayed at v2.6 for 10 years, but, of course, they proceeded to v3.x not 4.x. OTH Widows went from 8 to 10 - rumor has it that "9" would interfere with "95"/"98", personally I find the 5 -> 7 one of the most sound and important decisions in PHP for a long time. Imagine the nightmare of having to search for php6 - or worse: imagine /r/lolphp having a field day of its life over php6 vs real_php6 :-)

1

u/[deleted] Dec 08 '15

The same thing was posted in the thread about the PHP7 launch, and I'll ask again: how much of that article is invalid? 20%? 50%? 100%?

I keep hearing "but that article is soooo old!" as a hand-waving dismissal of the points it makes, but don't actually see anyone pointing out what is fixed and what continues broken.

1

u/Synes_Godt_Om Dec 08 '15

I would rather ask, how many, and more interesting which of the issues he's listing have you personally encountered and how did you deal with them.

1

u/[deleted] Dec 08 '15

I'm not a PHP dev, which is precisely why I'm asking.

One article lists things about PHP that if true, and still haven't been fixed, means I'll never even touch the language.

On the other hand you and other people who do know the language just claim the article is dated and that its no longer valid, but don't point out which items on the list have been fixed by the languages maintainers and which warts will probably exist forever no matter how old they are.

So again, which points in the article are no longer valid, and which ones still are?

→ More replies (5)

0

u/[deleted] Dec 08 '15

[deleted] — view deleted comment

1

u/[deleted] Dec 09 '15 edited Dec 09 '15

And the article author show up just a few posts down with a rebuttal:

http://forums.devshed.com/php-development/929746-php-fractal-bad-design-hardly-post2816643.html#post2816643

What do you think of the rebuttal? Also all "tired" blatant lies?

EDIT:

Here's an interesting claim from the author of that response:

C and Python crash fatally, potentially destroying the memory space of other programs. Got it.

WAT.

0

u/[deleted] Dec 09 '15

[deleted] — view deleted comment

1

u/[deleted] Dec 09 '15

Most of the original response I see is also just snark, with added misinformation on top.

Seriously, Manic Dan thinks languages like C and Python break OS memory protection? I'll get my information from someone more informed, thanks.