Secrecy can be an effective strategy for protecting a software invention if the invention is difficult to discover. For example, software inventions that are not distributed in a software image are hard to reverse engineer.
However, there are several dangers to using secrecy as a protection strategy. If a competitor independently develops the invention and files for a patent before you have used it commercially for at least a year, the competitor could later sue you for patent infringement. Good secrets are also notoriously difficult to keep for long. Yet for many inventions, secrecy can be a viable protection strategy.