Cape Cod is easily reached from Boston via Route 3 and from Providence via Interstate 195. Once you cross Cape Cod Canal, you can follow U.S. 6. Without any traffic, it takes about an hour to 90 minutes to reach the canal from either Boston or Providence. Allow an extra 30–60 minutes' travel time in peak periods.
Parking, in general, can be a challenge in summer, especially in congested downtowns and at popular beaches. If you can walk, bike, carpool, or cab it somewhere, do so. But unless you are planning to focus your attention on a single community, you'll probably need a car on the Cape. Authorities on both Nantucket and Martha's Vineyard strongly encourage visitors to leave their cars on the mainland: taking a vehicle onto the island ferries is expensive and requires reservations (another option is renting upon arrival), and there is ample and efficient transportation once you arrive.