Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Paul Graham on Great Hackers

by Ovid (Cardinal)
on Jul 29, 2004 at 07:27 UTC ( #378310=note: print w/ replies, xml ) Need Help??


in reply to Paul Graham on Great Hackers

This essay was based upon the talk he gave at OSCON and I was sitting there listening to it (yesterday, as a matter of fact) and I really appreciated much of what he had to say. I do think that he overgeneralizes in some places, but the core of much of what he was saying was interesting, if you could distill it down. What I heard him say, ultimately, was that great hackers enjoy scratching their personal itches more than they enjoy searching for a back scratcher. As a result, they tend to be less inclined to look for tools that don't allow them to immediately dive into the problem.

To a certain extent, I think this is due to his love of the Lisp programming language and other dynamically typed languages that let programmers focus on the problem rather than the fiddly bits (bad stretch of a pun intended.) If I'm trying to track down that memory leak, I'm wasting time. If I really have to care about "hard drives, buffers and other things" then I'm not solving my actual problem. I'm solving problems that the language imposes.

Take Java for example. Consider one way of opening a file:

try { FileInputStream stream = new FileInputStream(myFile); + DataInputStream input = new DataInputStream(stream); + while (input.available() != 0) { System.out.println (input.readLine()); } + input.close(); } catch (Exception e) { System.err.println("Could not read from file"); }

Now really, what hacker is going to want to jump through those hoops to print the lines of a file?

open INPUT, "<", $input or die "Cannot open ($input) for reading: $!"; print <INPUT>; close INPUT or die "Could not close $input: $!";

If you're in a corporate culture, the first example might seem more appropriate because you can't forget to see if the open was successful and everything is this really cool OO stuff. The second example, though, lets you focus on the task at hand and clears away a lot of cruft. If I have an itch to scratch, I don't reach for a diesel-powered backscratcher. That, I think, is what Paul Graham was trying to say.

And no, Perl's not comparable to Prolog. The latter is a wonderful language, but it has such a limited problem domain that comparing it to Perl is comparing cheese and Wednesday. Different tools solve different problems and comparing them without a problem to contrast them against is an exercise in navel gazing :)

Side note: does anyone else see the weird newlines in the Java example? I've been seeing that a lot recently, but I don't know if it's a quirk of Firefox, my using FC2, or something else entirely.

Update: It's been pointed out that the "weird newlines" are from a bunch of whitespace at the end of some lines of code. Curiously, they don't show up in the editing textarea and they didn't come from me. Weird.

Cheers,
Ovid

New address of my CGI Course.


Comment on Re: Paul Graham on Great Hackers
Select or Download Code
Re^2: Paul Graham on Great Hackers ('newlines')
by tye (Cardinal) on Jul 29, 2004 at 14:36 UTC

    You have three lines in your first code block that contain several dozen trailing spaces each (and these spaces get wrapped by PM, which makes the "weird newlines").

    I'll go out on a limb and guess that you are using Opera. Although I like a lot of things about Opera, it certainly has the most stupid bugs. This probably replaces the previous Opera bug where they'd add an extra blank line per non-blank line each time you preview.

    Since this is affecting several people, it would be nice to track down the source and any work-arounds.

    - tye        

      Actually, I'm using Firefox 0.8. If there is any more information you like, just let me know.

      I've noticed that it seems to happen if I select the text from another window and just paste it in with my middle mouse button. If I type it in normally, there's no problem.

      Typed:

      sub foo { bar(); baz(); }

      Pasted:

      sub foo { bar(); + baz(); }

      Cheers,
      Ovid

      New address of my CGI Course.

        This probably has nothing to do with the problem you're having, but whenever I cut text out of a terminal window, there's always trailing spaces, so when I paste into something else, it sometimes messes up the format. So I often paste into Vim first, and remove all the trailing spaces before cut n pasting somewhere else (and I nearly always have a Vim window open).
Re^2: Paul Graham on Great Hackers
by itub (Priest) on Jul 29, 2004 at 16:18 UTC
    If you want an even more concise way of reading a file, you can also use IO::All:

    use IO::All; $s < io('file.txt'); print $s; # or # print io('file.txt')->slurp;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-09-02 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls