So many fun programming languages out there, and more emerging all the time. But who has time to learn them all? I certainly don’t, but I still want to learn. One issue I have is that I don’t learn that well by reading through a language reference or a tutorial. I learn best by doing, and when it comes to learning a new language, I learn best when I have a specific task I am trying to accomplish. To that end, I was thinking that it would nice to have a list of essential, yet simple, programming exercises, preferably ones that are suited for higher level languages. These would give me concrete goals to research whilst attempting to learn a new language. Further, I would build up a small repository of sample programs to which I could refer later. When I need to write something in Perl, my chief method of refreshing my skill is to look back on similar code I wrote as many as 10 years ago.
I did a cursory Google search for something along these lines, but came up empty-handed. It may be necessary to start assembling a list of my own. This would include items like:
- Reading a file, line by line, and processing each line through a regular expression; or perhaps a more complicated, less sed-style textual processing application
- Opening a socket to a web server and fetching a web page; perhaps screen-scrape something useful off of the fetched data
- Write a simple web server (and consider carefully the security implications of what you produce)
- If the language has a graphics API (e.g., through something like gd or SDL), create a canvas, draw some dots, lines, shapes, load a font and write some text, load an image and blt it; decode a video in real-time using FFmpeg
- If the language has an API for accessing your favorite database, use it to connect to the db server, SELECT, INSERT, UPDATE, DELETE, etc.; understand how the API can organize query data into the language’s native data structures (e.g., Perl’s DBI can fetch the results into a hash array which is extremely useful and intuitive)
These are just a few ideas off the top of my head. Another important aspect would be specific exercises targeted at understanding the language’s native data structures since those tend to be a key selling point of many very high level languages.
Sounds rather like Rosetta Code.
http://www.rosettacode.org/wiki/Main_Page
I had never seen Rosetta Code and it’s an interesting site, to be sure. However, I don’t think it has quite what I want, which would be slighter larger programming tasks, with or without the solutions already stated, that would motivate me to look up how to do things in order to solve the stated problems.
Interesting. Can you give me a couple examples of tasks?