[RndTbl] PHP undefined vars / array indices

Hartmut W Sager hwsager at marityme.net
Thu Jan 20 05:41:28 CST 2022


To clear my conscience, I finally have to weigh in with my vote on this topic, which has had a great discussion here!

I am an old-school ultra-hard-core algorithmic programmer (M.Sc. CompSci 1975) who absolutely believes in declaring everything, initializing everything before first use, etc.  Inconvenience is heavily mitigated with a high-grade programmer's text editor (or a good IDE).

I am appalled on a daily basis by the crap programming of Websites I encounter, even at places like Rogers, Fido, Telus/Koodo, Bell, etc., where I would expect to see much better (yeah, I visit those sites on behalf of others who can't even manage their own accounts).  The one major exception is the big banks - for the most part, their Websites are functionally still a cut above the rest.

The flurry of new "easy" languages we see seems to mainly exist to get people into "programming" who should never be programming anything serious in the first place.  That's what produced Cobol ages ago, that's what produced Python, and the trend continues unabated.

Hartmut W Sager - Tel +1-204-339-8331

________________________________
From: Roundtable <roundtable-bounces at muug.ca> on behalf of Brian Lowe <muug-mail at groupbcl.ca>
Sent: January 19, 2022 18:35
To: Continuation of Round Table discussion <roundtable at muug.ca>
Subject: Re: [RndTbl] PHP undefined vars / array indices


On Wednesday, January 19, 2022 9:08:52 A.M. CST John Lange wrote:



> I submit that in the non-declarative case you can easily spend a ton of

> time trying to trace the logic in the lower section of code without

> realizing your mistake (been there, done that).



At the risk of adding fuel to a fire, I agree with this. I'm a Perl fan myself, and I always add "use strict;" to my code. I appreciate the compiler telling me that it hasn't seen "very_long_variab1e_name" before (did you notice I dropped the changed the "l" to a "1" in "variable"?)



> Regarding Perl6, totally agree it should have been "Perl++".



Perl 6 does have a new name now; it was renamed to "Raku" in October 2019: https://www.raku.org.



> But in IMHO

> Perl dropped out of favour because of a point I made earlier, it is very

> often unreadable and therefore hard to learn and maintain. This is made

> worse by the fact that Perl programmers take pride in writing the most

> unreadable code possible (there is even a contest for this) and then look

> down their noses at less "expert" programmers who struggle to understand.



Very much this! There's a great temptation in Perl to play "code golf." I admit it feel cools to take a nicely nested if/then/else with a loop and turn it into:



> @var = map { condition ? yes : no } sort grep { /regexp/ } @var;



It looks neat and is nice and concise, but maintainable? Not so much. These days I shy away from doing that even in code I write for my own use.



Brian


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://muug.ca/pipermail/roundtable/attachments/20220120/63a5aeb0/attachment.htm>


More information about the Roundtable mailing list