LightDM with an External Display and the Art of Pseudocode
Today I found the solution to an incredibly first-world problem that’s been plaguing me for the majority of the months I’ve been using Arch (I use Arch, btw) full-time: Logging into a session when my laptop is connected to an external display and in *gasp!* clamshell mode. Signal boosting a post that solved this problem that I’ve been procrastinating on lo these many weeks for me probably shouldn’t warrant a whole blog post but I wanted to praise the author for walking the reader through a step that we all probably do, or at least probably should be doing more deliberately: pseudocoding.
Much like in the process of writing my first paper in college where I started drafting an outline without even thinking about it, a credit to the years of English teachers in high school who made me do it even though the topics of many of the papers I wrote in those classes weren’t so complex that I felt I could adequately hold it all in memory, there are times when we find ourselves with a problem sufficiently complex that we need to utilize swap-I mean scratch paper, and we start making (quite literally if you’re me) back-of-the-napkin diagrams and rough pseudocode with horrendously-named functions that we swear we’ll fix when it comes time to implement. If the code you ultimately write never leaves the confines of your hard drive, it’s fine if the chicken scratch you’ve scribbled to yourself never makes it off the page, but if you share that solution with anyone, and especially if you share it in the form of a blog post, it’s really to everyone’s benefit (including your own), that you share the pseudocode as well.
For those consuming your code, it greatly improves the likelihood that they can conceptually understand and appreciate what you’ve made even if they can’t understand the implementation very well (For example, if it’s in an unfamiliar or obtuse language, like bash). It benefits the author as well, as it gives them an opportunity to think though the problem more generally and perhaps even explore multiple solutions without wasting keystrokes implementing each one. I particularly like this problem of telling LightDM which display to use as an example of the merits of explaining through pseudocode as the problem itself can be presented rather trivially; maybe so much so that one would just start hacking away at it inside of a text editor without giving it much thought. Upon closer inspection though, the problem is revealed to be a little more complex, with multiple sub-problems branching out like the length of a coastline, growing with each step in magnification.