#You want a critique In the design world, what you are asking for is called a critique. It's a process that is typically repeated several times throughout the development of a design. You can invite critique without explicitly calling it out by involving your boss, or an experienced colleague, earlier in the coding process.
#When to ask for a critique It's much easier to give a critique when the other person has not yet put a lot of work into the work, but the direction is made clear. In a design, this would be the stage of sketches and wireframes. In software development, you might have pseudocode or some experimental code. Show it to your boss before you've written 20,000 lines of code and he will be able to tell, at a glance, what you're doing and if you're on the right track.
#Iteration
After you've gotten your course aligned, do some more work, and then come back. "Hey boss, I've implemented what we discussed, am I on the right track?" Now your boss is more familiar with your thought process, and knows where problematic areas might reside. He will look there and ignore everything else, because looking through the entire program is a slog.
#Stakeholder validation You may also want to consider talking to users of your product, or stakeholders responsible for the final result. You say that one of your projects wasn't completed like the company wanted. Who had the knowledge of what the company wanted? Did you ever show them what you were working on? Do this early, do this often, and you will be confident that you made the right thing.