6 ms·
Programming FAQ
- ntoshev 17y ago> you have to understand design to be a good hacker If PG means graphical design, I don't think this is true. Looking at the list of hackers in Coders At Work (as a random sample of respected programmers), it is not clear if any of them understands graphical design and they typically have ugly homepages. (Jamie Zawinski, Brad Fitzpatrick, Douglas Crockford, Brendan Eich, Joshua Bloch, Joe Armstrong, Simon Peyton Jones, Peter Norvig, Guy Steele, Dan Ingalls, L Peter Deutsch, Ken Thompson, Fran Allen, Bernie Cosell, Donald Knuth)
- jgrahamc 17y agoI doubt he means graphic design.
- ntoshev 17y agoDesign in an abstract sense that encompasses both visual and systems design probably includes designing programs (coding) as well. So it doesn't say much.
- tumult 17y agoThis is just my personal opinion -- after TeX and real typesetting, typography on the web is so hideously ugly that when confronted with the prospect of a mostly-text website, a disheartened shrug and some basic HTML just to get the characters on a page is all that can be mustered.
- JeanPierre 17y agoI always thought of it more like architecture and mathematical formulas. You don't have to be a good graphical designer to know what a good mathematical formula or a bad is. However, for mathematicians, a simple and elegant formula is much better than a complicated formula which requires much more work and gives the same answer. I think Graham answer what he consider as good design in the link below, you should check it out: http://paulgraham.com/taste.html http://paulgraham.com/taste.html
- Autre 17y agoIt keeps hitting me as a contradiction these two suggestions, namely: a) that you have to understand design to be a good hacker; and b) that planning is overrated. How can you get to a good design without some plan? Could someone shed some light?
- hristov 17y agoI wonder what pg thinks about Haskell vis-a-vis Lisp and his own Arc.
- mnemonicsloth 17y agoHaskell, for example, seems to me a language that's designed more to write papers about than to hack in. I get the impression that using it would feel like reading a novel written by a literary critic. http://lambda-the-ultimate.org/node/186#comment-1351 http://lambda-the-ultimate.org/node/186#comment-1351 Borges was a literary critic. He didn't do novels, but his short works are mind-stretching.
- andrewcooke 17y agoborges was borges. a programming language suitable for a lone genius isn't that useful.
- tumult 17y agoit's useful for the genius!
- nandemo 17y agoSo was Nabokov. The intended meaning is of course "a novel written by a literary critic that is not primarily a writer" but that's a mouthful, isn't it?
- Zak 17y agoAfter using Haskell for a while, that seems to be partially true. It also seems to me that Haskell is especially well-suited to certain kinds of problems. For example, writing parsers with Parsec is very easy. That may be primarily due to the built-in syntax for monads, which would make that advantage fairly easy to duplicate in Lisp.
- danparsonson 17y ago>But if I were trying to solve the problem one reader sent to me as a canonical example of an OO problem, I wouldn't. Suppose you have n serial ports, each of which may speak one of k protocols, and this must be configurable at run-time. I'd just use an n-by-k array of closures to represent this. Can anyone enlighten me about this? My first thought is that n+k units of code is less than n*k, but I expect it's more subtle than that :-) What about code reuse? In OO land, it's fairly obvious to me that I could take any number of my protocols and use them across a TCP/IP connection, or carrier pigeon, or a file, but I can't see how the closure example would allow this sort of sharing. Is that the point? Only code what's necessary?
- gizmo 17y agoI suspect the n-by-k array part is a typo, an one-dimensional array of closures is all you need. I also don't think the closure approach is bad for code reuse. The closures serve just to bind the environment to the TCP-handler and UDP-handler functions. The closures themselves are probably trivial and not worth sharing, and the protocol handler functions (or closures) can be shared like any other library function.
- pvg 17y agoWhere are you (and the OP) getting TCP and UDP from?
- danparsonson 17y agoMy point was that the protocols could in theory be used across connections other than serial ports.
- deleted 17y ago[deleted]
- barrkel 17y agoNot specific to your issue, but rather to the use of closures where OO folks would use objects. The thing is, a lot of the time you need sideband data. A simple closure isn't always enough. Perhaps you need configuration options, or you need names for diagnostics, or you need to monitor throughput statistics, etc. A closure is a clumsy interface when it's overloaded to do multiple things. You end up with some kind of variadic argument list and having to switch on the first or more arguments - you basically end up writing a method dispatch routine. So in this specific example, I would suggest that using a closure may turn out to be the wrong choice longer-term. I'd probably prefer a base class with a virtual method, and a concrete descendant which delegated the action to a closure. That way you get the succinctness of a closure when that's sufficient, but you also get the future proofness that a base class provides - you can add more functionality in the future, but without breaking previously defined implementations.
- maigret 17y agoI stopped at the first answer. Half ironic :)
- revorad 17y agoI find the RAQ more interesting - http://www.paulgraham.com/raq.html http://www.paulgraham.com/raq.html
- blasdel 17y agoHas pg ever exhibited a painting? http://www.idlewords.com/2005/04/dabblers_and_blowhards.htm http://www.idlewords.com/2005/04/dabblers_and_blowhards.htm
- revorad 17y agoOh no not that thread again! I don't know if pg has exhibited, it would be interesting to know. Even more interesting would be to know if he still paints.
- pvg 17y agoThere was one image of a painting of his on his site. Then he took it down or moved it.
- pvg 17y agoWait no, I lie, it's still out there in the tubes http://1.bp.blogspot.com/_KKByGBh0xRM/S0FD11qiIXI/AAAAAAAAA1s/y9BnykUj_Dg/s320/paulgraham_2056_13101059.jpg http://1.bp.blogspot.com/_KKByGBh0xRM/S0FD11qiIXI/AAAAAAAAA1...
- binarymax 17y agoIf someone never programmed before, and had little concept of programming fundamentals, then I would highly recommend starting with my favourite simple language: Logo. The thing about logo is that it was specifically designed as an educational language. It teaches the basics of syntax, commands, variables, and functions, and it offers instant gratification. It is very easy to see how a computer can follow very simple programs, and if you do something wrong you see it immediately. Once they've mastered the fundamentals of logo (which should only take a couple hours) then I would have them move on to a full blown language.
- omaranto 17y agoI haven't programmed in Logo in years, but I recall it as pretty full-blown: isn't it a dialect of Lisp (with a funny infix syntax but) including macros?
- binarymax 17y agoYes it is, but as far as I know its not widely used outside of the turtle programs. In my opinion, instead of delving deeper into it, the student would probably benefit a bit more in the longrun by spending the bulk of their time on something more mainstream...this would open them to a much more available set of documentation, support, communities, etc. Though maybe I am wrong and there is a thriving massive Logo development community!
- araneae 17y agohttp://ccl.northwestern.edu/netlogo/ http://ccl.northwestern.edu/netlogo/ can be a fun thing to play around with. (You can write agent-based simulations in logo)
- HeyLaughingBoy 17y agoI've often thought it would be cool to port LOGO to an AVR or other microcontroller so you could build an "actual" mechanical turtle that would move around the floor in response to the commands. NoteToSelf("Add LOGO to project list"); Someone, somewhere has to have done this already. I should look it up!!
- arethuza 17y agoUsing vi to edit lisp is an interesting choice - I've got the vi commands hardwired in my brain now after using them for 20+ years and I've written a lot of Lisp but I don't think I've ever written any Lisp in vi.
- prog 17y agoI used vim for lisp for some time. That worked fine actually. Of course I didn't do things like emacs-slime, so, I always have a repl open in a separate window. ':set lisp' along with 'set lispwords=...' worked fine.
- ash 17y agoRecently (partial) alternative of slime for vim as brought up here: http://news.ycombinator.com/item?id=1193638 http://news.ycombinator.com/item?id=1193638
- oconnore 17y agoI wrote a small improvement on the default lisp indentation: http://www.vim.org/scripts/script.php?script_id=2951 http://www.vim.org/scripts/script.php?script_id=2951 Vim users are yet to have a full Slime replacement, but Nekthuth is quite nice.
- araneae 17y agoWhat do you edit lisp in?
- Kilimanjaro 17y agoIf you have never programmed before, I'd recommend you to start with html, then css, then javascript, then javascript on the server, then sql, then stop. Go back to the beginning and master every one of them. Then in your spare time learn lisp. The formers will give you money; the latter, enlightenment.
- jasongullickson 17y agoForgive me if I'm reading this wrong but it seems to assume someone is trying to learn how to program for the web. ...if you were interested in programming embedded microcontrollers for robots, html and css isn't going to get you too far and I think learning Javascript as your first "programming" language would do more harm than good...
- Kilimanjaro 17y agoWait, is there any other programming besides web programming? For 20 years I've been coding for mainframes, minis and desktops. No more, for the last ten years it all has been the web and solely the web. And I hope it stays like that. Regarding embedded programming, yeah you're right, but that's a totally different ballgame and I know most of the readers are interested in web stuff. About old-fart c++ desktop programmers, poor guys, whether they adapt or join the cobol programmers of last century. Or at least try Go, the language, to keep the fun alive.
- jasongullickson 17y ago"Wait, is there any other programming besides web programming?" In the last year I've been asked about iPhone programming more than web, seriously.
- edw519 17y agoSorry, but I couldn't resist, I'm pretending that someone asked me those questions... Programming FAQ by edw519 What editor do you use? Textpad. How can I learn to program? Find a customer with unreasonable deadlines. Hit them. Repeat. It won't be pretty, but you'll be the kind of programmer I'd go into battle with: great at the things that really matter and mediocre at the things that don't. Why do you advise plunging right into a programming project instead of carefully planning it first? It's incredibly difficult for anyone to define what they want when they start with nothing. It's human nature (incredibly easy) to criticize what you have and how to make it better. Plunging right in and producing anything raises you from LevelIncrediblyDifficlut to LevelHumanNature. Why do you keep going on about PICK? I have a very small back pocket that holds everything you need to program in PICK. Whatever you can do in technology <x>, I can probably do in PICK, often quicker and easier. Isn't object-oriented programming naturally suited to some problems? Sure, but that doesn't necessarily mean you have to use formal object-oriented technology. You can mimic the concepts with almost any technology.
- timwiseman 17y agoOK, I'll ask. What is PICK? I have never heard of it and the only Wikipedia reference is for a railline.
- JoachimSchipper 17y agohttp://en.wikipedia.org/wiki/Pick_operating_system http://en.wikipedia.org/wiki/Pick_operating_system. I have no experience or opinion on this system; however, I'm fairly certain I first heard of it on TheDailyWTF. I'd be interested in people's experiences with it, though.
- jswinghammer 17y agoMy dad used it a lot when I was growing up. He raved about it always and to this day thinks it's the best system he ever used.
- madebylaw 17y ago
- sesqu 17y agoAs you learn the mechanics of writing and running a program, start thinking about specific programs you want to write. This is what I never managed. I picked up programming very fast at school, but could never come up with anything I'd want to use it for. Now that I finally have a few concepts I want to see done (good UIs to promising algorithms), I no longer have the time to pursue them. That's part of why I believe kids now should start with html+js+css and be introduced to greasemonkey, stylish, and browser extensions. Maybe Node.js, too. Everyone uses some site a lot, and they will find problems in those sites to attack with their new knowledge.