Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

A conversation with a C programmer

by Anonymous Monk
on Mar 15, 2006 at 09:01 UTC ( #536792=perlmeditation: print w/replies, xml ) Need Help??

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: A conversation with a C programmer
by ptum (Priest) on Mar 15, 2006 at 14:56 UTC

    Heh. I've not found comments like "You're not a programmer at all ... " to be particularly helpful.

    You might consider jettisoning some of the remaining 30% of your arrogance. Having been on the receiving end of such comments as: "You're not a real programmer because you code in Perl rather than C++", I can't say that I enjoy it much. Too often such 'jesting' or 'teasing' is a socially acceptable veneer covering a deeper, uglier disprespect. Language holy wars are fruitless and they erect barriers to communication and getting work done.

    If I need to puff myself up, I try to find a way to do it without tearing someone else down. I much prefer a win/win situation to a zero sum game or (more often) a lose/lose situation.

    Perhaps you have a solid relationship with your C-programmer friend, and such banter can be taken positively and constructively. Maybe I'm just patronizing you to make myself feel better ... if so, I should take my own advice. :)


    No good deed goes unpunished. -- (attributed to) Oscar Wilde

      I think the OP was perhaps making a learned observation.

      Someone who does c, and sees that code that supposedly came from a friend "who knows" what he's doing- maybe that person would look at it and be asking more questions then the original ones. In fact, a programmer would possibly find it quicker to lookup those answers and quickly learn some regex common sense - then to try to get another human being's attention about it- that early on in the game.

      Especially c, c is not "easier" then perl. Saying you're a programmer carries some punch- (and a c programmer.. c is some serious stuff). I try to take it to mean one of two things, either you're not a programmer, or you're a hard veteran. Personally I am not a coder, It's like being a marine in that movie Jughead- getting branded.. anyway.

      Personally -I just code. I write some software when I can't find an already existing solution for the problem.

      Anyway, the OP came here I think with good intentions, maybe to share some laughs- etc- and it may not be everyone's cup of tea how he does it.

      Personally I have been scolded and flat out told "you don't know what you're talking about" by my best teachers in all fields of life. Sometimes you need that- before your mind goes into outer space.

      And yes... He wasn't the most explanatory- but he was helpful. I think the conversation did leave it open if the "c programmer" was really a programmer. And if you're gonna learn, to help your teacher you have to tell them what you don't know. Dude was obviously trying to be helpful until he realized that the "c coder" was not being very honest about what he did and did not know.

      If the c guy *was* a "programmer", then the way you would go about helping them is different then how you would go about helping them if they are not! So- he needs to ask quick and dirty- "are you a programmer really?"

      That's one way of looking at it.

        You may be right ... perhaps I was just cranky when I posted that comment yesterday. It is allergy season for me, here. :)

        I guess what really busted my chops was the 'at all' part of the "You're not a programmer at all" quote ... I just don't see any way not to take that as an unkind slur, no matter what the self-perceived skill level is. Clearly someone who is 'coding' is at least trying to be some kind of a programmer. Of course, in my rather narrow little world, I assume that everyone wants to be a programmer. :)

        But as you say, I would help a programmer differently than I would help a 'normal' person, so it is important to find out with whom one is dealing.

Re: A conversation with a C programmer
by derby (Abbot) on Mar 15, 2006 at 14:33 UTC

    Did you need to rock his boat that much? You could have easily answered his question and made him feel good about Perl with

    next unless $file =~ /xls$/;
    he'd understand that.

    -derby
      Along those lines, it probably would have been a nice gesture to let the C programmer know that
      next if($file eq "."); next if($file eq "..");
      can be condensed to
      next if $file =~ /^\.{1,2}$/;
      Isn't that more Perlish, and help the programmer see more of the usefulness of regexes without making him too lost in what is going on? But now that I think about it, the whole snippet can just be compressed to something like
      opendir(TARGET, $target); while($file = readdir(TARGET)) { &process_new_file($file) if $file =~ /\.xls$/; }
      right? Do you think that would rock the boat too much?
        opendir my $dh, $target; /\.xls$/ and process_new_file($_) while readdir $dh;

        I started out writing this facetiously, but now I kind of like it! It reads very nicely. YMMV =)

        I think
        next if $file =~ /^\.\.?$/;
        or even
        next if $file =~ /^\.+$/; # no longer recommended. see below
        is much nicer than
        next if $file =~ /^\.{1,2}$/;

        But that's just me.

        UPDATE/note: yes, the second one will also match files named with any quantity of dots as long as that's the entire filename. In practice, I've never seen a file that started with "..", but I agree it's an issue.

Re: A conversation with a C programmer
by revdiablo (Prior) on Mar 15, 2006 at 17:33 UTC

    Let us hope his $target directory never contains whitespace, or your replacement would fall down and go boom.

    Update: Also, let us further hope his process_new_file can handle the fact that your new version is now passing the $target along with the file basename.

      Let's also hope that he's not running an old version of perl, either. On old systems, glob() (and the diamond glob operator) called the external shell program csh, which overzealous sysadmins were prone to deleting when they "upgraded" to their favourite shell.

      As I understand it, glob() still calls File::Glob; and a bug in the handling of tags is why I can't make debug mode work with the old perl5.6.1 scripts we have on our system. *sigh*. In other words, using glob() has always been a risky proposition.

      --
      Ytrew

Re: A conversation with a C programmer
by Steve_p (Priest) on Mar 17, 2006 at 00:45 UTC

    I have to scratch my head about the C programmer who is not already familiar with glob().

      I've been using C for best part of 25 years, but I'd never encountered glob() until I used Perl.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      Guilty. I just did a man glob and discovered it's right there in the libraries. Wow. I'd always used the findfirst and findnext functions before.

      I used C from 1981 regularly till about 1998, when I moved over to Perl, and during that time I'd never seen a glob function in the C run time libraries I used

      So, go ahead, scratch away.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://536792]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-04-18 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?