I think "shit code" usually falls into two broad categories (or both). Either the developer has a poor understanding of the problem they're trying to solve and comes up with something that is a massive hack/barely works (see: workaround oriented programming) or it was written in a style that the person reading the code considers "stupid" or "outdated" (this would fall into the legacy code category).