Code is the primary medium of communication at Stripe. We use it to communicate with each other what we want the computers to do. The quality of that code—and in particular its clarity—is therefore directly and profoundly related to our ability to get things done.
We strive for clarity in our code, because when reading code, you are not just learning about the implementation; you are learning about the thought process of the person who wrote it. If you write clear code, your thought process will be clear.
The best way to learn how to write clear code is to read good code. To facilitate this, we have put together a collection of sample code that demonstrates how we approach coding problems at Stripe.
Note that these samples are not intended as a recommended way of solving any particular problem; there are many different ways of approaching each one. Rather, they are intended as inspiration and examples of the sort of clarity we strive for in our own work.
I wrote the code myself with Code.org
I can’t speak for every company, but at Facebook we’ve made a conscious decision to focus on meaningful work that benefits the world rather than just quarterly growth or short-term gain.
We invest heavily in new technologies and acquisitions that we think will make the world more open and connected. We’re also building products like Internet.org, which connect the nearly two thirds of the world that still doesn’t have access to the internet, and Workplace by Facebook, which brings people together to do their best work.
Our CEO, Mark Zuckerberg, has spent a lot of time this year traveling around the country and meeting with people to discuss how our efforts can have a positive impact on communities in need. He’s also been meeting with leaders around the world to discuss how we can collaborate on global challenges like climate change and disease prevention.
As I travel around telling people about my job as an engineer at Facebook, I often get questions about why we devote so much effort to investing in these big issues when many other companies are focused on quarterly earnings and growing revenue as much as possible. They want to know why Mark has chosen this path for our company, especially when it’s not necessary for us to succeed financially.
In my experience working at Facebook for almost five years now,
We must make a distinction between the code and the program. The code is an abstract entity. It refers to the actual text file that contains the software and is independent of the hardware it runs on. The program is the physical state of the machine that’s executing the code, including both registers and memory.
There are several reasons this distinction is useful. One is that we can talk about a single piece of code in different states of execution at different times.
function() {
return true;
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}