You probably need more experience. Nobody writes bug free code. Furthermore it's often not a good idea to write "perfect" code the first time around. When your code base grows, you might need to change things around and refactor some stuff.
No comments yet.