Re: Philosophical question

Поиск
Список
Период
Сортировка
От Chris Travers
Тема Re: Philosophical question
Дата
Msg-id CAKt_Zftz-xzC_mJr4BgBKZGZgbfB4s16s6XV0kZTNm40b7+k7g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Philosophical question  (Chris Angelico <rosuav@gmail.com>)
Ответы Re: Philosophical question  (Chris Angelico <rosuav@gmail.com>)
Список pgsql-general
On Wed, Dec 14, 2011 at 8:14 PM, Chris Angelico <rosuav@gmail.com> wrote:

>> 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.

That's not a problem with PHP.  I could name projects in Perl where a
single developer started programming badly and 12 years later has
barely improved.........  I argue the same for Python but haven't come
across such projects yet.

>
>> 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.

To be fair, isn't that an argument against whatever the popular
programming language is of the day?  I mean, we can all remember
Matt's Scripting Archive and Perl.....

>
> [Inserting a quote from Edson Richter <richter@simkorp.com.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.

Well, Javascript and PHP actually have two fundamentally different
issues associated with them.

PHP is lexically bound to the task of preprocessing SGML files, which
is why all programming logic is typically contained within SGML PI
tags.  It's sort an upside-down templating system.  When you combine
this feature with the low barrier to entry things can get especially
bad, specially as people start to try to do things like write GTK
programs in the language (something it is most definitely not designed
for).  Additionally you have the fact that a lot of PHP documentation
included examples which were subject to SQL injection exploits and the
like......

Javascript is a nice light-weight automation language but until
recently (and arguably even today!) it's use was largely limited to
client-side scripting for web pages.  Here you have a low barrier to
entry combined with a niche where the barrier to entry probably should
be reasonably low in the area of light-weight scripting, and so you
run into problems when people start doing heavier-weight scripting.  I
the issues here are lower and the language is starting to spread out
to other areas (NoSQL, node.js, and the like).

There is a lot of bad Perl code out there too though.
>
> [Back to Leif Biberg Kristensen <leif@solumslekt.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 know of 200k line Perl projects though which could easily serve as:

1)  A textbook on how not to program generally
2)  A textbook on how not to program Perl in particular
3)  A textbook on how not to write secure code.....

So the problem is hardly limited to PHP.

Best Wishes,
Chris Travers

В списке pgsql-general по дате отправления:

Предыдущее
От: Darren Duncan
Дата:
Сообщение: Re: Philosophical question
Следующее
От: Chris Angelico
Дата:
Сообщение: Re: Philosophical question