We use A/n When we don't know or it isn't important which one:
eg:  He was working in  a hardware .
With jobs:  eg:  He is  a foreman
To talk about a person or thing for the first time:
eg:  They've got  a computer's address book
We use  The To talk about the same person or thing for the second/third/ fourth  time
eg:  She wrote it in  the computer's address book.
With superlatives:
eg: She's  the most beautiful girl  in the world

The article