I know this is basic stuff here, and I certainly recognize that there are several correct ways to tie a boat to a dock. I like this method, and hopefully this is helpful to some …
This method is secure in any almost weather, is not particularly at risk chafing, and it is always easily removable when ready to cast off. I find this always works for me for just about any boat under 50 feet.
An additional spring line or two might be required for larger vessels, but the tying method is the same.
First, the bow and stern lines should be as perpendicular as possible to the dock cleat, and set so that the boat is tight to the dock, with the side gate as accessible as possible for crew and guests.
Second, use the longest spring lines you can manage. The longer they are, the more effective they will be keeping the boat from swaying fore and aft. Wrap the base of the cleat just once, without allowing that bottom wrap to come into contact with itself, then start the figure eight cross wraps. More than one circular wrap at the base will cause the line to tighten on itself and can be very hard to loosen again. There is also no need for multiple hitch knots on top of the cleat. They too will make it difficult to loosen. After the base wrap, you only need two figure eight wraps over the cleat, and the last wrap is locked in a hitch knot. And I may be alone here, but the main reason I like this method is that the rope lines up in a most visually satisfying way!
If heavy winds are forecast, more is better (more wraps, more knots, and more lines), but for that vast majority of mooring a boat to a dock, this method works for me.
Of course, this does not address docks with a wooden or steel rail rather than a cleat. Your thoughts are welcome on how to tie up at these types of docks!