When I worked as a freelancer, I encountered lots of cases where customers were protecting their ideas and source code of their projects (such as web applications) as much as possible, no matter how unimportant, uninteresting and unoriginal were the projects and the concepts behind.

I've already posted a question about keeping the ideas secret, and received many great answers. Now, my concern is more about source code secrecy.

According to my observations of:

  • The codebases I had to work on during my career,
  • My own willingness to keep some of my own source code secret, and:
  • A few articles like, for example, Open response to Simon Stuart by the popular Programmers.SE contributor Mason Wheeler,

I conclude that source code is kept secret mostly for those reasons:

  1. Because the author is ashamed of the code of such a bad quality, or the company fears losing reputation if somebody sees such bad codebase, or that given the low quality of the codebase, it will not bring anything useful to anybody to open source it: even if somebody would be interested, he would hardly be able to run the solution (or, often, even compile).

  2. Because parts of the code are stolen (mostly from open source projects covered by a license which restricts its usage in a given situation),

  3. Because the code relies on security by obscurity and the author doesn't care about Kerckhoffs's principle.

  4. Because the product is so breakable that showing the code would cause too much harm: if a closed-source app with all those security leaks would withstand a newbie hacker, the same open sourced app would have far smaller chances, because even the beginner hacker would just have to study the code to discover all the holes.

    If it's not clear what I'm talking about, here's an example:

    if (credentials.password === 'masterPassword12345')
        isLoggedIn = true
        currentUser = credentials.userName
  5. Because the author over-estimated the source code (and his own skills and expertise). Example: believing that a home-made cryptography-related algorithm (which was never reviewed by anybody) is better than any well-known one.

  6. Because the author believes that the idea behind the code is great, and that it would be stolen.

  7. Because of the "It's not perfect enough" syndrome. In other words, the developer is willing to release the source code to public when the code is "good enough", but day after day, there are still things to improve, so the code would never be released.

All of those reasons give a rather negative image of people who are against publishing the source code.

Are there valid cases to not release to the public the high-quality code which follows Kerckhoffs's principle?

  • I love this question, but... Sep 3, 2013 at 1:50
  • 3
    I love this question, too. The issue "closed source" versus "open source" is opinion based" but finding valid possible reasons for cloed source is not (at least not in my opinion). I would like to reopen the question but i have not enough reputation for this.
    – k3b
    Sep 3, 2013 at 2:50
  • I can't vote to reopen either, but I think this is a "good subjective" question. Given the justifiable lean towards open-source software by SO, I think an investigation into when closed-source is good is a valid question.
    – user69037
    Sep 3, 2013 at 4:00
  • 1
    Not xkcd this time: click
    – Vorac
    Sep 3, 2013 at 9:14
  • What an inane question. It's like asking why would an artist not give away their art for free? It's not like someone could just copy it and use it for their own profit. Oh wait, yes they can. Same with software.
    – Dunk
    Sep 3, 2013 at 21:00

6 Answers 6


Some people and most companies have a strange perception about the value of code.

"We spent $100,000 on this project therefore the code must be worth that" and feel a need to protect it.

In reality most code is more like paint. You spend $100 on paint and $200 dollars to apply it to your walls. But now the paint is worth nothing, you cannot sell it, nobody wants it, and even if they did you cannot take it of your wall and put it on somebody else's wall.

It may enhance the value of the building but you cannot realize this without selling the building.

You could "steal" Amazons code base (most of it is freely available from various open source projects) and set up an Ammassons web site but you would not take over much of Amazons business.

Code is a necessary part of any modern businesses infrastructure, but, it only has value as part of a process and culture, on its own its worth nothing.

I would add there are some situations where the code is vital to the business and would be valuable enough to any competitor that it should be kept secret:

  • To prevent malicious manipulation of your facilities -- a good example would be Google's "page rank" system which is constantly being "gamed" to give web sites an unjustifiably high rank.
  • Automated Trading Algorithms -- an unscrupulous competitor could study the algorithm and fool your system into selling too low and buying too high.
  • A "faster/better" algorithim -- if your software' s unique selling point is a faster better algorithm for sorting/compressing/whatever then it probably pays to keep this a trade secret for as long as possible.
  • 3
    +1 for the paint analogy!
    – Gerry
    Sep 3, 2013 at 8:06
  • 3
    "I bought some used paint, but fortunately it was in the shape of my house" - Steven Wright
    – JeffO
    Sep 3, 2013 at 13:14
  • 1
    To your list of code that should be kept secret I would add: Code that comprises hundreds or even thousands of hours of research into a specific system; which is used in a software suite that enables clients of a business to take advantage of that research without acquiring the same (level of) knowledge; and which, when disclosed, would enable competitors to offer the same kind of value to their clients. You don't expect the Coca Cola company to share the recipe to their Coca Cola drink either, do you? Sep 3, 2013 at 16:56
  • Great answer, although I would disagree that code "on its own is worth nothing." Isn't there a value for other developers who might study it for their own enrichment? (Even if as an example of what not to do)
    – Dan1701
    Nov 16, 2013 at 19:10
  • As long as we're using the paint can analogy, many software projects create their own paint can factories and fill the cans with various colors of paint using another factory in another town. It's true that the paint costs $100 for the factories to create, but the factories themselves cost $1,000,000 to make. There are observers to make sure the paint is the right color, and while the paint can factory knows about the paint factory, the reverse isn't true. Jul 3, 2016 at 17:59

Because it was hard to write, and test. And design. And specify. And debug. And ISO 9000. And document. And version control. And get pointy-haired boss out of the way. And whatever makes the job of a software engineer worthwhile.

And you don't want that your competitors just copy-paste your source code instead of putting as much time and money as you in their product.

  • Are there cases where a successful business approach would be to copy-paste code without adding any value? Sep 3, 2013 at 7:21
  • 3
    @MainMa - Yes: all the cases involving the use of open-source code. This includes Apple using BSD Unix for its operating system, instead of developping an OS from scratch.
    – mouviciel
    Sep 3, 2013 at 7:27
  • Ok. Good point. +1 then. Sep 3, 2013 at 7:33
  • 1
    That's a bad example. No one gets rich selling open source software, without support or added value, with a different name. OS X was a fair bit of "added value" over BSD. (and they paid 100% of the list price anyway.)
    – DougM
    Sep 3, 2013 at 13:44
  • 1
    @DougM - The point is not around open source software, it is around the cost of developing software vs. using software already developed. If Photoshop V1 source code were released twenty years ago, Adobe wouldn't be where it is now.
    – mouviciel
    Sep 3, 2013 at 18:00

The most obvious answer of all, I think, is that the software is, for many companies, a substantial part of the value that the corporate entity brings to customers. So, if anyone could simply modify and re-compile the code, or re-use valuable parts of it, then they could offer the same service or value. This would hurt the corporate entity's competitive interests, and possibly cause them to lose money.

  • 1
    Not really. Amazon spent millions of venture capitalists money before it ever turned a profit. This was in a market they more or less created with very little competition. You could steal Amazons code base but without spending millions on promotion and branding you would get nowhere. Sep 3, 2013 at 1:30
  • 8
    @JamesAnderson: Software is the means to an end for Amazon, not how it makes its money. If you're a Microsoft or an Autodesk, the value if your software is a much bigger part of the picture.
    – Blrfl
    Sep 3, 2013 at 1:53
  • @JamesAnderson I edited my response to clarify that I'm just talking about a certain subset of companies. As Blrfl points out, Microsoft, Autodesk, Wolfram Research, and probably many other companies are in this situation.
    – user32122
    Sep 3, 2013 at 2:29
  • 2
    But [Libra|Open]Office does everything Office does for free. Branding, marketing, customer contacts are worth much more than the software itself. Sep 3, 2013 at 2:29
  • 4
    @JamesAnderson, you just brought up a product (LibreOffice), which forked from an open-source product and took a portion of its user base, while at the same time insisting that there is no value in protecting code. Honestly you seem like you're being wilfully ignorant.
    – MikeFHay
    Sep 3, 2013 at 14:32

Money was spent to solve a problem, or a specific set of problems. If competition then get the answer for these problems for "free", that puts the company that solved the problem at a financial disadvantage - especially if it would be possible for a larger company to "get to market" before the creating company because they have infrastructure in place, or if a competitor spends the money they WOULD HAVE spent on development on marketing.

What's more, it's sometimes possible to get an idea of a company's policies and processes by looking at these things. Again, this information can be used as a stratgic advantage. This is often the bigger issue... the code reveals the company's inner-workings.


You're right, most companies don't need to go to any great lengths to keep their code secret, because it's of no use to anyone else. Many internal solutions are tightly linked to other applications and systems as sort of a custom ERP solution.

For some companies, the value of the software is a part of the value of their company. A crappy code base that works for their purposes has value and isn't going to be of a concern to a non-technical buyer. No one wants to buy a company with strings attached. The buyer wants a cut-and-dry answer on who owns the code and are they free to do with it what they please? Who knows, the new company may want to take an internal application and sell it to others in the industry and leverage their purchase. This group will not value a bad code base as high as a solid application. Knowing the code was kept secret (although this could be an illusion) and there are no open source licenses to work around does add value to selling the business.


You don't hand out the source-code because then when your client needs modifications to a software you built, they will have to go with you and you can charge premium.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.