Welcome to Sample Programs in Every Language (SPEL): a collection of articles that explores language features through code snippets. Feel free to browse the whole article or use the links below to jump to each section.
Table of Contents
What is SPEL?
Sample Programs in Every Language is a collection of articles that explores common code snippets in as many programming languages as possible. In language studies, this type of collection is know as a chrestomathy.
Due to the overwhelming amount of time and effort it takes to generate these articles, you may find that this collection is more modest than some of its counterparts:
That said, I hope that Sample Programs in Every Language brings you something new and interesting. With every code snippet comes an article breaking down language features while sharing language history and background. Together, maybe we’ll learn something!
The Inspiration for SPEL
Awhile back, I thought it would be fun to implement Hello World in a different language every day for 100 Days of Code. After about 20 days, I started to get bored. After all, Hello World isn’t really that challenging, and it hardly introduces the language.
At that point, I decided to open up the series to a more diverse set of typical coding challenges. Think FizzBuzz. Think Min and Max. Algorithms like these show off language features in all their glory. Oh, and they make great interview questions.
Of course, I love a good open source project that offers opportunities for the community to contribute. This project is no different. In fact, I encourage everyone to at least browse the GitHub repository. If I’m lucky, maybe you’ll choose to help out.
The Purpose of SPEL
As you can probably imagine, Sample Programs in Every Language serves several purposes.
First, SPEL provides a way for anyone to find solutions to common programming problems. After all, at its core, SPEL is simply a collection of code snippets. No longer will you need to dig through toxic Stack Overflow solutions just to find what you need.
Second, SPEL allows anyone to read explanations of code snippets through detailed articles. Who hasn’t borrowed a code snippet without understanding how or why it works? Now, anyone can dig into the solutions to make informed decisions.
In addition, SPEL grants anyone the opportunity to examine language syntax and design. With a collection of code snippets in every language, we have a chance to compare algorithms across multiple languages.
Finally, SPEL gives anyone a chance to contribute to a large open source project. With SPEL, it couldn’t be easier to fork the repository and start contributing solutions to a growing collection of code snippets.
How to Support SPEL
Of course, for any of the above purposes to be realized, the project requires support.
Perhaps the best way to show your support is to tell me what languages and code snippets you want to see next. You can do so by dropping your ideas down below in the comments.
In addition, you can always fork my GitHub repository and make a pull request with your changes. That saves me the time of actually writing the code, so I can get to making articles. Also, it gives me a nice task list that I can use to track my progress.
Finally, you can toss me some cash. While money obviously isn’t a requirement, it does serve as a nice motivator to keep working on the collection.
The List of SPEL Projects
The Sample Programs in Every Language collection is broken up into a set of projects. That said, it’s a huge pain to maintain the list of articles, so I recommend jumping straight to the archive. Alternatively, you an move right to the first article in the series using the navigation at the bottom of this page.
That said, be aware that we are currently transitioning the collection to GitHub pages, and we will no longer be maintaining the articles here.
As always, thanks for sticking around. If you found this article interesting, make sure to give it a share. Also, if you have any ideas for projects, let me know in the comments. Alternatively, you can fork the sample programs repository and make a pull request with your changes.
Recently, I was giving a lecture about Java's "common" methods (i.e., all of the methods of Object), and I had epiphany about how Java only has toString() while Python has str() and repr(). So, it...
Magic numbers are numerical constants that have no clear meaning in the code and therefore make code harder to read. Anything that makes code harder to read is something we can use to obfuscate our...