Last May/June, I visited both towns. Each one was easy to get to (train from Utrecht to Gouda & bus from Hoorn to Edam). We had already visited Woerden before Gouda, and we discovered that Gouda cheese is made in and around Woerden and sold in Gouda, which is how it got its name. Since we had sampled lots of Gouda cheese in Woerden, we did have any in Gouda. In Edam, we bypassed the Cheese Experience, bought a small cheese at the gift shop, and enjoyed it on a picnic.
These towns have more to offer than just cheese. In Gouda, you can walk along the sinking street (Turfmarkt), see the beautiful Rathaus, and go on the Kamphuisen Syrup Waffle Factory tour. In Edam, we were then when the fort was open (Wednesday & Sunday only), and the volunteers there had very interesting stories to share.
Both towns have postcard views and are very walkable. If I only had time for one spot, I would choose Gouda. There is more to do in the town, and it has a nice central square. It makes for a more well rounded daytrip.