†. Gen 4:2b . . Abel became a keeper of sheep, and Cain became a tiller of the soil.
Both men worked at honorable professions and their skills were essential to the Adams' survival. Man at this time was a vegetarian so Cain farmed and raised the family's food; while Abel kept them clothed and shod by tending flocks for leather; and possibly fleece too.
†. Gen 4:3-4a . . In the course of time, Cain brought an offering to The Lord from the fruit of the soil; and Abel, for his part, brought the choicest of the firstlings of his flock.
There's no indication in this scene suggesting their oblations were sacrifices for sin. The Hebrew word for their offerings is from minchah (min-khaw') and means: to apportion, i.e. bestow; a donation; euphemistically, tribute; specifically a sacrificial offering (usually bloodless and voluntary).
Ancient rabbis understood the brothers' offerings to be a "first fruits" kind of oblation.
T. And it was at the end of days, on the fourteenth of Nisan, that Kain brought of the produce of the earth, the seed of cotton (or line), an oblation of first things before the Lord; and Habel brought of the firstlings of the flock. (Targum Jonathan)
Seeing as how Cain was a farmer, then in his case, an amount of produce was the appropriate first fruits offering, and seeing as how Abel was an animal husbandman, then in his case a head of livestock was the appropriate first fruits offering.
I think it's safe to assume the brothers weren't underage, but rather, responsible men in this particular scene because God is going to treat them that way. This incident is not said to be the very first time they brought gifts to God. The brothers (and very likely their parents too), probably had been bringing gifts for many years; ever since they were of age. And up to this point, apparently both men were doing everything right and God was just as much pleased with Cain and his gifts as He was with Abel and his gifts.
But where did they get this religion of theirs? Well; wasn't Abel a prophet?
"Therefore this generation will be held responsible for the blood of all the prophets that has been shed since the beginning of the world, from the blood of Abel to the blood of Zechariah, who was killed between the altar and the sanctuary." (Luke 11:50-51a)
It's evident then that the offerings were a legitimate part of a God-given religion rather than a pagan ritual. (cf. Heb 11:4)
†. Gen 4:4b-5a . .The Lord paid heed to Abel and his offering, but to Cain and his offering He paid no heed.
It's common for poorly-trained Bible students to trip up on the nature of the offerings and totally miss the role that the nature of the men themselves played in their worship; in other words: they assume Cain was rejected because his offering was bloodless and they attempt to justify their theory by citing the below:
"It was by faith that Abel brought a more acceptable offering to God than Cain did. God accepted Abel's offering to show that he was a righteous man." (Heb 11:4)
However, the focus in both Genesis and Hebrews is not really upon the offerings because it's okay for a minchah to be bloodless. The focus is actually upon faith and righteousness; viz: the focus is upon the nature of the brother's conduct rather than upon the nature of their gifts. Abel's conduct was righteous; hence God felt honored by his gift; while Cain's conduct was unrighteous; hence God felt insulted by his gift.
Cain was of a good family. He wasn't the product of poverty or an inner city barrio or dilapidated public housing. His mother wasn't cruel and/or thoughtless, nor did she neglect or abandon him. He wasn't in a gang, didn't carry a church key, a shank, an ice pick, or a gun; didn't smoke weed, drink, snort coke, take meth, gamble or chase women. He was very religious and worshipped the exact same God that his brother worshipped, and the rituals he practiced were correct and timely.
Cain worked for a living in an honest profession. He wasn't a thief, wasn't a predatory lender, wasn't a Wall Street barracuda, a dishonest investment banker, or an unscrupulous social network mogul. He wasn't a cheap politician, wasn't a terrorist, wasn't on the take, wasn't lazy, nor did he associate with the wrong crowd. The man did everything a model citizen is supposed to do; yet he, and subsequently his gift, were soundly rejected because he was unrighteous.
In what way was he unrighteous? Well, Cain's blemish is an elephant in the middle of the room. It was friction between him and his brother. It is unacceptable to worship God while the worshipper's relationship with their brother is dysfunctional.
"Therefore if you bring your gift to the altar, and there remember that your brother has something against you, leave your gift there before the altar, and go your way. First be reconciled to your brother, and then come and offer your gift." (Matt 5:23-24)
†. Gen 4:5b-7a . . Cain was much distressed and his face fell. And the Lord said to Cain: Why are you distressed, and why is your face fallen? If you do what is right, will you not be accepted?
Cain knew the drill; viz: do what's right first, and worship second. That can be readily seen played out in the first chapter of Isaiah where Yhvh's people are depicted practicing their God-given worship to perfection. They were attending Temple on a timely basis, praying up a storm, offering all the correct sacrifices and offerings, observing the Sabbath, and all the feasts days. But God soundly rejected all of that because their conduct was unbecoming.
I honestly believe that some families shouldn't attend church; not when the home is dysfunctional. It would be better for all involved, including God, if they would stay home and play video games and/or maybe go to a movie or a sports bar instead.