On August 17th, we did a Webinar called Maintaining Code Quality in Open Source. Guest speaker Niels Lohmann, founder of the JSON for Modern C++ on GitHub, joined our Codacy CEO Jaime Jorge in an engaging talk about open source. During this talk, they discussed:
- What were the biggest challenges in open source;
- How did Niels manage to keep code quality as a top concern;
- What’s the secret to balancing a professional career and your open-source work;
- Plus, a live Q&A to answer your questions!
In case you missed the talk live, don’t worry: you can (re)watch the recording here or below 👇
A live talk on maintaining an open source project
During the live talk, Jaime Jorge, Codacy CEO, moderated the conversation and asked interesting questions to our guest speaker. You can check the detailed answers on our video recording of the live talk — we even give you the specific time frames! But we’ve summarized the key points for you to read 🤓
What motivated you to start this open source project? (00:03:22)
Niels was working at the university, and they were building software in C++. They needed some way to send JSON back to a server, and there was no library for that. When things started to get more complicated, they felt the need to create a sound library.
It was also the time when C++ 11 became more popular. Scott Meyers was releasing a book called Effective Modern C++, and Niels got inspired to name the project JSON for Modern C++. Since 2013, the project‘s growth has been linear, but in 9 years, it got 31.4k stars on GitHub.
What’s the biggest challenge to maintaining code quality in open source? (00:08:07)
- People don’t think about code quality: When people what to contribute, they usually have some part of the code they want to fix or a new feature they want to add. They work on it, open a PR saying it works on their machine, and then leave. The code quality part is generality left to the maintainers. Plus, contributors often don’t know about the bigger picture. For example, their code doesn’t work in a specific compiler, and they didn’t realize it was necessary. So several times, the expectations are not always aligned. A possible solution is to have a CI tool reject the PR and automatically say what the problem is and provide a link to the documentation.
- Problems with C++: C++ 11 is old but still not adequately supported in all the compilers used today. The language is also evolving, so when a new version comes along, all the code can break, and you’ll need to make adjustments. It’s a lot of moving targets, and when you have a lot of variations, you spend a lot of time testing for all those different configurations.
- We don’t know our customers: We have no idea who and where is using our project. So it can be different use cases with different expectations. Sometimes a new use case appears that we never thought about or even knew possible.
- We have limited resources: Everybody that contributes to open source does it in their free time. Usually, the project doesn’t have access to many people or money. We are using the free tier of the CI, so it is slow. Plus, you can’t delegate things you don’t want to do. If someone opens an issue you don’t want to work on, the issue might be there forever.
What’s the hardest thing about maintaining a group of collaborators in your open source projects? (00:16:42)
- People can appear and disappear at any time. You can never guarantee that people will stay in the project until they finish some feature or release. They send you a patch, and they might disappear when you have a question. So we need to ensure that people have a very productive time, where they can focus on developing and ask them all the questions we might have before they disappear.
- Communication and misunderstandings. It’s primarily written communication, which can be a source of misunderstanding, mainly because there are hardly any native speakers. The Discord channel makes communicating easier without leaving this paper trail forever in an issue on GitHub. GitHub is also a problem because it’s not the best tool for organizing communities.
- People management. Sometimes some people take everything personally. For example, many people use C++ because they value performance above anything else, and if they feel something is slow, they immediately get outraged and personal. They even threaten that they’ll go to a different library. Yes, someone can threaten not to use your free projects.
- Expectation management. At some point, you’ll need to say no. For example, people might make proposals that are not fitting your mindset and ideas for the project. A PR doesn’t mean you have to merge; you can also close it and say it doesn’t fit your project.
- Documentation management. It’s hard work, but it’s an investment. Every documentation page has a URL you can send to people instead of writing the same answer repeatedly. At some point, you need to stop adding features and start investing in documentation because, in the end, it makes the difference between a project that people want to use and a project that people need to keep looking for information in the code.
Was there any difficult moment where your open source project affected enterprise production environments? (00:28:12)
Companies like Apple, Microsoft, Google, Volkswagen, and Daimler use the library today. Usually, companies are some of the project’s best customers. They are very polite and never have very loud support requests. Plus, if you have a merge request from them, they’re very high quality. So everything is perfect, even in terms of communication. As Niels said, “It’s boring, but I think that’s a good thing.”
How do you celebrate? Have you met any of the collaborators in person? (00:30:44)
There are a lot of contributors from the USA, and there is no budget to meet these people. With the project moving the discussion to Discord, it’s easier to get in contact. However, some people are not there to socialize. They just want to code and improve things; it’s not the place for them to hang out and make friends.
But it’s fantastic that people do this in their free time. They spend their days writing software for money and then go home and write it for fun. That’s incredible!
What’s the biggest difference in culture between your open source work and your professional work? (00:33:07)
People are doing things just for fun, and that’s amazing. Of course, this can also happen in a professional environment, but it’s fantastic that in open source, people can motivate themselves for quite a long time. Niels talked about two features where people worked for one year, had a PR open for such a long time, and had to fix many things. There were a lot of edge cases. Eventually, it was ready, and then the person disappeared. They were there just to work on the feature and then went their way. So there is a lot of motivation, but there is also the risk of people disappearing more easily.
As a downside, open source can have a lot of discussions. Even in projects without big plans, there are always things that don’t fit the project. People repeatedly discuss the project scope in open source, but that doesn’t generally happen in a company.
No discussion is ever over: when new people come, they don’t know the past discussions. So you must be patient and document why you have rejected each feature. People have different expectations about what could be the next steps, and they can be very emotional.
And, of course, there are trolls. You’ll probably not find them in your day-to-day job, but you’ll find them on the internet.
What’s the secret to balancing a professional career and your open source work? How do you do it? (00:41:29)
The project is not something we’re doing all the time. We can work on it when we want to and if we have the time. So there is a luxury in deciding when we’re working, with no pressure.
Plus, we can try to balance what we do. If we had a lot of meetings at work and haven’t seen an IDE all day, you can go to the project and spend some time with the compiler. If we wrote code and went deep into the algorithms, in the project we go work on documentation.
After Niels and Jaime’s talk, we opened the floor to all the questions the audience might have. We were delighted to receive a tone of questions! We’ve listed them for you:
- Do you regularly get hard-to-reproduce bugs in the C++ code?
- Do you think initiatives like GitHub sponsors will someday help fund maintainers completely? If you had the chance, would you work full-time on your project?
- How do people normally react when their contribution is rejected?
- Can you tell us what the pros & cons of a header-only lib are?
- You mentioned communication of expectations. Can you share where you have documented quality expectations? And what part – if any – do you consider most important in the Codacy analysis?
- With JSON being a hobby project you work on for fun, are scalability, security, and other production-ready concerns things you keep in mind when developing? Do you know if they are a concern for people who use the library?
- Can you share some appreciation you received that you really liked? What forms of support make the most impact to open source projects?
- Have you tried providing an open hour (e.g., monthly) for people to get in touch interactively? (with contributors, for teaming up or celebrating the release)
- Do you have plans to start another open source project?
- Any plans to port it to Rust?
- Do you think an open source project maintainer would be hard to against those open source projects that are using parts of your code without claiming they are using your work?
- Have any companies tried to hire you because of your JSON project?
Thank you to everyone who joined live and those who watched the recording later on! Let’s keep the conversation going in our community.