Re: [OT]: In my Farthers House there are many mansions
On Sat, Nov 02, 2002 at 12:13:19PM -, Jeff wrote: It sounds like you're saying that you should only use a subset of Perl as some programmers may not understand the other parts of it? That is what I'm saying. I'm aware that this is a controversial opinion in the Perl world. However, I think it's reasonable to know your audience and write for them. Have to agree 100% with Perrin - in my experience, refactoring for performance is often used as an excuse for 'rewrite in my style', I'm not sure anyone has actually posited using map for performance, but in most cases that would indeed be a pretty stupid reason to use it. and at this point, future maintainability is usually severly compromised. Someone decides to replace all foreach loops with map, because this is more advanced and kewl. Automatically replacing all 'foreach' loops with maps would also be pretty stupid. They're different thing, used for different purposes. But using a foreach when you should be using a map is no better. When someone misuses something, the wrong approach is to no longer use it. The correct approach is to educate people on the correct use. Tony
Re: [OT]: In my Farthers House there are many mansions
-- Tony Bowden [EMAIL PROTECTED] On Sat, Nov 02, 2002 at 12:13:19PM -, Jeff wrote: It sounds like you're saying that you should only use a subset of Perl as some programmers may not understand the other parts of it? That is what I'm saying. I'm aware that this is a controversial opinion in the Perl world. However, I think it's reasonable to know your audience and write for them. Have to agree 100% with Perrin - in my experience, refactoring for performance is often used as an excuse for 'rewrite in my style', I'm not sure anyone has actually posited using map for performance, but in most cases that would indeed be a pretty stupid reason to use it. See the Schwartzian Transform for an excellent example of where you would use map for performance. Main advantage is getting perl to manage the list space. If I find myself writing for(blah){ push @foo, something } it can usually be done more simply via @foo = map { something } ( blah ). If you end up making large lists, especially in loops, then map can be a speedup. It is also faster if you have to flatten out strucures frequently (vs iterating over keys %foo and assigning things one at a time). map can also be convienent in allowing for lexicals that are assigned when they are built, similarly grep: if( my @process_this = grep {-s $cutoff} @filz ) { deal with @process_this here, know it won't outlive the braces. } Defining the lexicals in a scope where the don't outlive their purose can be a big help in maintainability. -- Steven Lembark 2930 W. Palmer Workhorse Computing Chicago, IL 60647 +1 800 762 1582
RE: [OT]: In my Farthers House there are many mansions
-Original Message- From: Perrin Harkins [mailto:perrin;elem.com] Sent: 01 November 2002 18:43 To: Tony Bowden Cc: [EMAIL PROTECTED] Subject: Re: [O] Re: Yahoo is moving to PHP ?? Tony Bowden wrote: It sounds like you're saying that you should only use a subset of Perl as some programmers may not understand the other parts of it? That is what I'm saying. I'm aware that this is a controversial opinion in the Perl world. However, I think it's reasonable to know your audience and write for them. That's the good part of More Than One Way. The New York Times writes their articles for a certain reading level, and I do the same with my code. snip... - Perrin Have to agree 100% with Perrin - in my experience, refactoring for performance is often used as an excuse for 'rewrite in my style', and at this point, future maintainability is usually severly compromised. Someone decides to replace all foreach loops with map, because this is more advanced and kewl. Does anyone else here remember the COBOL construct ALTER GOTO? I knew a chap who styled himself 'Super Hot Software Systems', whose favourite thing was ALTER GOTO - he soon got told where to go to! Look it up - it's a nightmare. Another time, a contractor working for me complained bitterly about someone elses obtuse code and lack of comments - the other party said 'Why don't you scroll up?', which he did - lo and behold, about two pages of beautiful comment. Mmmm as he read the comments, from the top, the complainant highlighted each line [easier to read] and when he understood the point of it all, pressed Enter - not realising that this replaced two screens of comment with an empty line... ah ha! we finally figured out the answer to the song: 'Where have all the comments gone?' 8-)
Re: [OT]: In my Farthers House there are many mansions
From: Jeff [EMAIL PROTECTED] Another time, a contractor working for me complained bitterly about someone elses obtuse code and lack of comments - the other party said 'Why don't you scroll up?', which he did - lo and behold, about two pages of beautiful comment. Mmmm as he read the comments, from the top, the complainant highlighted each line [easier to read] and when he understood the point of it all, pressed Enter - not realising that this replaced two screens of comment with an empty line... ah ha! we finally figured out the answer to the song: 'Where have all the comments gone?' Good story - and a good tie-in to the other off-topic thread about whether on not it is worth the trouble to use CVS. If you make sure that the only way to get between your workspaces and the test/production servers is a commit/update step, cvsweb can always provide a color-coded answer to questions like that. --- Les Mikesell [EMAIL PROTECTED]