Ask YC: Learning to hack...
One of the common pieces of advice given by the hackers on this site to the non-hackers is to "learn how to hack." In the past few weeks, I have come to the realization that I, too, would like to "learn how to hack." Here's the problem: Not having an extensive technical background, this piece of advice seems to be quite vague. With which languages should one start in order to learn to hack?
I sent a similar version of this question to PG about a month back and he referred me to the creators of Appjet, a YC startup he said was working on this very problem. After looking at the site and receiving an email from one of the founders, the answer I gleaned was to start with learning Javascript. I would like to know from this community whether I'm on the right track to "learning to hack."
53 comments
[ 3.1 ms ] story [ 57.1 ms ] threadand also, if you are a DB guy like me, then even with ordinary SQL, u can hack a lot of stuff...
Which is to say a hacker also needs a taste for recursion.
On the client, you have 2 primary choices: HTML,CSS, & Javascript or Flash/Actionscript. I would definitely opt for HTML,CSS, & Javascript because it's open source and it's everywhere.
On the server, you have many more choices for languages and databases. One of those languages is Javascript, although not too many people use it on the server.
I think you're on exactly the right track. Learn how to build web pages first with HTML, CSS, and Javascript. Then when you're ready to "connect" to the server, ask the next question, "What is the best language/data base to use on the server." But stand back because sparks may fly from your terminal screen as we hackers fight with each other trying to answer that one :)
Good luck.
Not quite - there are other applications of programming than web and web services...
i think that is very important when you start, to get instant feedback, making stuff is fun :)
for this reason i would recommend python as your first language. it is very highlanguage and have extensive libraries. it has clear sparse syntax and is very easy to write and read.
but that doesnt mean it is a weak language, ont he contrary it is a very powerful language that is used by a lot of big companies and small startups.
so not only is it a good language to start with but it is also something you will have great use for in general as a skilled hacker.
while paul graham and a lot of others rave about LISP(right fully, its a powerful, flexible language with some very special features) i wouldnt start with it. it lacks a standard and you start working on a higher level of abstraction right away, there is not a lot of libraries that you can just install and start having fun with right away as you can with python. i definitely think you should learn it later on but not at the start.
with python you can add the pygame library and start making simple games right away, it is very easy. you can write webapps with webpy/django without much knowledge needed.
then as you evolve you should pick up something like the art of programming(or a similar book that has code in a language you know) and learn about all basic algorhitms and datastructures. if you want to be a serious hacker you need to know the theory.
python however lets you create cool things right away without knowing that much.
while this is a rant for python it is not fanboyish, i just think python is very suited for programmers of all skillevels. there was an article on here some days ago about pythons suitability as a beginners language.
there are other options obviously, ruby for example his fairly similar to python in a lot of aspects but when python tries to keep things simple(there should preferrably be one obvious way to do things) rubys philosophy is there is more than one way to do it.
you could ofc learn java(java and javascript only have the name in common) which is wide-used language that you will run into sooner or later anyway. on this board youll probably find that it often gets critisized for being a language for average programmers though. it is fairly verbose and in some peoples opinion too objectoriented and dont offer any options.
the downside with python and ruby are that they can be pretty slow but that isnt an issue for most applicatiosn and certainly not for the apps youll write a s a beginner.
ruby also has a very popular webframework called rails(ruby on rails).
c/C++ are probably the fastest(executionwise, not developmentspeed) and are also good to learn but are a little more difficult to start with and c is fairly low-level. good to know but wouldnt recommend it to start with. devc++ is a good development environment if you do though.
http://www.diveintopython.org/
"Beginning Python - From Novice To Professional" is good starting point for a newbie. Very clear and smooth.
HTDP.org is also really good if you go the Scheme route instead.
O'Reilly's Learning Python is also an excellent learning tool for the language.
I mean sure, CL's standard is older than some dinosaurs, and Scheme's standard is currently rather controversial, but both have standards. Especially in the case of CL, there's little to complain about.
One of you is talking about a standard in the true sense (such as an ANSI Standard, which Lisp has in spades) and one of you is talking about a canonical/standardIZED IMPLEMENTATION (which Lisp doesn't technically have.) So, everyone can follow the actual ANSI Standard for CL. And if you're looking for a standardized open-source implementation, you should just choose SBCL ;-) Either way, you should be Lisping instead of arguing.
I'd suggest the following: find a web page that interests you, view the source, and try to understand what the source code is doing. Start with getting a vague overview, and keep drilling down into each layer of abstraction, asking questions repeatedly, until you truly grok every line.
When you can do that, you'll be well on your way.
To the author, I would suggest finding a website that you feel accomplishes something you would like to create (I would start small, like a personal blog just because the amount of code might be overwhelming with larger sites). Borrow their code using the add-on, and change certain features to see effect the change makes to the product. I would continue the process for a while until you get a feel of how all of the code works together. Only after this point I would suggest going into books. Maybe you will learn differently that I do, but reading a book without actually being able to have hands on experience with what I am attempting to grasp has a hard time sinking in.
No, it's a standard part of Firefox. "View Selection Source" is too, which can be useful.
I agree that Web Developer (or similar plugins) can be a great way to learn.
FireBug even has a javascript REPL built in!
http://news.ycombinator.com/item?id=127952
http://news.ycombinator.com/item?id=123903
http://news.ycombinator.com/item?id=90782
Also, I find it very effective to learn by looking at examples on line first and create similar problems to solve. That way, my head remain active to think through the problem solving process. It also helps memorizing the syntax because you see the purpose of the code instead of just passively taking it all in.
I would suggest starting with Java. Java is a modern language, you can get a free compiler and IDE, there are tons of excellent books, and you will learn all the concepts of object oriented programming without having to deal with the 'interesting' parts of the machine.
Set yourself a goal, for example to create a GUI app that organises your MP3s or so. Then work on that as your way of learning Java.
After you know Java, the other imperative languages are mostly about syntax. There are no real new concepts to learn.
Now, I do not use Java personally. I use C++, and I started with VB. It's useful to learn C++ early, but only attempt this if you are a dedicated and patient person.
Install ubuntu 8.04 & explore the add/remove apps. Install netbeans & write a hello world app. Install quanta & edit some saved web pages. Get mediawiki working & use it for notes. Install a simple mediawiki extension. Edit it, or write your own.
For me, I was a kid and I started hacking basic on an Atari 400 with a whopping 2k of ram. I was trying to make a dungeon crawl game. I learned about variables, conditionals and looping. Then I learned about I/O.
Your environment is, of course, vastly different than mine was, but the process is the same.
Reasons why H-ety-H is a good choice: 1. Ruby - Ruby is a beautiful, easy to learn, modern language that's both powerful and easy for beginners. 2. Hand-Holding - It walks you through all of the interactive examples 3. Community - Hackey Hack encourages users to share their programs with others
Besides, if eigth graders can do it, so can you!
http://www.catb.org/~esr/faqs/hacker-howto.html
http://www.catb.org/~esr/faqs/hacker-howto.html#skills1
BTW, it's notable that Eric used to recommend Java as a second programming language, and that he no longer does.
The only thing I'd add to his recommendations is a pitch for Ruby. I think it's a really good first language.
If you want to learn how to code, the first question is what do you want to code? Do you want to make websites? Create PC games? Create mathematical algorithms? Use math to create images... the possibilities are endless. Learning Javascript would be useful if you want to create websites, obviously, but outside of that it's not a general enough language with enough (any, really) general applications to be a good place to start. It's essentially an odd combination of Object Orientation and Functional programming which is cool in that it introduces you partially to two separate kinds of languages simultaneously. It can also be confusing for the same reason.
If you want...
A multi-purpose language that will let you rapidly prototype programs and is both extremely readable, easy to understand, and has modules for just about everything: Python
A language that forces you to learn about more fundamentals of programming and doesn't keep you from royally screwing up: C
A language with extremely high-level features, infinite flexibility and power: Lisp
A language that lets you create extremely stable applications built for concurrency: Erlang
A strictly web-only language with a huge supported base in the online hosting business and about 1,000 frameworks: PHP
The latest craze in web development: Ruby with obligatory framework Rails
---------
I could go on and on and on... hopefully one of these descriptions scratches your itch. Keep in mind these are merely suggestions and there are many other languages that would fill any of the descriptions I gave.
EDIT: I am a firm believer that regardless of your end goals to really learn programming one must start at the beginning. Learn about computer architecture, how CPUs and memory work; learn the pain of programming Assembly and managing memory bit by bit even though you'll never do it again. Then move onto C; learn how even the most fundamental of abstractions made programming possible for lesser mortals. Keep moving forward and come to comprehend that features such as garbage collection, while taken for granted, are in reality really freaking awesome and will help you keep your hair longer.
Move up the ladder, rung by rung, until you have the confidence and knowledge to use a language that is highly abstracted and has all the "batteries included," like Python. At this point the language/interpreter/compiler will do most of the work for you but you'll have the experience necessary to understand, more or less, what's going on behind the scenes. From there, if you want to specialize, choose a language created for the domain that interests you; PHP, Erlang, Matlab, etc.
A brief 5/10/20 years later, you're a hacker. Nobody will give you a diploma, though.
Absolutely - I've never met a hacker who didn't know the fundamentals.
I think it's nice to get to learn programming and just get going with something like python, where you can take advantage of all the libraries like other people have mentioned, and maybe have more fun right away and avoid being turned off by it all -- before learning all the lower-level stuff -- not that you shouldn't learn it though!!
Good call.
There will obviously be a lot of debate (and possibly some downmodding) over this, but I would say that the language doesn't matter. I think the important part will be finding resources that you think will be helpful for you (a book, a tutorial you find on google, a friend who knows programming). In your case you want to spend as much time coding and as little time on set up and administration as possible.
Figure out how to do something easy, then see if you can start tweaking it and adding small things. You'll be a regular hacker in no time
If your purpose is to learn how to "hack" to the point where you can make real webapps, you should be aware of two things.
1. You will never become a good hacker if you are only doing it for the money or for the recognition. You have to be able to love the code for the sake of the code itself. You have to be able to see the beauty in the code. Otherwise you will never really understand it. It is the difference between being able to copy a poem out of a book and being able to write a new poem. 2. Assuming you are a true genius, the process will still take you many years. Working hard will not be enough. You will have to learn how to work smart to learn all the stuff you will need to know.
If your purpose is to understand hacking to the point where you can better understand technical people so that you can work with them better .. that is a much more realistic and reachable goal. For that I would recommend you start with Ruby or Python and try to make a full-scale production webapp, and from that experience you will learn a lot that will explain how a technical person thinks.
It's important to start with a real task, and not only do the simple training programs you'll find in every manual/tutorial. I can't stress enough the difference between grasping a concept and actually being able to apply it in the field.
Second, after you learn your first language, don't ever think of sticking only to it. Learn your second, learn your third and your Nth language and never stop learning them. Sure, most of them are similar (python is like ruby, perl, lisp, c is like c++,c#,java) but there are some oddballs like prolog and haskell which will make you a better programmer just by knowing that they exist and what they're about). Thus you'll have a tool for every job.
Also, after a while, learn assembler (x86) and some hardware theory (how a computer works, what's in a CPU or a GPU etc.).
Finnaly, have fun! Don't feel pressured to know anything you don't need or don't think will make you a better programmer. Don't learn Java and it's assorted libraries because every job wants you to know it. Don't learn LISP because the cool kids are doing it, and don't write programs you won't use.
Assuming you want to do web programming, I would suggest you start with Python as your first language. It has quality introductory material[1] and is widely used for web programming, as well as many other tasks. There is less complicated syntax that you have to ignore while learning how to program compared to Java and C++, and is generally regarded as a Better Language. Even if you weren't planning on doing web programming, Python would still be my suggestion for a first language. I'd only suggest anything different if your main concern was getting a generic programming job, in which case Java would be a better idea.
I feel like JavaScript would be a particularly poor choice as a first language since most introductory JavaScript material isn't trying to teach how to program; it typically teaches how to manipulate web pages. As a new programmer yourself, it will be harder to judge what texts you should pick from those that are available.
If you start out trying to learn how to program web applications instead of learning how to program in general, you'll be selling yourself short. Your code will be worse and it will be more difficult to figure out how to solve atypical problems that a web framework hasn't solved for you. Don't do it.
[1] Or so I hear. I haven't read introductory material in years, and then it was C++. Try How to Think Like a (Python) Programmer: http://www.greenteapress.com/thinkpython/
Most of all, write programs that are fun. For my third year software engineering class we wrote a 3D implementation of bomberman. It was a blast to write and I still hack on it now and then to add crazy over the top powerups.
Also, it looks like you've found a good place to get your news from. Being aware of cool new projects / languages / ideas is always a good thing.