Software Metrics: A Rigorous and Practical Approach