18

I think most of us, programmers, used Stack Overflow to solve every day problems: looked for an efficient algorithm to do something.

Now imagine a situation: you have a problem to solve. Googled a bit, found a StackOverflow question but you are not really satisfied with the answers so far. So you have to do your own research: you need to do it because you want it in the company's app.

Eventually after some hours you have found the better solution. You're happy, you added it to the company's code base, then you want to submit your answer with a code snippet (just several lines) to the question you've found before to help others too.

But wait: the company's software is closed source, and you worked on it on the clock.

So does this mean I shouldn't post the answer neither at work nor at home to that question in the rest of my life, because I solved it at work, and the company owns that piece of code?

  • I think it depends on you companies policy. I would ask for permission to be on the safe side. – MrSmith42 Oct 30 '13 at 16:40
  • 1
    Ask the company lawyer if he could make a teeny tiny exception in this one little case, and if he says yes, he will be a goodhearted ex-company lawyer. Odds are he'll just tell you what is in the best interest of his job and the company, which is "no." – Neil Oct 30 '13 at 16:47
  • 1
    @MrSmith42 Sure. But to tell the truth I'm already guilty of this of several times, and I did it without thinking about the potential consequences, till now. And probably, I'm not alone with this. That's why I asked it here... Or does everyone cares not to express ideas or submit any code online while employed? I cannot believe. – Calmarius Oct 30 '13 at 16:50
  • 5
    One of the concern could be that if your solution/algorithm gives your company a competitive edge, then sharing it might be impactful to your company. – cYn Oct 30 '13 at 18:31
  • 3
    If you think it would be of help to someone, and isnt giving away company ip, just post a generic version of the thing. Personally, I think if the solution was partially derived from others you found here, the company doesnt have a claim on the technique in the first place as the content here is cc. – GrandmasterB Nov 5 '13 at 5:25
15

Exposing proprietary company information is something you should never do. Most code snippets on Stack Overflow are far more mundane than that, however. Consider this example:

public static unsafe void SwapX4(Byte[] Source)  
{  
    fixed (Byte* pSource = &Source[0])  
    {  
        Byte* bp = pSource;  
        Byte* bp_stop = bp + Source.Length;  

        while (bp < bp_stop)  
        {
            *(UInt32*)bp = (UInt32)(
                (*bp       << 24) |
                (*(bp + 1) << 16) |
                (*(bp + 2) <<  8) |
                (*(bp + 3)      ));
            bp += 4;  
        }  
    }  
}

This method inverts the endianness of a 32 bit number, by swapping the bytes around. The difference between this implementation and a naive one is that this one runs twice as fast, but you can only run it on a little endian machine. It's being used in a proprietary program, but it describes a general technique, and does not expose anything confidential.

  • This tends to follow along the idea that a company doesn't own algorithms doesn't it? – Daniel Gratzer Oct 30 '13 at 17:51
  • 8
    I can't say that with any certainty, given the byzantine nature of the patent system. – Robert Harvey Oct 30 '13 at 17:54
  • @Jozefg: Just like any invention, algorithms, which are complex and not obvious enough and developed within the company, are one of the few things in software world that can "easily" be owned by companies. An example presented here, is simple enough that it wouldn't fall into that category. And although there are cases where real original thought and years of research are invested and a company should have full ownership rights, most of the time the patent system (in US at least) is just plain abused. – DXM Oct 31 '13 at 2:08
7

I frequently post problems and solutions I run into at work, on company time with company code*. I've spoken to my manager directly about this, and he feels that the value the company gets from my time spent here far outweighs any concern about my time spent here in general.

*I'm cautious to obfuscate anything I think could be proprietary. Our in-house code is very proprietary, but would largely be useless to anyone without our proprietary hardware (which we don't sell).

I look at my questions & answers as helping myself as well as someone else down the road when they run into similar problems as I have.

1

How much would it cost your company for your additional time or lost time if you didn't have this resource?

As long as no compromising or proprietary info is given I feel that the posting solutions that you have found is compensation for answers that you have received.

1

The answer lies in the written legal agreements you signed with your employer (your contract) and with the jurisdiction under which those agreements will be judged. It is common for a legal agreement to list the jurisdiction which may or may not be the state you work in (though probably the country you work in, but not necessarily).

A great book is Intellectual Property and Open Source by Van Lindberg. From p. 185:

There are no legal repercussions for [a company] overreaching when defining "proprietary information." Several states limit the application of PIAs when an author or inventor doesn't use company property or time to create the new work... Even if state-imposed limits invalidate part of the PIA, other aspects of the agreement generally survive.

Read your contract. Disclose your intentions to your employer before you act. Then disclose your actions to your employer. Disclose these things in writing and get their response/permission when applicable in writing. At least that's what that book says.

I am not a lawyer, just interested in this stuff. This is not legal advice, just friendly suggestions. For myself, I don't casually make anything work-related public. I have made some things public after lengthy discussions with my boss, full disclosure, clear license labeling, and an agreement in writing about what I'm releasing, but that is rare.

0

I've posted code snippets online but I always edit the code so as to remove any references to the company, any customer data and often I rename fields/variables too. I basically end up re-writing the code so it can't be traced back to an employer. It takes a bit of extra effort but I think it's worth it.

Aside from the legal aspect you also have to think that you've been trusted with your employers property. If you freely post bits of it online then it looks like you lack discretion and can't be trusted. Even if you had permission a future employer finding your snippet from a search engine may not know this.

This is why I would tend to err on the side of caution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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