[Info-vax] Fortran
Bill Gunshannon
bill.gunshannon at gmail.com
Thu Dec 6 21:05:16 EST 2018
On 12/6/18 8:46 PM, Arne Vajhøj wrote:
> On 12/6/2018 8:34 PM, Bill Gunshannon wrote:
>> On 12/6/18 8:26 PM, Arne Vajhøj wrote:
>>> On 12/6/2018 8:14 PM, Bill Gunshannon wrote:
>>>> In my 40 years of doing C I have never seen C as bad as
>>>> most of the PHP I have seen outside of the Obfuscated
>>>> C Contest. And even much of that was more understandable.
>>>>
>>>> I have seen PHP that was so confusing that after being away
>>>> from it for three years the original author couldn't figure
>>>> it out, or fix it.
>>>
>>> Weird.
>>>
>>> PHP is a rather simple language.
>>>
>>> Usually very straight forward to see what it does. At least
>>> if one has seen a "C family" language before.
>>>
>>> There are a lot of bad PHP code violating all sorts of
>>> best practices for design. But it is still readable.
>>>
>>> A piece of trivial PHP code:
>>>
>>> <?php
>>> function fac($n) {
>>> if($n <= 1) {
>>> return 1;
>>> } else {
>>> return $n * fac($n - 1);
>>> }
>>> }
>>>
>>> for($i = 0; $i <= 10; $i++) {
>>> echo sprintf("fac(%d) = %d\r\n", $i, fac($i));
>>> }
>>> ?>
>>>
>>> Most programmers should find that very simple.
>>
>> And, as a trivial piece of code, it really does nothing.
>> That's easy to understand. But, as soon as it gets complex
>> enough to do anything the fun begins.
>
> What fun?
>
> What constructs in PHP are making it difficult to read?
>
> The above code is unrealistic short.
>
> But most real world PHP code even though longer use very
> few language constructs. Often it is just function, if,
> for loop, foreach loop and a few PHP functions that are
> often very C inspired.
>
I wish I had kept the program that caused all the
trouble. It was a program to register for the Dept.
High School Programming Contest. It broke when PHP5
came out. A professor and 2 students and a former
student, the one who wrote the program originally,
worked on it for days with no success. I replaced
it with a shell script and some awk in about 15
minutes. I later wrote a whole new version in COBOL
(as a proof of concept) and that took about half an
hour. I looked at the original program as well and
opted to not waste my time trying to figure it out
when other solutions were available.
bill
More information about the Info-vax
mailing list