Short Bytes: Very few people understand the basics of hacking and hacker ethics. It’s basically exploring the open source code using various tools and improving the programming skills. Eric Steven Raymond, a renowned open source advocate, teaches a way to learn how to hack and improve programming using incremental-hacking cycle, which is a method of understanding a problem from the scratch, rather than trying to crack it at once.
Eric Steven Raymond, often referred to as ESR, is a software developer and well-known open source advocate. He says that hacking is exploratory programming in an open source environment. According to him, it’s a style of programming that is an effective way to acquire general-purpose programming skills. So, if you’re interested in stealing some passwords, this post isn’t for you.
In his famous article titled ‘How To Learn Hacking‘, he lists some characteristics that set hacking apart from the usual programming. Here are those 4 notable points:
- Hacking is done on open source.
- Hacking is lightweight and exploratory.
- Hacking places a high value on modularity and reuse.
- Hacking favors scrap-and-rebuild over patch-and-extend.
He also discusses a hands-on approach to learn programming and hacking. Called “incremental-hacking cycle”, this technique allows one to slowly crack the programming problem, rather than facing it at once. As one repeats the process again and again, the person develops a complete representation of the complete picture. With time, it allows one to understand the problem faster and solve it.
Here’s the incremental-hacking style in its complete glory:
- First, pick a program that does something you are interested in. Ideally, it should be a program you use regularly and have opinions about. The next best thing is a program you don’t normally use, but that does something you think is interesting. For this learning method to work, you should avoid trying to hack on code that bores you.The program you choose doesn’t have to do anything serious. Many programmers have honed their skills by improving games that they enjoyed. The only drawback to this is that modern games are often quite large and complicated, and may be beyond the grasp of a raw beginner. For this reason, you may want to investigate one of the classic text-oriented nethack is a prime example, and there are many others.
- If you don’t already know the program, learn how to use it. Read the documentation. Develop a mental model of how it works.
- Pick a small feature to change or add.
Search the code until you find the part you need to modify.Note: you should specifically not try to read the entire program. You will just exhaust and frustrate yourself if you do that. Instead, use the module structure of the code to zero in on just the part you need to understand. Along the way, you will learn things about how the whole program fits together.It’s a good exercise to add explanatory comments and notes to the code as you figure out things about it. This will help your memory, and will help you organize your thoughts as well.
Make, test, debug, and document your change.Documenting your change is important. If you develop the habit of doing this early, you’ll produce much higher-quality work.
- Send your change as a patch to the program maintainers. See the Software Release Practice HOWTO for tips on how to do this in an effective and polite way.I originally described this as an optional step; a wise friend pointed out that probably I shouldn’t have. Solitary noodling on your instrument is all very well for practice, but music is completed and validated when the creativity in it is heard by other people. Solitary noodling on your computer is similarly good for practice, but hacking is completed when other people use what you wrote. That real-world test is important.Sometimes (oftener when you are just starting) your patches will be rejected. You need to learn to cope with this. It doesn’t mean you’re doomed to fail in your quest; usually what it does mean is that you have not read the code carefully enough, or (just as usually) you have missed something important about the culture and practices of the development group you are trying to contribute to. These mistakes can be repaired.
- Now, ask yourself: do I understand this entire program?If yes, you’re done. If no, go back to step 3. This time, pick a different and perhaps slightly more difficult thing to change.
The incremental-hacking cycle lets one learn the capabilities of programming languages and understand how their formal instructions are executed. By following this exploratory style, one also learns how to understand the patterns and combine the concepts to arrive at a final conclusion.
Go ahead, give it a try.
Did you find this article helpful? Don’t forget to drop your feedback in the comments section below.