2014-06-20

Message to the students

Dear Student,

This is your life. Make it happy, productive and full for yourself! The smarter and more skilled you are, the more choices and flexibility you have (what to work on, who to work with, where to work and live, when to switch jobs). Follow your curiosity! If you are particularly interested in a topic, use as much as possible of your free time to study, to practice and to do it. 10000 hours is enough to become a world-class expert or champion. Start now! Find teachers, researchers (on the university), craftsmen, and other people doing or learning the same thing (your friends, or any related group on meetup.com), and cooperate with them. Find the best books about the topic online, and read them. You have to do the research to find the people and books which can help you. It's your life and for your happiness, so do it now, and continue doing it! Listen to recommendations and suggestions, use them to figure out what you like, and then in most of your free time focus your attention on topics which fascinate you.

If you are too busy reading through the rest, then try these web resources for learning programming:

If you are unsure if programming or computer science is for you, ask a programmer, or read on for figuring out! If you are interested, but if you are not sure if your friends would think it's cool, then ask yourself: whose life is it, and what would matter for you 10 years from now. If you are sure that programming is not your cup of tea, then take a look at Coursera, where you can learn more than 600 subjects online. (All the websites recommended here are free to use, all you need is a desktop or laptop computer with internet access.) It's like a class (it takes several weeks, you have to learn for a few hours each week). Teachers from a few of the best universities have uploaded the material in Coursera, and they will also check your homework. You can browse through the list of courses, or you can search for your favorite topics. (There are even some courses about programming.) Unfortunately, not all courses can be started immediately, for some of them you have to wait a few months (just add them to your watchlist). If there is too much choice for you and you don't know which one to pick, then start with A Brief History of Humankind (no homework, you just have to watch the videos, the German version of the book is available). You may even want to buy the book by the same author.

To start with programming, play Lightbot first (it takes a few hours). There is also an iPhone and and Android app. Much of programming consists of sitting in front of a computer and typing the program. Learn touch typing (i.e. typing quickly without looking at the keyboard). Z-Type is a nice game in which you can practice typing English. Decide on a keyboard layout, and learn where the special symbols are (e.g. # and {). If typing is still slow and frustrating for you, don't give up: after a few months of practice, your fingers learn where the keys are. In the meantime, you can use Scratch to write some spectacular programs (even simple games) using mostly the mouse, with very little typing. Scratch can do 2D (2 dimensional) graphics only. Blocky is an alternative of Scratch. Try it if Scratch doesn't work well on your computer or it looks too complicated. If you are interested in 3D, use AgentCubes. Unfortunately it's not as user friendly as Scratch, it's more clunky, but it's still enjoyable.

Programming is a creative activity, mostly at the computer. The immediate output is the program code you type, and the final output is the program which runs, and makes people's life easier or more fun. (It's OK if it's fun only for you in the beginning.) The other aspect of it is computer science, which is done mostly at the whiteboard and reading books, mostly thinking about how a computation can be done can be done as quickly as possible for large inputs. (A typical computation: you have to visit 30 cities in a week (and do some activity in each of them), you know the distances between each 2 cities, and you want to make your trip as short as possible. In real-life problems there can be thousands of cities.) This is very similar to the non-geometry parts of math, so if you enjoy solving math puzzles, than probably you would also enjoy learning and doing computer science. You can start with the Principles of Computing lecture on Coursera, and then try the computer science section of Khan Academy. The best classic books in the topic are The Art of Computer Programming (start with the first 3 volumes) and Introduction to Algorithms. If you open these books, you'll see lots of math formulas and lots of graphs (with nodes, edges and labels) in them. That's normal, these are the everyday tools of a computer scientist.

So, back to programming. If there is nobody around to teach you, or you'd like to move at your own pace, start on Khan Academy, by clicking on the Learn Programming link. You don't need a teacher sitting or standing next to you, just follow the instructions on the website. Like there are many languages to tell other people what you want, there are many programming languages to instruct the computer. Khan Academy teaches you JavaScript, one of the most popular languages today. Another similar one is Crunchzilla, which also teaches you JavaScript in a visual way, step-by-step. Eventually, over the years, you should learn many programming languages, such as Python, Java, C, C++, Ruby. (This is the list  of best programming languages to learn changes quickly, maybe in 5 years from now it would be different.). If you want to build web pages, you should learn HTML and CSS, which are languages to describe text formatting and visual layouts of web pages. In addition to JavaScript, you can learn Python, Ruby, HTML, CSS and some other languages at Codecademy. You don't have to register or log in: just scroll to the bottom, select the language you want to learn (e.g. HTML/CSS), and then just follow the instructions, it will teach you step-by-step. There are also programming courses in Coursera, for example one of them teaches you to build your own game in Python. Unfortunately you have to wait several months for that to start. In the meantime, you can also learn game programming in JavaScript at CodeAvengers. If you are interested in building a mobile app for Android phones (no iPhone), then do a few of the tutorials at App Inventor.

If you like nice, eye-candy design with music, then Code Combat will teach you JavaScript in a fantasy (medieval) atmosphere: you have to rescue kidnapped town members from prisons guided by trolls etc. A similar website is Ruby Warrior, you can practice the Ruby language there, but it's more enjoyable if you have some prior programming experience, so don't start there. Both Code Combat and Ruby Warrior are quite resource-hungry, so you need a very modern and fast computer to play smoothly, and you have to close most other programs.

HTML (for text and structure), CSS (for visual layout) and JavaScript (for interactive elements such as animation and reaction to mouse clicks) are the 3 most important languages today to build websites: the code written in those languages are executed (interpreted) by the web browsers, and that code will determine how the web page will look and sound like and how it will behave. (There are many other programming languages for the server side, i.e. to make the website remember your data when you visit it from a different computer or browser.) As mentioned above, learn these 3 languages from Codecademy. You can also practice your CSS skills in a playful way on Flukeout (but you have to learn it first somewhere else). If you want to build a website, save it and show it off to your friends, Thimble is a nice and easy-to-use tool for that. It supports HTML, CSS and JavaScript. You have to register and log in first in order to be able to save your creation.

When real programmers work and write code, they usually work in a text-editor or an IDE (integrated development environment), and not in a web browser. To make it easy to start for you, most of the learning material mentioned above needs only a web browser with internet access. After you have finished one or two programming classes above, you should give it a try with the real text editor. There are step-by-step instructions for that in Python in the Programming with Python (do this first) and Data Processing with Python courses. Just follow the instructions, it tells you what to install and how to use it.

Once you get good at programming (i.e. you've finished many programming courses, and when you start the next one, you find it too easy), and enjoy it a lot, you should try your skills (and possibly win some prizes) in one of the programming contests. For example, there is Google Code Jam, you can start practicing any time with any Round 1 (or Round 1A). It works best if 3 or more of you work together, trying to solve one of the problems together, and then you go on separately for the 2nd problem, and at the end if anyone has a correct solution, they show the others how they did it. You can also ask your teacher if there are other programmings contest closeby where you live, and if there are some preparation classes you can attend. As soon as you know the basics of programming, the most you can learn from is solving contest problems and understanding other people's analyses and solutions. Project Euler is similarly useful, but it contains more math-oriented and theoretical problems. After solving the first few easy problems, you'll need your best math, programming and computer science skills to solve the rest.

Recommended reading before and during university for computer science students: What every computer science major should know.

Good luck and have fun!

What's the difference between StaticPython and PyRun?

This blog post explains the difference between StaticPython and PyRun.

Both StaticPython and PyRun are free, portable binary distributions of Python 2.x and 3.x, for Linux, Mac OS X (and PyRun also works on FreeBSD without Linux emulation). That is, a user without root access can quickly download, extract and run either StaticPython or PyRun, and it won't conflict with the (possibly old) Python versions installed to the system (by root). Windows users should use Portable Python instead.

An important difference is that StaticPython doesn't need any external files to run on Linux, while PyRun needs lots of system libraries (libssl.so.1.0.0, libcrypto.so.1.0.0, libz.so.1, libsqlite3.so.0, libz2.so.1, libpthread.so.0, libdl.so.2, libutil.so.1, libm.so.6, libc.so.6), and will not work on systems which don't have all of the required libraries installed (with the required version), so PyRun is much less portable.

Another important difference is that with PyRun you can compile and install C extensions, and with StaticPython you can't (even ctypes doesn't work with StaticPython). However, many extensions are precompiled: Stackless + greenlet + libssl + Tokyo Cabinet + libevent2 + Concurrence + AES + Syncless + MessagePack + Gevent MySQL + PyCrypto.

Another important difference is that PyRun integrates nicely with packaging (setuptools, pip etc.), and is a nice, self-contained replacement for virtualenv. StaticPython doesn't help you with packaging, you have to do Python library installation and distribution manually.

There are many small differences, e.g. PyRun is available for both 32-bit and 64-bit, ans StaticPython is 32-bit only. PyRun needs at least 14 megabytes of disk space (10 megabytes for the binary executable and about 4 megabytes for the mandatory system library dependencies), and StaticPython needs between 6 and 9 megabytes depending on which feature set you need.

My recommendation: If PyRun works on your system (because you have the right version of system libraries installed, and you have enough free disk space), then use PyRun, otherwise use StaticPython.

Caveat: I am the author of StaticPython.