http://qs1969.pair.com?node_id=173506

After deobfuscating a piece of code intended for the real world, this popped into my head:

write CLEARLY or die "screaming\n";

Update: Before everyone goes and clobbers me, I should mention that the code I deobfuscated was my own. :-)

--
The hell with paco, vote for Erudil!
/msg me if you downvote this node, please.
:wq

Replies are listed 'Best First'.
Re: Obfuscation has no place in production code
by alien_life_form (Pilgrim) on Jun 12, 2002 at 12:53 UTC
    Greetings,

    warmly seconded.

    I have often been more radical in my head on this one, but I will now step out of the closet, and let the flames burn who they may.

    I think that the race to obfuscation, as fun as it may appear, is ultimately harmful for a programming language (be it perl, C or anything), and for several reasons.

    • It is bad PR to begin with: "ah, XX, the language that has obfuscation contests, blah, blah"

      .

    • It promotes the extremely damaging idea that cryptic coding is cool programming

      .

    • In general, it suffers from all the handicaps of any virtuoso performance: a virtuoso violinist is able to play Bach's Chaconne on one leg using a shoestring as a bow, however, the Chaconne is played badly and at the end you still know nothing about his violinist skills.
    This discounts the fact that one person's cryptic code may be another persons idea of clarity...
    Cheers,
    alf
    You can't have everything: where would you put it?

      I'll disagree so far as to say that a language that doesn't allow you to obfuscate code is very likely to be overly restrictive and only suited for a certain niche job. To me, the fact that a language is unsuitable for obfuscation is a point against it. That's not because I obfuscate production code, it's because the same shortcuts that let you express something in a hard to understand way, also let you express other things in an easier to understand way.

      Cryptic coding is cool in the same way that cryptic tricky mathematical formulas that turn into something really simple once you solve them. Do I look down upon mathematicians who can do that? Hardly. Now would a mathematician intentionally use cryptic formulas when documenting his research? Also hardly.

      The difference is whether one knows to clearly separate fun from work. That is a mindset budding programmers should be taught as soon as possible.

      Makeshifts last the longest.

      I like the point about the virtuoso violinist. That'll stick in my head whenever I look at obfuscated code :-)

      On the other hand, it is hard to argue that obfuscation has damaged the popularity of C or Perl. Both languages are very widely used, and I doubt that the ability to write cryptic code has had any impact on that.

      Mind you, I don't obfu, because of a personal war against "clever" code in my projects. But as long as an obfu-loving geek will write clean, legible code at work, I say let him play. If I ever decipher the obfuscation, I'll probably learn something about the language.


      "All you need is ignorance and confidence; then success is sure."-- Mark Twain
•Re: Obfuscation has no place in production code
by merlyn (Sage) on Jun 12, 2002 at 15:07 UTC
    There are times when I regret having created the form of the JAPH. This would be one of those times.

    I fear that the whole obfu-perl was a direct descendant of my original JAPH tweaks: at least it would be hard to prove the contrary.

    And as you point out, it detracts from the fact that there are far more clearly written readable Perl programs in the world than there are obfu-perl "programs". But what gets noticed is the ugly stuff. {sigh}

    -- Randal L. Schwartz, Perl hacker

      I hardly think you are responsible for obfuscated Perl. Purposefully obfuscating code has been around for a lot longer than Perl.
        Merlyn wasn't taking credit for all code obfuscation. As for the JAPH, his place in history seems to have been well documented.
        ()-()
         \"/
          `                                                     
        
Re: Obfuscation has no place in production code
by earthboundmisfit (Chaplain) on Jun 12, 2002 at 13:38 UTC
    I have never, ever understood the need to obfuscate code in production. Do people really think it's a security measure? I've heard that touted, but never bought into it.

    This may be off topic, but my chaotic brain sees it as relevant, so here goes: There has been some discussion of late as to first, second, and third rate programmers. My take on this is that we should be striving to become first rate communicators and that first rate programming is simply a means to that end. It's not just that we need to be smart about the code we produce. We ultimately need to be smart about how we use that code to get a message across, be it to the end user or the people who must live with our coding decisions, present and future. As FoxtrotUniform points out, the person you help just might be YOU. Obfuscation is a step in the wrong direction, IMHO. Fine as a game or an exercise, but definitely, definitely not for production environs. Consider this a humble third and ++'s to the author. <flame suit on>

    ---- I am what I read

        I have never, ever understood the need to obfuscate code in production.

      The code in question wasn't deliberately obfuscated; it was more a matter of code written at 0300h, two hours after my last cup of coffee. While I'd be even harsher on deliberately obfuscated "real world" code, I've never seen it. (I'm just a lucky guy, I guess.)

      Remember, kids: always come back to your code with a critical eye. The butt you save may be your own.

      Personally, I see nothing wrong with obfuscation, golf, and so on. I appreciate the skill needed to pull it off, and the challenge a good obfu provides to those trying to unravel it (for recreational purposes, of course). I've nothing against a debate on obfu's merits and demerits; I just don't want to inadvertently become the bannerman for the "anti" side.

      --
      The hell with paco, vote for Erudil!
      /msg me if you downvote this node, please.
      :wq