today in bad code:
this guy has objects A and B. A owns B, and B owns A (yes really). A has a method that calls B’s corresponding method, which then checks if A has a particular value set. Like, it gets called from A! If A wanted to use its own default value it would just use it!
This is another common coding error (I mean besides the main error of having all this functionality duplicated and/or split across classes): making things too convenient. Oh, I know! Let’s make it so the method can handle being passed a bad value, by automatically checking for a particular default and sending that.
No! No no no! If you are somehow getting sent bad values, that’s a problem! Bad values should not just magically show up in your code! Routing around this by checking (in a very convoluted way) for a default means whatever bug generated the bad value goes unnoticed!











