Unlike a patent, if you competitor invents it independently, then it is no longer a trade secret. You are only protected against a restricted range of dodgy dealing, and then only if you took adequate security measures (employees under appropriate NDA, not obvious in your product, obfuscated if sourcecode, that sort of thing).
Some people say they are 'software patents done right'. Certainly they serve a different purpose.