Nulls are not a mistake. They are a trade-off as so many other things in language design.
A bad trade-off – i.e., one where the downsides outweigh the upsides – is a mistake.
Nulls are not a necessity: Several languages demonstrate that there are better alternatives.
Drawbacks: numerous
How is this a trade-off?
Consider this piece of pseudo-Java/Spring code and think how you would do it if the platform you were using forced you to either declare a and b as optional (which they are not) or assign them some value between the IoC container instantiates the class X and wires the values for a and b.
public class X {
@Autowired
ServiceA a;
@Autowired
ServiceB b;
@PostConstruct
void init() {
// a and b are instantiated by the IoC container and
// are fully valid for the rest of the execution
}
}2. Do you not consider cyclic dependence a code smell? At least I have always avoided cyclic dependencies.
But in general yes; cyclic dependencies are a bad idea.