# Pseudo-x-ing

Recent side quest: get a feel for algorithmic design and analysis. Consequently, I’ve been reading Introduction to Algorithms, the seminal textbook by Cormen, Leiserson, Rivest and Stein. It’s prompted me to think about “pseudo-x-ing”.

I define “pseudo-x” as “an abstract variant of an activity coupled to a more embodied and concrete originating activity(x).” The obvious example is pseudocode. For people newer to computer science and algorithms (like me!) here’s a visualisation of merge sort from the procedure’s Wikipedia entry.

Now, here’s merge sort in pseudocode:

``````MergeSort(A, p, r):
if p > r
return
q = (p+r)/2
mergeSort(A, p, q)
mergeSort(A, q+1, r)
merge(A, p, q, r)``````

Now here’s an implementation of the same in Python:

``````def mergeSort(array):
if len(array) > 1:

#  r is the point where the array is divided into two subarrays
r = len(array)//2
L = array[:r]
M = array[r:]

# Sort the two halves
mergeSort(L)
mergeSort(M)

i = j = k = 0

# Until we reach either end of either L or M, pick larger among
# elements L and M and place them in the correct position at A[p..r]
while i < len(L) and j < len(M):
if L[i] < M[j]:
array[k] = L[i]
i += 1
else:
array[k] = M[j]
j += 1
k += 1

# When we run out of elements in either L or M,
# pick up the remaining elements and put in A[p..r]
while i < len(L):
array[k] = L[i]
i += 1
k += 1

while j < len(M):
array[k] = M[j]
j += 1
k += 1``````

As you can see, a concrete implementation of an algorithm described in pseudocode is no joke. It’s a significant exercise in translation, discipline and ad hoc problem solving. That’s not why I’m writing about pseudo-x-ing, though. What I’m wondering is this:

• Can the coupling between x and pseudo-x be leveraged to expedite learning?
• Just how leaky is the abstraction that occurs when practicing pseudo-x instead of x?
• Can rate of learning be increased by pragmatically managing the x:pseudo-x ratio?

Will repeatedly designing algorithms in pseudocode yield significant gains in programming ability? Can designing numerous distributed systems using modelling tools make one a more competent sys-admin/architect? Does kicking out story skeletons—stories composed of acts composed of sequences composed of scenes composed of beats—enhance raw storytelling skill? Does the practice of formal logic enhance real-life, deliberate decision making? Does generating and iterating through many business model canvases increase the probability of being a successful entrepreneur?

The simple answer: “yes”. In more detail…

First question: the coupling between x and pseudo-x is already explicitly leveraged in most domains—the IntroToAlgos book uses pseudocode as a teaching tool and foregoes discussion of implementation, for example.

Second question: this already-leveraged coupling is moderately leaky. Somewhere between twenty to forty percent seems like a reasonable estimate of what gets lost in the ether between x and pseudo-x.

Third question: hell-effing-yes it can. But it often isn’t (in my experience, anyway). It’s assumed and accepted that x and pseudo-x are coupled (sometimes strongly, sometimes weakly), and most learners and teachers tick-tock between the two naturally and by default. But I suspect there’s some room for improvement.

For example, if I wanted to really hone my algorithmic design and analysis skills a reasonable approach would be to follow a x:pseudo-x ratio based on the estimate above (e.g. 2:8). This means that eight of every ten algorithms I design/analyse should be interacted with in pseudocode only, while the other two should involve actual attempted implementations.

A key absence here is feedback. Specifically from someone with expertise. Churning out shitty pseudocode, system diagrams, story skeletons, business model canvases or logic sequences doesn’t magically take one to omnipotence. There needs to be corrective feedback from someone—or something—that knows a lot more about x than you do. If you can get that feedback—and ensure it’s of sufficient quality and delivered in a timely manner—then the opportunity remains: manage the x:pseudo-x ratio to accelerate learning.

Another key absence is negatives. In the same way that pseudo-x can be actively leveraged to generate improvement in x, an inverted relationship can manifest, meaning certain pseudo-xs can negatively impact their xs. Something-something Twitter fortune cookies and being a thought leader.