In this tutorial I'll teach you how to make an easy automatic farm by using a villager.
It's super simple, and very useful. There are many other ways of making automatic farms using villagers, but I like this type best.
You can use it for many different vegetables, like carrots, potatoes, beets, etc.
Step 1: The First Foundation
Make a 9x9 platform out dirt, but leave a hole in the middle for the water.
Step 2: Time for a Swim!
Put a block underneath the hole, then fill it with water.
Step 3: Don't Forget the Fence!
Build a wall around the dirt (Don't build it on the dirt, build it around the dirt).
Step 4: Let's Farm!
Hoe all the dirt.
Step 5: Where Did It Go!?
Cover the outer part of the dirt underneath with hoppers (make sure they connect).
Step 6: Cover It All!
Cover the rest of the dirt with hoppers that all connect to a corner one.
Step 7: Ooh! Treasure!
Put a chest underneath the main corner hopper.
Step 8: We'll Catch Him With a Trap!
Build something that will contain the villager so it doesn't escape.
Step 9: We Caught One!
Spawn a villager in the box (make sure it's a farmer!), after that, drop as many stacks of seeds to him until his inventory is full (that is, when he can't pick up anymore).
Step 10: Be Free!
You can plant the seeds, then let the villager free.
To speed things up, you can use bonemeal to grow the wheat faster.
Step 11: Wheat!
When the villager destroys the grown wheat, he won't be able to pick any of it up, so it falls through the dirt into the hoppers, which from their goes to the chest.