Deciding to open the source code of a software product has advantages and disadvantages. The disadvantage is that the firm loses the revenue from the software. The advantage is that the users' network can contribute to the quality of the software code, which increases the demand for the software and for a complementary product. Demand for the complementary product also goes up, because demand for a product increases when the price of its complement decreases, and under open source, the price of the software product drops down to zero. This paper examines the strategic interactions at work here, within a duopoly framework, and tries to determine the circumstances under which it is optimal for a firm to open its code. We find that firms open the source code when there is a competitive software-product market, a less competitive complementary-product market, and when the complementary product is of high quality. Furthermore, it is more profitable for the firm to open the source code if its competitor also does so. When this happens the incentive to open the code can even be higher than in a monopoly situation. More intense competition induces symmetric equilibria in which both firms choose the same strategy.