SLotD: Cheap Thrills

My new hobby is reading the C# using statements that Visual Studio inserts as it tries to figure-out the dependencies for my fumbling typing.

using System.Security.Cryptography.X509Certificates;
using static Android.Media.Midi.MidiDeviceInfo;
using Android.Media;
using Kotlin.Jdk7;
using Android.Drm;
using System.Security.Cryptography;
using Android.AdServices.CustomAudiences

public class MyClass
{

It passes the time…

SLotD: Pushing the model

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.)

SLotD: Premature Abstraction

Software Lesson of the Day for 2022-10-04: Note to self. If you’re struggling to create a generic, reusable, well factored, abstraction to implement a simple, application-specific piece of functionality – then it may just be that instead you can get away with a couple of simple data fields and a static function or two. Remember this for the next time.


(Lets see if I can remember to do this more often…)