Patents should never be issued for software. Software is written, it should be copyrighted.
The feature, idea or concept that the code completes should not be patentable. The code itself that completes such thing should be copyrighted.
Can you imagine how by all industries would be if the current patent system was used 100-200 years ago? We would probably still be in horse and carriages.