2014-07-08

Programming tips for students

This blog post gives you advice to make the best use of your time for learning how to program and enjoying programming in your pre-college years.

General, technology-independent recommendations

The best situation is if you have an experienced programming mentor, or some friends or schoolmates who are a bit ahead of you, and you have the chance to observe what these people do, and can ask questions. If that's the case, you are probably better off observing and asking these people than to follow the advice below.

If you are an absolute beginner, read Message to the students first. It contains many links where you can start learning how to program.

If you or your school can afford buying books, see the list of recommended books. The home or school library may have outdated and moderately useful course material, it's worth getting and reading the best books instead settling with what's already available.

Learn English to the extent that you can read and understand everything related to programming, and you can ask technical questions clearly in written form. If you have several languages to start learning, always pick English as the first language. It's much more useful to improve your English skills to fluent (so you can give a presentation to an audience of 1000 people in English just as easily as in your mother tongue) than to improve your skills in any other language from basic to medium.

Learn typing quickly, and without looking at the keyboard. Z-Type is a nice way to practice.

Get a large screen (at least full HD resolution is strongly recommended) and a comfortable keyboard and mouse. Try many different keyboards and mice -- most of them are cheap. (Cheap, wired ones can be much better than expensive ones.) Pick one keyboard layout (US English or your local one) and stick to it.

Learn how to ask questions so you get the answer you need quickly. Start learning from How To Ask Questions the Smart Way.

There are many great websites which teach you programming for free, even if you have no prior experience. See a list of them in Message to the students.

To become a skilled and experienced programmer, practice, i.e. write lots of code. Start that early. A minute spent on writing code is better spent than an hour of reading a book or a web page about programming.

If you get stuck, ask a question on StackOverflow. It's free. You will get several answers in 5 minutes from experienced programmers, you can pick the best answer, or ask for clarification. To modify specific behavior of specific web pages, write JavaScript which modifies the DOM, and use Greasemonkey with Firefox to run it each time to visit the page. Google Chrome can also run Greasemonkey scripts.

If you need something, write a small program for (parts of) it. That's easy to start on Linux and shell scripts and Python.

Start using a version control system (e.g. Git, Subversion) as soon as you have written a program of at least 100 lines of code. (But definitely start after 1000 lines.) The rule of thumb is: if you (or others) worked more than 15 minutes on it in total, then add the code to version control system. Start early with using a version control system, don't procrastinate. Put every program file you write to a repository managed by a version control system. Commit often, about once per hour, but definitely at least once per day. Make backups regularly (at least once per week) of everything you write. The simplest way to do it is to copy everything to an external hard drive, and disconnect the hard drive after the copy has finished. Using online backup services and version control systems (e.g. Git, Subversion) also serves as an additional backup for some of the code you write — but also make a traditional backup.

Find good programmers around you (parents, relatives, schoolmates, friends, teachers). Ask lots of technical questions (any question you think they may be able to answer) in person. With their permission, observe them while they are working with the computer. Afterwards, ask why they did something the way they did it. Ask their opinion about technologies they are working with. Ask their favorite programming language etc., and ask why. Figure out their favorite technical topic, and ask them about it (it may take several hours to listen to the answer, but these are one of the best spent hours). If you trust them and you respect their skills, ask their advice. Ask enough questions before you decide if they are smart or not.

Participate in programming contests. You can practice for Google Code Jam online. For less competitive, and easier to solve problems, see Project Euler. topcoder also has great problems and a great community.

Arrange your windows on screen so that they don't overlap at all. Cycling through overlapping windows contribute a lot to lost productivity. Use virtual desktops. On Linux, use a tiling window manager if necessary. Edit your program in one window, and see the results in another window (e.g. web browser, command-line, PDF viewer). Make both windows visible at the same time (without overlap). Once set up, don't cycle through them, don't resize them and don't move them: just see them both at the same time, and work in either one. If necessary, create more than 2 windows (maybe 2 * 2 or 3 * 2), without overlap.

Recommended sites, products and technologies

Install Linux as (try to) use it as your main operating system. Linux is very much customizable and scriptable (all the command-line tools described in the book The Unix Programming Environment are available). Be careful, installing another operating system (such as Linux) may lead to data loss and may render your computer temporarily unusable (but an expert can fix that). So make a full backup first, or install Linux to an otherwise unused computer. If Linux is not an option, try to use a Mac instead, and install free software from MacPorts. The Mac OS X is a variant of Unix, with the tools described in the book The Unix Programming Environment available.

To get quick and high quality answers to your technical questions: StackOverflow and other StackExchange sites.

To host the source code of your open-source projects (including a version control system, a wiki, an issue tracker and a code review tool): github and Google Code project hosting. There are many other providers, so compare the features and the code ownership, publicity and copyright issues before choosing.

Free C++ IDE: Code::Blocks.

Free code editor for HTML and scripting languages (Python, PHP, Ruby, JavaScript, Perl, TCL, XML, HTML, CSS): Komodo Edit.

Use GNU Make or some other incremental build tool to make sure that the relevant parts of your program gets recompiled.

No comments: