As a programming hobbyist, I have gathered a list of 7 cool hobby projects that I found interesting, and I think they can make some mysterious concepts in Computer Science clearer.
“You might not think that programmers are artists, but programming is an extremely creative profession. It’s logic-based creativity.” — John Romero
I hope you enjoy my list!
A Ray Tracer
I would like to start my list with something related to Computer Graphics. This is by far the most beautiful piece of software a programmer can develop in his life. Ray Tracing is a technique used to produce naturally realistic computer images. Ray Tracing doesn’t completely implement the Rendering Equation but it is a very good start for learning other more advanced rendering algorithms. You can read more about it Wikipedia.
Although the algorithm is very simple and one can implement a basic Ray Tracer in a very few lines of codes, the result would be charming.
Start by learning how images are stored in computers and how you can produce them by generating a bunch of pixels, learn about the basics of linear algebra, matrices, and 3D math, and then start developing the simplest ray tracer possible which is capable of rendering colored spheres on a tiled surface. Then add shadows and reflection as you move forward.
If you liked the topic you can also take a look at other rendering algorithms such as Path Tracing that will completely implement the rendering equation and gives you results that are indistinguishable from reality, or Rasterisation which is the algorithm used in games for generating real-time 3D.
Scratchapixel is your best friend!
By developing a 3D renderer, you will learn:
- How all those 3D animations are built.
- How parallel programming can help us with problems like this.
- Linear algebra, 3D math, matrices and why you should take your math classes seriously!
- (Bonus!) BSP trees if you are tired of rendering spheres and you want something more.
An Operating System
Writing an OS from scratch gives you a very broad vision of how modern computers actually work. Ever thought what happens behind the scenes from the time you press your computer switch? Or how does a single core processor runs multiple tasks simultaneously?
This tutorial gives you a very great introduction on how to write your own OS using C programming language. Operating System Development Series of BrokenThorn is also superb. Use OSDev Wiki as a reference manual.
By developing an OS you will learn:
- How your computer boots up from the time you press the power key.
- How Operating Systems manage multiple processes.
- How programs are protected from modifying each other.
- How files are stored on the disk.
- What linkers and loaders are and how they work.
- Low level stuff!
So, you have written your shiny brand new Operating System in the previous step and you are now fluent in talking with iron. Next step is to emulate the iron itself! There are plenty of great hardware out there that you can emulate. You can start with simpler ones like CHIP-8 and move further by implementing a complete NES emulator, like the video below!
Check out bisqwit on YouTube! This guy has made a lot of videos on this topic. I highly recommend you to watch them. It will surely make you feel dumb!
By developing emulators you will learn:
- Computer Architecture
- Different design strategies in different hardware.
- Instruction set of the target machine.
Coding with your own language would be really satisfying. Ruslan Spivak has a great tutorial series on how to write an interpreter in Python. In this series you will implement an interpreter for Pascal programming language from scratch. You will start by implementing a lexical analyzer and parser for it, and will move further by implementing different features of Pascal language.
If you don’t know how compilers work, then you don’t know how computers work. If you’re not 100% sure whether you know how compilers work, then you don’t know how they work. (Steve Yegge)
If you want something simpler and more fun, Peter Norvig has an article on (How to Write a (Lisp) Interpreter (in Python)). Lisp is a functional programming language. As Lisp has a very simple syntax, it would be easy to write a lexical scanner and parser for it and therefore it is a very good start for learning how interpreters work. If you have not tried functional programming languages before, you will also get a taste of functional programming too.
If you are brave enough, you can also try implementing a Compiler too. Start with implementing a C compiler which is able to compile itself! Check out this project. His author has tried to implement a minimal C compiler which supports all C11 language features while keeping the code as small and simple as possible.
By writing an interpreter/compiler you will learn:
- Writing lexical analyzers & parsers by yourself and using tools developed for this purpose.
- Implementing interpreters.
- Code generation and compilers.
- (Bonus!) Functional programming if you followed the second tutorial 🙂
A Web Server
Ever thought what happens behind the scenes when your browser loads a webpage for you from the time you hit the enter key?
The process is like:
- Your operating system resolves the IP address of that domain by asking DNS servers, there is a great illustration of this process here!
- Your browser asks port 80 of that particular IP address to send its HTML content to us.
- Your browser renders the response on the screen.
So you are going to implement the second step of this process. For that, you should learn a little bit about Socket programming in the language you are coding with, listen to the port 80 of your network interface, return HTML contents according to the URL the client is requesting.
Your Web Server should be able to:
- Take a root directory in its config file and respond with HTML content according to the URL the client is requesting.
- Respond with files.
- (Bonus!) Provide an interface for programmers to develop dynamic web applications with.
Blockchains are fun. Before getting started, I highly recommend you to read the famous Bitcoin Whitepaper.
Don’t get me wrong. I am not telling you to create another fork of Litecoin or whatever scam shit. But you should really understand how all those cryptocurrencies work. They are genius, they have many brilliant ideas underneath. Learn blockchains by creating them from scratch, there is a great article on this here!
You can also have your coin listed on exchanges if your project has something new to provide!
By implementing a blockchain you will learn:
- Cryptography stuff like hash functions, public/private keys and etc.
- How P2P applications are implemented.
- How to create consensus in a network with some brilliant ideas like PoW / PoS.
A Neural Network
Deep learning is a trending topic today. Start by learning the backpropagation algorithm, used for simple feed-forward neural networks. Then try to build a network that is capable of learning the MNIST database. You will end up developing a software that is able to recognize handwritten digits!
By implementing a neural network you will learn:
- How multiple layers of simple neurons can learn complex representations.
- The building blocks of Neural Networks and Deep Learning.
- GPGPU programming if you want to do something more serious.
Clap this article if you liked it! This is my first Medium story.