And pistons
Funny. I'm in discussion on a separate thread about this topic. A fully automated version is frowned upon because of impact to server. However, setup a button, redstone circuit to the pistons, and then have a water flow carry the melon down.
There are tons of (better) designs on line. A simple one would look something like this:
(R is redstone and/or repeater as necessary, C cobble/filler, P piston, W Water D dirt, M melon stalk - pistons/cobble are one level higher than the "M/melon stalk" so that when the piston fires it pushes the melon into the water)
R R R R R R R
R P D W D P R
R C M W M C R
R P D W D P R
| R
| R
v R
collection point (button)