in reply to Re: Textual Analysis and Idiomatic Perl
in thread Textual Analysis and Perl

You've hit the nail right on the thumb as they say.

In this case I was speaking of Perl culture, although all of the others apply.

I have dealt with many programmers who continue to write code in every language they encounter as if they were still using the first language they learned. ("You can write FORTRAN in any language.")

I'm sure we have all seen people who stick to an approach they were taught in a programming class, whether it is correct or even makes sense in the current context, because that is how they were taught.

In this case, I'm speaking of the shared culture of Perl (assuming it exists <grin/>). Obviously, some of the idioms above do not apply to other languages. Most languages have their own cultures and idioms. Some of those idioms translate to other languages, some don't. One of the things I like about Perl is the richness of the idioms it supports.

Strangely, some languages seem to try to remove idioms in favor of having only one way to solve any given problem.<shrug/>.

G. Wade

Replies are listed 'Best First'.
Re: Idiomatic Perl and Culture
by BrowserUk (Patriarch) on Dec 02, 2003 at 18:47 UTC
    Strangely, some languages seem to try to remove idioms in favor of having only one way to solve any given problem.

    Even worse, some people designate many of perl's unique, concise and powerful idioms as "tricks", and unilaterally declare them as deprecated. The usual rational for this is that the (mythical) "maintainance programmer" may be confused by them -- it's never 'them' that is confused, always the maintanance programmer.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!

      That's a very good point.

      <grin type="evil">I've even been known to use this as a feature.</grin>

      For code that requires a certain level of expertise and understanding to modify, making it idiomatic sometimes scares away those who shouldn't touch it. Kind of like those you must be this tall to ride this ride signs. I haven't yet come up with a you must know this much before modifying this code sign.

      Unfortunately, it sometimes backfires. People fix the code to make it more readable, and make it do something else entirely.<sigh/>

      G. Wade

        I wouldn't use it that way deliberately, but if programming is ever going to become a profession in the true sense, then it behoves those in charge to treat it as such.

        In the law, you have different levels of lawyers. In the english system, the barristers present the case, solicitors deal with the run of the mill problems. If a solicitor finds himself presented with a problem -- contract or area of the law where the case law is vague or indicisive, then s/he feels no qualms about making a consultation with a barrister or other specialist in order to clarify things.

        Your average GP becomes a specialist in general practice, dealing with the wide range of average complaints and conditions, but feels no shame in making a referal to a consultant for brain surgury or eye surgury or any other specialist fields.

        Yet we expect every programer to be able to handle every thing after one 3 or 4 year course, and the ethos that exists in most software houses and shops I've worked in is one that discourages people from putting their hands up and saying "I'm not sure I understand what this bit of code is doing".

        As always, the analogies aren't exact, but if you asked a brain surgeon to limit himself to those procedures that could be performed by an intern, or the eye surgeon to only use stitches that could be removed/replicated by a staff nurse, then medicine would be in a pretty poor state.

        I think the same is true for software. Dumbing every piece of code down to the level that the a recent CompSci graduate or Teach Yourself Perl reader can understand and modify just throws away so much. I strongly believe that the coder charged with maintaining a piece of code should be at least as experienced and capable as the person who wrote it, if not more so.

        I've worked in shops that segregated the production of new code from the maintainance of existing code, on both sides of the fence. I've also worked in a place where code is code, new or legacy. Where all code is initially written by whomever is available to do the job, but the first pass is always reviewed by one of the senior staff, and those senior people always make themselves available for consultation by anyone else who's unsure of how to tackle a particular problem -- including other senior people. The latter was hugely more productive than the former.

        The ethos of the place was not disimilar to PM in some respects. Anyone felt free to simply call out a question to whomever was within earshot, and anyone who had an idea for a solution would pass their ideas back. No one felt scared that their idea would be laughed at or that they would be set upon for expressing it. The result was that the final solution was (as is often the case with the more interesting problems here at PM) a combination derived from several peoples input and rapidly refined by the group.

        I remember hitting a problem late one Friday night when everyone one else had gone. I took the problem home with me and worked on it most of the weekend but still hadn't got a good solution by Monday morning. Within an hour of being back at work, I had described the problem aloud and between half a dozen people, a really good solution had been arrived at.

        I had been taken on for my expertise in the particular field we were working on, but I never learnt more, faster than when working in that environment.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        Hooray!
        Wanted!