Re: Philosophical question

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Philosophical question
Date: 2011-12-15 04:14:58
Message-ID: CAPTjJmq2kOSvLupoKqKjWC7zd=WwEcvqtc7O4ju92Yj-qed=pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 15, 2011 at 11:25 AM, Leif Biberg Kristensen
<leif(at)solumslekt(dot)org> wrote:
>  Onsdag 14. desember 2011 22.21.04 skrev Chris Angelico :
>> The biggest problem with PHP, imho, is actually that it's so easy to
>> use. Anyone can get a WYSIWYG editor, save as HTML, and have a web
>> page... and then all you need to do is rename it to ".php" and put
>> some special tags in it, and look! You have a dynamic web page and
>> it's so awesome! At least, it is until you try to go further, and you
>> start adding mess on top of mess on top of mess.
>
> In my opinion, that's a pretty elitistic view. Certainly, that's one way of
> writing PHP, but it isn't the only one. Quite a few of us have started with
> something like what you've outlined here, but have long ago moved on to more
> maintainable coding practices.

Yes, many people have started badly and grown from there. The trouble
is that there are people - and, I think, quite a large number - who
start badly and stay there because they're able to do what they want.
And some of them are professional programmers, and that's one reason
why I see a lot of bad PHP and Javascript code around.

> The good thing about PHP is the low threshold, and you can start using it
> doing exactly what you outlined in your first paragraph. But somebody coming to
> PHP from any old procedural language, will soon find that PHP lends itself well
> to building function upon function, until you can really write the code you
> need to express anything you want.

Yes, it's good to have a low threshold. Yes, if you have programming
expertise, you can express yourself in PHP. Doesn't change the fact
that people who do NOT have programming expertise can get the idea
that they can code, based on an example copied and pasted from the web
and then modified a bit - and the fact that this happens in publishing
environments, not in the safety of someone's private/personal
experimentation.

[Inserting a quote from Edson Richter <richter(at)simkorp(dot)com(dot)br>]
> But I believe that there are more bad Javascript programmers (just
> check how many beauty-and-crap-never-work-as-planned-sites exists
> all around the world), only Javascript is not counted as a real
> programming language (who knows why?).

This is the same principle at work. In my opinion, Javascript is a
perfectly valid language (okay, apart from the naming mess -
Javascript, JavaScript, ECMAScript, etc, etc, etc - fold all of them
together into the notional entity that most people think of, and it's
a fine language). It runs into the same problem as PHP does, with the
additional low-ness of barrier to entry that you don't even need to
have a web server that supports it. Good language, too many bad coders
using it.

[Back to Leif Biberg Kristensen <leif(at)solumslekt(dot)org>]
>> There are a few more fundamental issues with the language, but mainly,
>> it gets the blame for myriad bad PHP programmers.
>
> Yes there's a lot of bad programmers out there. Most of them code in Java or
> Visual Basic.

Yep, Java and VB get bad programmers too. So does C. My point is,
though, that the _extremely_ low barrier to entry means that PHP gets
a particular class of novice programmer and puts tools in their hands
that some never bother to master, resulting in horrendous PHP code
that's a nightmare to handle. I was stating that the biggest problem
with PHP is bad PHP programmers, not bad language features. Although
this above statement of mine is a little ambiguous; what I meant is
that I do have some fundamental issues with the language (eg its
scoping rules are a bit odd, and adorning variable names feels like
syntactic salt, and it has acquired a lot of cruft eg
register_globals), but that these issues are not really all that
significant compared to the likelihood that a random piece of PHP code
will be bad.

>> I prefer Pike. It's designed for writing servers, performance is
>> pretty decent, it's a high level language, and it has great database
>> support (including Postgres-specific features, some of which are quite
>> handy).
>
> I'd like to look at this Pike. I don't think that my Web host supports it, but
> it might still be a fun experience.

It's extremely unlikely that a cheap web host will support it; Pike's
designed for writing servers, not writing dynamic web pages. One of
Pike's killer apps is a web server called Roxen, which (far as I know)
will do everything that most people want Apache to do; but the
language's primary derivation is from the world of MUDs. I have a
server that's been running for a year and a half, and a Pike process
that's been running on it ever since I fired up the server; it never
needs to shut down, even to bring new code online.

You can download a stable release from http://pike.ida.liu.se/ or get
the latest source code via git. As a language, Pike has a lot going
for it, but unfortunately the docs are somewhat lacking in places
(particularly the GUI facilities - yes, a language designed for
servers has GTK bindings).

Chris Angelico

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Duncan 2011-12-15 04:41:00 Re: Philosophical question
Previous Message Jay Levitt 2011-12-15 04:11:33 Re: Controlling complexity in queries