The standard method for optical encoders is called quadrature encoding. It 2 optointerupters and a disk with holes in it. The disk blocks and unblocks the interupters. The interupters are positioned to generate 2 square waves 90 degrees out of phase. This lets you detirmine the direction of roation in addition to speed.
There are a couple ways to read quadrature. Its a digital signal so you can use standard digital inputs. A microcontroller running a simple state machine is probably the easiest to put together. You could use a CPLD also. You could use the parallel prot but I wouldn't recommend it - windows might interrupt you program causing you to lose counts.
Braking is usualy done by connecting the dc motor's terminals together. Try it it will make your motor much harder to turn.
The encoder is fast enough that the delay is negligible. A good PID controller has the Derivative term tuned correctly to minimize overshoot. The derivative term works like a damper - like friction - to keep the motor from moving so quickly it overshoots. However Like friction if you make it too high your motor will move slowly.
PID implementation is fairly easy. Any PID controller can be unstable. That means that the motor will spin back and forth wildly. This happens when the Proportional term is too big. Higher P gives a faster more precice motor movement. Idealy an infinite P would give a perfect responce. In practice delays and the fact that its hard to find a motor with infinite torque mean that you can only have the gain so high before the system becomes unstable.
I would recommend using a microcontroller to implement your controller. The flexiblity of a microcontroller makes building a controller much easier. You can start with just a proportional controller and add I and D later.
A digital controller works something like this:
e is the error signal
e = (Position you want the motor to be in) - (current motor postion)
P, I, D are all constants that you detirmine through testing your system. P,I,D are all positive values.
You need to calculate the Derivative of your error signal and the integral of your error signal. The derivative can be aproximated by subtracting the last e from your current e. The integral is just all the e signals added together.
So to get your output you just do
output = P*e - D* (derivative(e)) + I*(Integral(e))
You want to use a timer or regular interrupt to change your output at a constant rate. A variable rate will make your controller unpredictable.
To tune your controller you set D and I to 0. You then increace P until the system becomes unstable drop back a little until its just barely stable. The motor will overshoot the setpoint a lot and oscillate a fair amount in this configuration. To reduce the oveshoot you increace D until the system is "critically damped". This means that the motor overshoots a little but doesn't oscillate at all. A criticaly damped system has the fastest responce with out oscillaing. You can then add a bit of I to reduce static offsets. This offset it a result of constant forces in your system, like gravity, wind resistance, and friction. With just proportional gain and derivative gain your motor will never reach the setpoint when a constant external force is applied. The Integral will gradualy build up to push against the constant force to reach the setpoint. You want to keep I relatively low because of something called integral windup. Integral windup causes extra overshoot.