Software Lesson of the Day for 16/10/2024:
Sometimes you will try something and it works. And then you extend it a bit. And then a bit more. And it stops working and/or doing what you want.
Consider the possibility that the fact it initially worked was just a false signal, and that actually you should never have done it that way at all. Because the model or pattern for doing $thing$
is actually somewhat different — and whether you approve of that pattern or not, and whether you like deleting superficially working code or not, that’s the way you have to do it. Because we rarely write software nowadays without what we write having to fit into a more or less opinionated container. So make sure you actually understand the pattern, not simply what you want it to be.
(This post is brought to you by trying to implement an Android ViewPager
with hard-coded child elements in the layout xml. No matter how hard you try, you can never defeat the PagerAdapter
‘s beliefs about page instantiation and caching.)