It can sometimes be confusing to identify what case you are about to use in German due to the fact that we don't have these cases in English. However, knowing confidently what case to use is the first step to constructing grammatically accurate sentences. So it is very important!
Let's start with the nominative.
The nominative case is used for the actor/person in the sentence who is doing the verb. This actor is called the subject.
For example - The man throws the ball - Der Mann wirft den Ball.
In this sentence, the man is the actor who is doing the action (verb) of throwing the ball therefore der Mann is in the nominative case.
The accusative case is used to describe the direct object. This is the thing or person that is having the action (verb) done to it. We can use the same example for this.
Der Mann wirft den Ball - The man throws the ball.
In this example to direct object (the thing/person that is having an action being done to it) is the ball - as it is the ball that is being thrown.
I general rule that I like to use if I want to find out if I need to use the accusative in a sentence is this: simply find the verb and ask yourself what is being done by the verb. In this case it is the verb to throw (werfen)- and the ball is the thing being thrown.
Lastly, we can look at the dative. The dative case is used to describe the indirect object. This is the object (person or thing) that is still being affected by the verb but is not the primary object involved.
This can be shown in a further example.
Der Mann gibt der Frau den Ball - The man gives the woman the ball.
We already know from previous examples that der Mann is the nominative subject (the person doing the verb) and der Ball is the direct object (accusative - what is being thrown). The indirect object in this example is die Frau (the woman). She is being given a ball, but not being given as a gift herself. In other words she is being affected by the giving of the ball but is not the object that is being given. This is the indirect object and therefore is described in the dative case.
Hopefully this explanation has given a basic understanding of the concepts of the subject, the direct object and the indirect object work. These are really important to understand whilst using the accusative dative and nominative.