When two (or more words) are to act as a single attributive adjective, you hyphenate them.
So, you must ask yourself "what type of code do I write?" - "I write object-oriented code."
Here object-oriented is a single unit that describes (adjectivally) code.
If these two words are simply part of the clause, ie, a predicative adjective, they don't need hyphenating. Think of it this way. "what is this software like?" - "This software is object oriented." In other words, "This software is oriented in an object way!"
I have found that many folk hyphenate in the latter case as well, but it's more important (for clarity's sake) to ensure you hyphenate in the former case.