In most languages we have four cases. In linguistic a case describes the function of a noun in a sentence. If we don't clear the function of nouns in a sentence it can become difficult to understand a sentence.
He gives the money the father the boy.
The function of the words money, the father, the boy is unclear. It can be interpreted in different ways.
He gives the money of the father to the boy.
He gives the father of the boy the money.
He gives the father the money of the boy.
If we don't clear the function of a noun, sentences can become ambiguous or at least hard to understand.
English and Roman languages specify the role of a noun with prepositions, almost all other languages with a declension, in other words the form of a noun changes depending on the function. That's why English, Spanish, Italian, French etc. native speakers find German "strange". Given the situation of the world, the only language with declension they get in touch with in general is German. However the opposite is true. German works like Russian, Arabic, Polnish, Finnish etc. and English, Spanish, French etc. are the exceptions. The only case with a declension in English is the genitiv, John's father, although it is possible as well to mark the genitive with a preposition, the keys of the car.
If we say that the function is marked by a preposition, we mean that the preposition clears the function of a noun in a sentence. In English for instance the indirect object is marked by the preposition to, although this is only compulsory if the the direct object precedes the indirect object: He gives him the keys. <=> He gives the keys to him. In Portuguese and any other roman language the indirect object is marked with an a and this a is compulsory.
Two cases, the subject and the direct object are not marked by any preposition, nor in English nor in Portuguese. In this case we deduce the function of the noun from the position in the sentence:
1) The dog sees the horse. <=> 2) The horse sees the dog.
In case one the dog is the subject and the horse the goal of the action described by the verb. In 2) it is the other way round.
If the indirect object is marked by a preposition, as in english, the difference between a indirect object and objects that are added to the verb by any other prepositions vanishes.
We talke about him.
I went there with him.
I give it to him.
I did it for him.
Looking it that way, the direct object is just a prepositional object. We can see it the other way round as well. Instead of preposition + noun we can have a case and actually in many languages, Latin for instance, we have much more cases. With + noun for instance is a case in Latin, an ablative, in + noun a locative and so on. We will see later on that the terms in grammars of Portuguese are sometimes a little bit confusing because of that.
In languages with declension other terms are used and sometimes these terms are used in grammar books as well.
nominative case = subject => John laughs.
accusative case = direct object => John sees Maria.
dative object = indirect object => He gave the keys to Maria.
Portuguese works like English, therefore it is easy.
O cão ladra.
The dog barks.
marked with de
A cor do cão é preta.
The color of the dog is black.
Vejo o cão.
I see the dog.
marked with a
Dá agua ao cão.
He gives water to the dog.
However in the case of pronouns there is a big difference between English and Portuguese. We will see that in the next chapter, 6.1.1. First of all in portuguese the personal pronouns direct object differs from the personal pronouns indirect object. In english they are the same in both cases, that's why they are called simply object pronouns in English: direct object = I see him <=> indirect object = I give him the key. Furthermore there is distinction in Portuguese between stressed and unstressed pronouns. The unstressed pronouns are used without preposition, He observed her, the stressed pronouns with preposition, He talked about her. In English we use simply the objective pronouns in the case that there is preposition.