The use of exceptions for flow control was raised quite a few times already (here’s a c2 discussion and here is a great question on SO). I’d like to summarize this topic and provide some common use cases along with code examples to handle them.
Input validation rules are often taken for code contracts. In this post, I’ll try to cover their differences and show what their common use cases are.
Most of the development principles are applicable to any software you might develop. Nevertheless, there are some differences between building a reusable library and an enterprise application. Those differences often become sticking points as we try to apply experience gained in one type of project to projects of the other type.
The differences between shared library and enterprise development grow from differences in requirements and lifetime support cycle.
Nowadays, notion of composition over inheritance is quite widely accepted. It basically means that when designing a software, you should prefer composition to inheritance, although you could use either one.
But what if several classes do have some common attributes? Do you need to extract a base class for them?