I am employed full time for company X and approached by company Y to do consulting services to write embedded C for them. While I know the basics of conflicts of interests and the big no-no's of sharing proprietary information, company knowledge and proprietary algorithms, I do have some questions regarding basic generic items that I need to reuse:
Software architecture: I have a personal preference of layering application, abstraction layer and hardware drivers. I don't want to have to do something different and it is not proprietary to the company. Would this be a problem if shared?
Generic functions: table look ups, sine/cosine functions, parsers, etc. I wrote all this code myself. Can I copy-paste this or do I have to rewrite, insert random spaces, change indentation, var names, table sizes, etc?
Function naming: I use a specific naming convention, e.g. MATH_Sin(). However, compiled to a DLL, company X can find a MATH_Sin() function available in company Y's DLL and assume that I copied their code. Do I need to rename all functions to hide any similarities?
Public knowledge turned into source code: say you find an algorithm on an paper that describes how to search for a pattern in a string and you turned the paper content into source code. Again, would a copy-paste be a no-no here too? Rewrite changing a few things or completely dismiss and find for another way to do it? In the end it is an implementation of public knowledge.
I asked around my peers and I cannot get a straight answer on what to do. Software is digital and very traceable and can always be traced back to the developer.
Update: I have approached my manager and HR and they strongly discouraged me to pursue this. They claimed that by using the same skill set (embedded programming or programming in general) for another company, there will be always the opportunity for company X to challenge myself or company Y. I asked then what would NOT be considered a conflict of interest and they answered "You could invest in a restaurant...". Seriously?
Company X is a very large corporation. There is no negotiation between employer and company, there is no acceptance of open source/licensed code and it seems they believe they own me and my skill set. While I do agree with some of their reasoning, I do not agree that they own my education and, while employed for them, I can't make use of my basic skills for other endeavors. Therefore I have decided to follow the advice below and open source all my personal code that does not belong to the company nor was written using company equipment or company time. I won't be making money or signing contracts, but at least I can keep my personal code and continue developing my career outside this restrictive environment.
Thanks for all answers. Hope this serves as a reference for others pursuing the same goal.