Why Sharing Code Feels Like a Dilemma

Someone once told me that sharing your code is like airing your dirty laundry: people can dig into your thought process, see every mistake, and judge you for it. That line of thinking is not rare, especially in biology and behavioural ecology. And so, while more journals are now mandating code publication, researchers may feel tempted to share only the bare minimum—just enough to satisfy reviewers. The result? A paper gets published, but the real usefulness of its technical contribution remains limited.

But science isn’t built from polished scripts alone. It grows out of messy beginnings—initial idea explorations, proof-of-concept tests, debugging sessions where you suddenly realise that fixing one line of code reshapes your whole framework. These are not embarrassing detours; they are the very process of discovery. Even a small code comment, a quick workaround, or a rough draft script can be a lifesaver for someone starting out. If sharing these insights means “airing my dirty laundry,” then so be it. I strongly disagree with that metaphor anyway.


Why I Choose to Share More Than Necessary

For me, the point of sharing is not compliance, it’s contribution. I want to disclose not just the code that reproduces a figure, but the entire scaffolding that someone else could build upon. From a zoomed-out perspective, all of society’s progress comes from sharing knowledge. In science today, that means sharing advanced techniques—going well beyond a few analytical scripts and figure-making code.

Think about the last time you needed a technique described in a paper, only to find no code and not even the equations to recreate it. How do you know whether their method even worked? In biology this happens all the time, leaving us unable to validate or build on results. Why should I hide my solution if it works? I’d rather show and tell.

Yes, some people want to benefit as much as possible from the smallest advancement. But that reflects selfish intent and a lack of perspective. If I think of my code as money, the mindset is clear: someone with only a few notes clutches them tightly, fearful of loss. But someone with a steady income can spend freely, confident that more will come. In the same way, confidence in your skills and creative capacity breeds generosity. If you know you can generate new ideas, you don’t fear sharing the old ones—you’re already building the next.


The Fear of Losing Credit

Of course, the fear of being used without credit is real. But I publish my code even before submitting papers. If someone uses it without citing me, that says more about their character than mine. People don’t steal useless things. Companies don’t steal code they can’t use. If it’s copied, it must have been valuable. And being recognised as open, transparent, and generous builds its own momentum: people want to cite you, just as they want to collaborate with well-established scientists. Sharing credit is a flex in its own right.

Ultimately, what is the point of writing a scientific paper if it isn’t useful?


When Sharing Isn’t Possible

There are genuine reasons why code can’t be shared—perhaps you don’t own it, co-authors disagree, or corporate funding prohibits it. But the strive should always be to share, not to hide.


My Commitment

In the past six months, I’ve not been paid to do science. Besides a list of simulations and tools that form parts of my various manuscripts, I have built Batsy and Esperdyne, entirely on my personal resources, and more are on the way. These are my foundations for future projects. But it would feel unacceptable to keep them locked away so that only I benefit. There are field biologists who trek through forests at night, risking their safety to record bats. All I did was develop the techniques from my cosy apartment. Why should I fear them using what I’ve built?

In fact, I want to see who replicates Batsy and Esperdyne, how they use them, and what feedback they send back. Being part of a global community of researchers and enthusiasts is deeply meaningful. The joy of science would be lost if I hoarded my code. If my tools help uncover unknown behaviours, contribute to biodiversity studies, or advance conservation, then being part of that chain of discovery is my greatest reward.

“The i in science reminds me that discovery may be personal, but it is a team game on a global playground — and that’s what makes me want to be part of it.”

If everyone has to rebuild the wheel, we will go nowhere.

Sharing is not about perfection; it’s about progress. My choice to open up my process—warts and all—is a refusal to accept stagnation in science. The true value of our work lies not only in what we publish, but in what others can do with it. By putting ideas, tools, and code into the commons, we accelerate discovery, empower communities, and build trust in science itself. That is why I share what I create: because knowledge kept is fragile, but knowledge shared is indestructible.