There are really two kinds of dock lines...those you leave on your dock at your home slip to secure your vessel when you "put baby to bed", and those that you take with you for mooring as a transient at somebody else's slip, like a public landing, the yacht club, a marine, or a friend's boat. We'll talk here about the lines you take with you, as opposed to the lines you leave at home.
You should carry at least six lines with you at all times for safely mooring your boat. Two bow lines, two stern lines, and two spring lines. Each line should be 10% longer than your boat, so if your boat is 20 feet long, your lines should be at least 22 feet in length, measured from the eye to the bitter end. If you think that's not possible, then at least make sure that two of them are that long...the ones you intend to use as spring lines. (Of course, there is an advantage to having all six lines the same length...you won't have to try and sort them out when needed to find the right length line.)
When selecting the size line for your dock lines, consider the size of your boat and the size of your cleats. Cleats should measure one inch in length (tip to tip) for each 1/16 inch of line diameter. So, if you want to use a 1/2 inch diameter line, your cleats should be at least 8 inches long.
Boat Length= 0-27' Line Diameter=3/8"
Boat Length=28-36' Line Diameter=7/16"
Boat Length=37-45' Line Diameter=1/2"
Boat Length=46-54' Line Diameter=5/8"
For purposes of transient docking, nylon line is generally preferred material. Nylon line is generally constructed in three-strand twisted, or braided. Three-strand is less expensive, size for size has more stretch (a desirable characteristic to absorb the shock of wave action on the cleats), but is rougher on the hands. Braided line, conversely, has a tendency to "snag" more easily of rough surfaces, and therefore generally has a shorter life when used as dock lines.
Each transient line should have an eye spice on one end. The eye should be large enough to slip easily over the size piling you expect to encounter. If you're going to do the splicing yourself, you'll need to practice a bit, and may find that splicing stranded line is a lot easier than double-braided.