How I’m learning programming

This is an outline of how I’m personally going about learning to be a better programmer, and learning to build webapps in particular.

Starting

All of my programming learning is project-based: I just dive right into trying to build some tool or script that would be concretely useful for me personally. (Whether or not it would be useful to someone else is not a question that I consider at all.)

I keep a running list ideas for applications to build, processes to automate, and new features for software that I’ve already built, and I pick projects from that list. I’ll bias towards things that are fast to build, things that I think I might use every day, and things that are just beyond my current knowledge of how to start.

So far this tends to be…

  • scripts and processes to automate or streamline workflows that I already do manually, or
  • Tools that somehow make it easier or faster for me to learn or practice something.

Then I’ll find a tutor to help me. If I’m hacking on or extending an existing piece of software, I might find the community hubs for that software and make a post saying that I’m a medium-novice programmer, I’m interested in building some [whatever] extentions, and ask if anyone would be interested in tutoring me, a combination of teaching me how to do it and pair programming with me, in exchange for money. For instance, when there were some simple roam extensions that I wanted to build, I asked on the #roam-hacking channel of the roam slack, and found a person to work with that way.

For this, I’m usually not looking for someone who’s done a lot of tutoring, necessarily, just a moderately skilled software engineer who’s familiar with the software we’re working with.

For projects that are starting from scratch, I’ll start by writing a one page spec of what I’m wanting, and ask my software engineering friends what tech stack they think I should use. Then I’ll search for tutors on Wyzant.com who are familiar with those technologies.

With Wyzant tutors, I’ll typically try a few over the course of a week or two to filter for one that’s really good: one of the main features that I’m looking for is if they’re tracking what my level of understanding is (Are their answers to my questions meeting me where I’m currently at, or are they skipping over inferential differences?) and how easy is it to get them to give me the space to think through a problem myself, instead just telling me the answer.

Each session

I’ll typically book 4 hour sessions with a tutor, with a planned 20 minute break in the middle.

I always do programming sessions with a dual monitor setup: VS code and the application itself (in a browser usually), in the larger external monitor, and a notes page on my laptop monitor.

Depending on how familiar I am with the tech stack that we’re working with, the tutor might be almost entirely steering. But I do all of the typing, and I ask questions about what various things do and why as we go. Anything that feels “big” in my mind, I paraphrase back, to consolidate my understanding.

I’ll take notes on key concepts and on the syntax of the language that I’m using. I also air on the side of commenting too much, leaving pretty detailed notes about what each block of code does for future-Eli.

For any given bug, I’ll generate a sketch of how I would try and solve it if I were working myself, first, and then the tutor might share their solution. Usually my solution would work, but their solution has better design principles. And usually, hearing their solution I’m able to correctly guess / extrapolate what those design principles are. I’ll paraphrase, and then take notes on those as well.

Within a day or two (a few days at the most), I’ll review all my notes from the session, during batched notes review, and make anki cards for all of the new syntax, so that the fiddly procedural details are “at hand” for me the next time I need to use them.

After we’ve completed a large section of the code, I might spend a whole session or more walking through the program-flow: where does it start, and which functions trigger which functions. In the process I’ll streamline the code or rename variables to be easier to follow, and leave comments describing what the code is doing, but mainly I’m consolidating and compressing my understanding of the whole interlocking machine of that code section.

I might also spend whole sessions refactoring my code, if the way the project developed

I’ll hack away on a project like this, with the tutor’s help, until I get my feet under me.

Reading documentation

One specific sub-skill to develop to being able to program independently is reading documentation.

I don’t have much of a handle on how to do this yet, but I suppose that I should use the same basic pattern as above.

For any particular piece of functionality of a given library, I start trying to look it up myself. Maybe I should read for a time-boxed 5 minutes, narrating my thought process out loud as I go, and then at the end of 5 minutes have the tutor offer feedback about my search process: were there hints about whether a given bit of documentation had the info I wanted, or not, that I missed?

As I mature

Eventually, I’ll get familiar enough with a given tech stack, I know the key steps for how to get started with a project and the basic alphabet of basic functions and syntax to compose.

When I reach this stage, I’ll start starting projects on myself: sitting down and trying to build the tool that I want to use.

However, I’ll still have a low bar to booking a tutoring session, to ask for help if I get stuck.

If I don’t know how to build something, I’ll ask ChatGPT (or similar), including asking followup questions. But if I don’t feel like that’s giving me a conceptual model or it isn’t solving my problem, I’ll book a session with a tutor to go over it.

And when I’m debugging, I typically don’t spend more than an hour trying to root out the bug, before either asking a friends or hiring a tutor who has more familiarity with the specific tech stack that I’m using.

A series of vignettes for thinking about assisting corrupt regimes to prosecute crimes

I was talking with a someone about whether you should always help the police prosecute serious crimes, up to and including rape and murder, even if you know that the police system is corrupt. I said that I would support the police in prosecuting a murder, but I didn’t think that this was a slam-dunk obvious moral conclusion. This was my response to them.

I don’t have a super strong take about what the correct answer is here, only that there’s a moral dilemma to contend with at all.

I

Let’s start with this hypothetical:

Let’s say you live in a slum in Chicago. The neighborhood you live in is controlled by a gang. Police officers mostly don’t go into your neighborhood, because the gang has a tight hold on it.

The primary activities of the gang are selling crack, and extorting protection money. That’s their main business model. There are a bunch of grunts, but the top guys in the organization get pretty rich this way.

That business model entails maintaining control over their territory. So if someone else tries to sell crack in your neighborhood, they’ll scare him away, and if he comes back, they’ll kill him. And a lot of violence is bad for business, so if someone not in the gang is roughing people up, the gang will typically threaten them, drive them away, hurt them, or kill them. (If a member of the gang kills someone unnecessarily, they might get reprimanded for being stupid, but probably not much more than that.)

If someone is murdered by a non-gang-member, the gang won’t do much of an investigation. But usually it’s pretty clear who did it. And depending on who was killed, killing someone on gang territory represents a challenge to the gang’s power, and so they’ll probably find and kill the perpetrator, in retribution.

The gang is a major “social institution” in your neighborhood. They’re the closest thing to an organization of law and order that’s around.

I claim that it is NOT obvious that if someone is murdered, you should help the gang find and kill the perpetrator.

That might sometimes turn out to be the best available option, especially if the killer seems really dangerous. But helping the gang is basically siding with one set of murderers against another. And by helping them you’re adding whatever social weight you have to their legitimacy as the Schelling norm-enforcement institution.

Probably if the gang suddenly got a lot weaker, such that they stopped being the Schelling “biggest force around”, things would get locally worse, as a bunch of smaller gangs would make a play for the power vacuum. There would be more violence, not less, until eventually you’ll settle into a new lower-violence equilibrium where there’s some other gang that’s dominant (or maybe a few gangs, which have divided and staked out the old territory). 

But that the collapse of the gang’s power would be locally bad, doesn’t make it obvious that supporting them is the moral thing to do. 

II

That’s one hypothetical. Now let’s try on a different one.

Let’s say that literally all of the above circumstances obtain, but instead of a gang, it’s the local police force that’s behaving this way.

Let’s say you live in a slum in Chicago. The neighborhood you live in is controlled by the local police department. Police officers from other jurisdictions mostly don’t go into your neighborhood, because this local police force has a tight hold on it.

The primary activities of the police force are selling crack, and extorting protection money. That’s their main business model. There are a bunch of grunts, but the top guys in the organization get pretty rich this way.

That business model entails maintaining control over their territory. So if someone else tries to sell crack in your neighborhood, the police will scare him away, and if he comes back, they’ll kill him. And a lot of violence is bad for business, so if someone who’s not a member of the department is roughing people up, the police officers will typically threaten them, drive them away, hurt them, or kill them. (If a police officer kills someone unnecessarily, they might get reprimanded for being stupid, but probably not much more than that.)

If someone is murdered by a non-police-officer, the police won’t do much of an investigation. But usually it’s pretty clear who did it. And depending on who was killed, killing someone on their territory represents a challenge to the department’s power, and so they’ll probably find and kill the perpetrator in retribution.

The police department is a major “social institution” in your neighborhood. They’re the closest thing to an organization of law and order that’s around.

It is maybe an important difference between the first hypothetical and this one, that the gang wears police uniforms. But I don’t think it is much of a cruxy difference. If we blur our eyes and look at the effects, the second scenario is almost identical to the first. It’s only the labels that are different.

If it seems morally incorrect to side with the local gang in the first hypothetical, then it seems morally incorrect to side with the police in the second. That an organization is called “the police” is rarely cruxy for whether they deserve our support as a bastion of civilization.

III

That was a hypothetical. Now let’s talk about some real historical cases.

Let’s consider the sheriff of a small town in the South around 1885.

The primary function of the Sheriff is maintaining white supremacy. He does that in a bunch of ways, but most notably, he goes around arresting black men on extremely flimsy legal pretext (“loitering” or “vagrancy”, if the man goes into town, for instance, or for failing to pay debts that he was forced to take on), and sometimes no legal pretext at all. He and the local judge sentence the black man to hard labor, and then sell a contract for that man’s labor to one of their buddies, a man who owns a mine up-state.

The black man will probably spend the rest of his life doing forced labor for that mine-owner. Every time the end of his sentence is coming up, he’ll be penalized for some infraction that will necessitate extending his sentence. That way, the mine can continue to extort his labor indefinitely.

The Sheriff, the Judge, and the mine-owners all make a profit from this.

Sometimes people from the North come down and observe this system. Some of them are appalled, but no one wants another Civil War, and there’s a balance of power in the federal government that lets the Southern states govern themselves how the choose. So no one stops this, even though it’s definitely illegal by common law and by US federal law.

Sometimes, when a white man is murdered, the Sheriff will do an investigation and punish the perpetrator. But often, they’ll probably scapegoat and lynch a black man for it, instead. But, I presume that he does (at least sometimes) do basically appropriate law-enforcement work, arresting and prosecuting white criminals, approximately according to the law.

This really happened. For decades. 

(If you want to know more you might check out the book Slavery by Another Name: The Re-Enslavement of Black Americans from the Civil War to World War II. I think there’s also a PBS documentary. I don’t know if it’s any good.) 

This seems to me to be much worse than a police force that is primarily selling crack and extorting protection money.

That Sheriff is the only game in town for law and order. He is legally empowered by the local government. But the local government is so corrupt and evil as to not to be morally legitimate. I don’t think it deserves my support.

If there’s a murder, even if I trusted that the Sheriff would find and prosecute the perpetrator instead of a scapegoat, I might not want to evoke (and thereby reinforce) his authority, which is not legitimately held.

IV

Now let’s talk about today.

Here’s some stats that I could grab quickly.

  • American prisons are famously inhumane. Inmates are regularly raped or killed.
  • One out of three black men go to prison in their lifetimes.
  • 44% of all the people in American prisons are there for drug offenses. Some large fraction of those are for the victimless crime of smoking weed.
  • 5% of illicit drug users are African American, yet African Americans represent 29% of those arrested and 33% of those incarcerated for drug offenses. African Americans and whites use drugs at similar rates, but the imprisonment rate of African Americans for drug charges is almost 6 times that of whites. (source, which I didn’t factcheck, but these numbers are consistent with my understanding)
  • As of October 2016, there have been 1900 exonerations of the wrongfully accused, 47% of the exonerated were African American. (same source as above.)
  • It is normal for arrested black men to be threatened into making plea bargains, even when they’re innocent. It is normal for arrested black men to fail to receive due process.
  • A Nixon aid said explicitly that the war on drugs was a way of targeting black people:

“The Nixon campaign in 1968, and the Nixon White House after that, had two enemies: the antiwar left and black people. You understand what I’m saying? We knew we couldn’t make it illegal to be either against the war or black, but by getting the public to associate the hippies with marijuana and blacks with heroin, and then criminalizing both heavily, we could disrupt those communities. We could arrest their leaders, raid their homes, break up their meetings, and vilify them night after night on the evening news. Did we know we were lying about the drugs? Of course we did.” (source)

This…does not look Just to me. This looks like a massive miscarriage of justice

If a person looks at the past history of how black people were treated by law enforcement, and looks at law enforcement today, and notices that the current crimes are being perpetrated by the same institutions that perpetuated the earlier evils, and they conclude that current US law enforcement organizations are immoral and illegitimate and shouldn’t be cooperated with…

Well, I can see where they’re coming from.

It seems to be a pretty live question whether the typical police force, or the criminal justice system as a whole is better conceived of as basically a gang, extorting and exploiting the marginalized fractions of society, or as an imperfect institution (as all institutions are imperfect) of Justice. And depending on which it is (or if it’s some more complicated thing), I’ll have a different view about whether it’s a good idea to cooperate with the police.