One thing I always find interesting as a programmer is to take a peek at other people’s source code. Sometimes this happens out of curiosity, to see how they solved a particular problem, or if their implementation kicks more ass than the one I thought of. Or simply to learn something new and excitingly different.
When I’m looking for a piece of open source software that I’m planning to use, and possibly will be making some changes to myself I always take a look at the source code to see how well it’s written. This is one of the major factors in making my choice actually, because I’ve learned that if you don’t feel comfy snooping through the code, or see stuff that you find not-so-well-programmed, you will end up spending way too much time digging through the sources to find that particular feature you want to change or add.
By doing this I ran into some source code that was IMO particularly well written. Clean, slick, and using the language to the max, allowing you to dig into it and run into things that make you go “WTF!? Never thought of doing it like that myself!”
These are the ones that are worth using, and frankly, just “reading” bits of code from. Once you’ve picked up an idea from those beautiful lines of technological poetry, your mind has been stretched, and will never be the same again. Your own code will reflect this, making you a better programmer.
But enough already, lets get down to it, so here’s some source code I find worth reading:
- TinyMCE JavaScript content editor : also used in the mighty WordPress editor, but I ran into it while looking for a good HTML rich text editor for a project at work. The major coolness here is how they magically turn a simple text area control into a full fleshed dynamic HTML text editor. Sweet.
- WordPress : it rocks, really. It’s nice to see it’s so clean coded. Their plugin system is definitely worth checking out IMO.
- Prototype JavaScript framework, containing a very nice AJAX library: in short, this is JavaScript wizardry. If you are a JavaScript Guru you might not think this is all that special. But if you want to see some really hardcore JS usage, this is the place to be. The framework itself is easy to use, and the code itself is inspirational to read. Check it out.
Did you read any inspiring snippets of code lately? Feel free to let me know in the comments!