Friday, July 22, 2022

Tips for planting milkweeds in the Bay area

Since the recent article about the endangerment of Monarch butterflies, a lot of people are interested in planting milkweeds for Monarch caterpillars. I've been doing that for the last few years in my garden in the east bay in California, so I thought I'd share my personal tips.

Milkweed species: Narrow-Leaf

There are many species of milkweed, but not all of them are native to California, and non-native milkweeds are associated with issues like disease and disrupting natural butterfly cycles. The two most commonly sold native milkweeds in CA are the Narrow-leaf milkweed and the Showy milkweed. I have planted both, and based on my observation of caterpillar behavior, I highly recommend the Narrow-leaf. My caterpillars will only eat the Showy as an absolute last resort, and sometimes not even then. They are ravenous for Narrow-leaf, however.



Where to buy

You can use Calscape.org to find local nurseries that sell narrow-leaf milkweed. Before you go to the nursery in person, check their website or give them a call to see if it's currently in stock. 

You can often get Narrow-leaf from a generic nursery that sells both native and non-native plants, but some of the generic nurseries spray their plants with insecticide or use soil with insecticides - no good! If you instead go to native nurseries, that shouldn't be an issue (but you should double check just in case). My favorite native nurseries are Oaktown Native and Watershed.

You can also grow it from seed fairly easily. My favorite native seed source is Larner Seeds. It will take some time for the plant to grow large, and small plants may get overwhelmed early by caterpillars, but I've found that even the small plants can bounce back after being devoured. 

Planting wildflowers

There are two reasons to plant native wildflowers near the milkweed: 1) munchies for the adult butterflies 2) familiar places for the caterpillars to pupate. We happened to plant a Salvia Clevelandii near our milkweed, and that's where a caterpillar happily pupated. 

Once again, I recommend purchasing native wildflowers either from local native-specializing nurseries or from seed. Use Calscape.org to make sure that a particular plant is actually native to your area.

Moving the caterpillars

I will often find that a caterpillar will have completely decimated milkweed in one part of my garden (since my milkweed are still quite small). In that case, I often move the caterpillar to a more milkweed-y part of the garden. To safely transport, I make sure that they're actively moving (i.e. not in a delicate phase of changing instars), snip off the milkweed segment with scissors, and place that segment near the new milkweed. Sometimes I even bring them to the neighbors' milkweed if we're all out.

Where do they pupate?

This is still my top question as a Monarch-raiser, as I love to watch the metamorphosis but can rarely find a chrysalis. In my garden, the only chrysalis I located was on our Salvia. 

Here's the butterfly that emerged from the chrysalis on the Salvia (and video of their  first flight):

For my neighbor's garden, they love to pupate on the underside of the top of their fence. 

It's important that wherever they pupate, they have enough room for their wings to unfold and dry out. I'm curious to hear where other Monarchs pupate; let me know what you've seen!

Wednesday, July 20, 2022

Line highlighting extension for Code Mirror 6

A little background: Dis This is my online tool for viewing the disassembled bytecode of Python snippets. I started it off with a simple text editor, but I wanted to upgrade it to a nice code editor with line numbers and syntax highlighting.

The most commonly used online code editor libraries are Monaco, CodeMirror, and ACE. I believe Monaco is the most full featured and accessible, but I opted to try CodeMirror for this project as I don’t need as many features. (I avoided ACE since its what we used for the Khan Academy coding environment, and we found it fairly buggy).

CodeMirror recently released a new version, v6, and its quite different architecturally from previous versions.

One of those differences is that the library can only be loaded as a module and cannot be loaded via CDN, so my first task was adding module bundling via rollup.

Once I got rollup running, it was fairly straightforward to get a basic editor working:

import {basicSetup} from 'codemirror';
import {EditorState} from '@codemirror/state';
import {python} from '@codemirror/lang-python';
import {EditorView} from '@codemirror/view';

const editorView = new EditorView({
    state: EditorState.create({
        doc: code,
        extensions: [basicSetup, python()],
    }),
    parent: document.getElementById(“editor”),
});

But now I wanted a new feature: bi-directional line highlighting. Whenever a user highlighted a line in the editor, it should highlight relevant rows in the bytecode table, and vice versa. The end goal:

To try to understand CodeMirror's new approach to extensibility, I did a lot of reading in the docs: Migration Guide, System Guide, Decorations, Zebra Stripes, etc. Here's the code I came up with.

First I make a Decoration of the line variety:

const lineHighlightMark = Decoration.line({
  attributes: {style: 'background-color: yellow'}
});

Then I define a StateEffect:

const addLineHighlight = StateEffect.define();

Tying those together, I define a StateField. When the field receives an addLineHighlight effect, it clears existing decorations and adds the line decoration to the desired line:

const lineHighlightField = StateField.define({
  create() {
    return Decoration.none;
  },
  update(lines, tr) {
    lines = lines.map(tr.changes);
    for (let e of tr.effects) {
      if (e.is(addLineHighlight)) {
        lines = Decoration.none;
        lines = lines.update({add: [lineHighlightMark.range(e.value)]});
      }
    }
    return lines;
  },
  provide: (f) => EditorView.decorations.from(f),
});

To be able to use that effect, I add it to the list of extensions in the original editor constructor:

extensions: [basicSetup, python(), lineHighlightField],

Now I need to setup each direction of line highlighting. To enable highlighting when a user moves their mouse over the code editor, I add an event listener which converts the mouse position to a line number, converts the line number to a “document position”, then dispatches the addLineHighlight effect:

editorView.dom.addEventListener('mousemove', (event) => {
    const lastMove = {
        x: event.clientX,
        y: event.clientY,
        target: event.target,
        time: Date.now(),
    };
    const pos = this.editorView.posAtCoords(lastMove);
    let lineNo = this.editorView.state.doc.lineAt(pos).number;
    const docPosition = this.editorView.state.doc.line(lineNo).from;
    this.editorView.dispatch({effects: addLineHighlight.of(docPosition)});
});

To enable highlighting when the user mouses over rows in the corresponding HTML table, I call a function that converts the line number to a document position and dispatches the effect (same as the last two lines of the previous code).

function highlightLine(lineNo) {
    const docPosition = this.editorView.state.doc.line(lineNo).from;
    this.editorView.dispatch({effects: addLineHighlight.of(docPosition)});
}

For ease of use, I wrap all that code into a HighlightableEditor class:

editor = new HighlightableEditor(codeDiv, code});

Check out the full highlightable-editor.js code on Github.

Wednesday, July 13, 2022

Inactivity timer for Chrome extensions

My Quiz Cards browser extensions are interactive flash cards, giving users a way to practice their Spanish, German, US Capitals, and World Capitals, by simply clicking an icon on their browser.


Screenshot of Quiz Cards popup asking a spanish word

One of the Quiz Cards features is updating the browser icon with a little number to indicate how many days have passed since the last time you answered a card. 

When I upgraded the extension to manifest v3, I found I also needed to update that feature.

How it worked in manifest v2: whenever a user answered a question, the extension stored a timestamp in localStorage. The background script used setInterval to call a function every so often to see how many days passed since that timestamp, and if more than 0, it updated the badge with the number of days.

When using manifest v3, background pages are actually service workers. Using setInterval will no longer work reliably, since the browser stops and starts service workers when not in use. Instead, Chrome recommends using their alarms API instead. They also suggest using their storage API instead of localStorage.

So, in the flash card pop up, I run this code when a user answers a card:

chrome.storage.local.set({'last-asked': (new Date()).getTime())

chrome.action.setBadgeText({text: ''});


That stores the latest timestamp in storage and clears out any number that might have been previously set on the badge.


In the background service worker, I set an alarm to call a function every 60 minutes. That function retrieves the timestamp from storage, compares it to the current time, and updates the badge number if relevant.


async function sync() {

    const result = await chrome.storage.local.get(['last-asked']);

    const lastAsked = result[key];

    if (lastAsked) {

      const rightNow = (new Date()).getTime();

      const timeDiff = (rightNow - lastAsked);

      const DAY_MS = 86400000;

      if (timeDiff > DAY_MS) {

         chrome.action.setBadgeBackgroundColor({color:[0, 0, 0, 255]});

         const numDays = Math.floor(timeDiff/DAY_MS);

         chrome.action.setBadgeText({text: numDays + ''});

      }

   }

}


// Once an hour, check if it's been too long

sync();

chrome.alarms.create('check-inactivity', {periodInMinutes: 60});

chrome.alarms.onAlarm.addListener(sync);


And that's it! I figure this may be a common use case for the alarms API, so I'm hoping this post helps anyone looking to implement a similar feature.


Sunday, July 10, 2022

Diversifying historical references in CS classes

 A few years ago, I discovered #DisruptTexts, a movement by teachers to challenge the traditional canon in English classes, i.e. spending less time on Shakespeare and more time on historically underrepresented authors.

I teach programming, not English lit, but I still wondered if there were opportunities in my curriculum to shift emphasis away from white male “authors” to people from other cultures. I realized that there are a few standard spots in programming courses that reference the inventor of some algorithm or concept, and that inventor is typically a white male. However, as a general rule, many "inventions" actually get invented by multiple people, and history books try to simplify it down to a single origin story. So, each time I found a reference to an inventor in my curriculum, I researched the web to find any additional inventors.


Here’s what I found for the topics I taught last year:


Fibonacci → Virahanka


When teaching iteration or recursion, I often show how to calculate the numeric sequence where each number is the sum of the two numbers before (1,1,2,3,5,8,13,…). 


The sequence is typically named after Fibonacci, an Italian mathematician from the middle ages who encountered it while modeling the reproduction of rabbits. 


Slide on Fibonacci's study of rabbit reproduction


As it turns out, a Sanskrit grammarian named Virahanka discovered the same sequence many centuries before, while modeling the syllabic structure of Sanskrit poetry. 


Slide on Virahanka's study of Sanskrit poetry


I love when programming and linguistics overlap, so i was fascinated to learn about Virahanka's sequence. To acknowledge the earlier discovery, I added slides on Virahanka and renamed the fib functions in CS61A to virfib.

def virfib(n):
  if n == 0:
    return 0
  if n == 1:
    return 1
  else:
    return virfib(n - 1) + virfib(n - 2)



Backus-Naur → Panini-Backus


Backus-Naur Form is a notation for describing the rules of a language’s grammar (as long as it is context-free). IBM engineer Peter Backus invented the notation in the 1950s to describe the grammar of Algol programming language:


Screenshot of section on syntax of for statements from ALGOL report

BNF is still used today to describe the grammar of modern programming languages. For example, the SQLite syntax reference uses railroad diagrams, a visualization of BNF grammar rules:


Screenshot of DELETE reference for SQLite



I was amazed to discover that this recent “invention” also has a much earlier origin story from the study of Sanskrit. Around 500 BCE, a grammarian named Panini used a formal notation to describe Sanskrit, and that system was very similar to what Backus created in the 50s. I won't share the Sanskrit rules since I don't read Sanskrit and can't be sure of what I'm sharing. However, here's a grammar diagram from a Sanskrit teacher:

Grammar diagram for Sanskrit

As you can see, the construction of a word in Sanskrit follows similar flows as the construction of a DELETE statement in SQLite. There are elements that can be repeated, elements that must be at the beginning or the end,  recursive elements, etc. Those are the sorts of requirements that could be described both by Panini's 500 BCE notation or by Backus' 1950s' notation. 

For that reason, some propose renaming BNF to Panini-Backus form. I did not end up doing that when I taught BNF, since we were also teaching EBNF and I wasn’t prepared to also rename that. However, I do mention its much earlier invention in India when lecturing in class.


George *and* Mary Boole


One of the most foundational concepts in programming is logic, the way we can combine true/false expressions using AND/OR/NOT/etc, and yield a true/false result. That’s called Boolean logic, named after the English logician George Boole who described the system in the 1854 book, The Laws of Thought.


George Boole was married to another mathematician, Mary Everest, who also wrote books on math, despite living at a time when women weren’t welcomed in academics. Mary is known to have contributed heavily to the editing of George’s book and was a loud proponent of its ideas after George’s early death. I am certain that many inventions of married men throughout history were helped significantly by their significant others but not attributed to them. How many women and non-binary inventors would we know about today if history wasn't so rife with patriarchal systems?


Fortunately, we know about Mary’s contributions. Heres how I describe it in my co:rise Python course:


Booleans are named after George Boole, a self-taught logician. He described a system of logic in an 1854 book, The Laws of Thought, that was edited by his wife Mary Everest Boole, another self-taught logician. According to Mary, George was inspired by Indian logic systems dating back to 500 BCE. We can actually find the origins of many "modern" computer science concepts in ancient systems of India, Africa, or the Mediterranean.


And look, another reference to Indian scholars from thousands of years ago! It makes me wonder how many times logic was independently invented across the world.


Those are the places I found so far where I could diversify the historical mentions. Unfortunately, most inventors are still male and from the upper class of society, since we history rarely hear from oppressed genders and classes. 


I’d love to know if other CS teachers have discovered ways to #DisruptTexts in your CS classrooms. 

Monday, July 4, 2022

How to audit CS61A

I taught/co-taught CS61A at UC Berkeley for the last three semesters. Since it is a fairly well known class, I often get asked how to audit the class, both by Berkeley students and people outside of Berkeley.

Generally, CS61A materials are accessible online, so you don’t need special permission to audit the class. Here are some tips I often give, however.


If you are happy to follow the pace of the current semester (i.e. summer/winter/fall), then use the materials at cs61a.org. You will need to wait for assignments to be released, and you can see those release dates on the front page calendar. 




Otherwise, if you want to be able to blaze through the materials at your own pace, you can access previous semesters by navigating to <semester><year>.cs61a.org, where <semester> is either “su”, “fa”, or “sp”, and <year> is the last two digits of the year. For example, sp22.cs61a.org is the spring 2022 semester when I solo taught, and fa21.cs61a.org is the fall 2021 semester when I co-taught with John Denero. Each semester differs slightly in terms of content and instructor. Denero is the most common instructor and the one who originally created the Python version of the course (CS61A was originally taught 100% in Scheme).


All the assignments (labs/homeworks/projects) are autograded using a system called OKPy that checks whether your code passes the tests. By default, the OKPy command asks you to login to a Berkeley account for backup/submission purposes, but you can bypass that check by adding `-- local` to the command. That allows you to check all your work locally regardless of whether you're a Berkeley student or not. 


The official solutions for the assignments are only available during the current semester, released ~3 days after assignments are due, but are taken down once the semester is over. So, if you think you'd benefit from seeing the official solutions, you should follow along with the current semester instead of going through a previous semester's materials.


Lecture slides are linked from the front page calendar. The lectures themselves are either over Zoom or in-person, depending on the semester. If you're in the Berkeley area, you actually can stop by the lectures in-person. However, if you're not a Berkeley student, you typically cannot access the lecture recordings, as they are uploaded to services that require a Berkeley account. We have to keep the recordings internal for legal reasons, as the recordings are not properly closed captioned, and any published recordings from a university must be closed captioned. 


However, John Denero has a set of pre-recorded lectures that are closed captioned and available on YouTube. Those lectures are often linked from cs61a.org in some way. For fa21.cs61a.org, follow the "Playlist" link under each lecture title. For sp22.cs61a.org, click the lecture title and watch the embedded player. For summer 2022, click "Precorded" under each lecture title. When Denero is one of the lecturers of the semester, his videos are often fairly well aligned with the official lectures. However, when he's not one of the lecturers, there will be some divergence in the content, and sometimes there will be no Denero lectures available for a particular topic.


The textbook was written by Denero and is available for free online at composingprograms.com. The front page calendar has a column which lists which textbook sections are relevant to that lecture. Once again, the textbook readings will be the most aligned in a Denero-taught semester and may be divergent/missing for some topics in non-Denero semesters. 


Typically, the lectures cover similar content as the textbook, so you could decide to only read the textbook or only watch the lectures, and not really be missing anything. When I went through the materials, I primarily read the textbook and only watched videos when I felt like I wasn't really grasping something and wanted another explanation.


Hope that helps!


Tuesday, June 7, 2022

How accessibility helps a nursing mother

 When I talk about accessibility with budding web developers, I always like to make 2 points:

  • When you improve the accessibility for someone with a particular disability, you often improve the usability for a whole other set of users. For example, by supporting keyboard navigation for visually impaired users, your website now works better for vim/emacs users.
  • Accessibility isn't just about helping people with chronic, severe disabilities; accessibility helps people with a huge spectrum of disabilities and temporary conditions that affect the way they use a website. For example, by supporting offline access for a remote island village that has no Internet connection, you're also helping users who have WiFi issues in their urban dorm.
I am now once again in the phase of life where I am a nursing mother, and I am very much appreciative of how accessible websites make it possible for me to breastfeed and use the web at the same time. 

Here's what's different about my ability to use the web these days, and how improved accessibility helps:
  • One hand only. I can sometimes use both my hands, thanks to my hands-free nursing + laptop station, but I often am using one of my hands to better position the baby. What helps...
    • Autocomplete. I was skeptical of GMail's autocomplete email responses when they first came out ("stop trying to predict me!"), but now I love them and use them in MS Outlook too. It's just really nice to not have to type at all, even if my responses are slightly less "authentic".
    • Large click targets. I am not very coordinated with only one hand, especially if my one hand isn't my dominant hand. I can't make dainty movements or pull off any sort of "hold shift while right clicking" shenanigans. Simple clicks on large targets are the easiest UI right now.
    • Keyboard navigation. Well, as long as I only have to press a single key, and certainly not a key combination with two keys on opposite sides of the keyboard. 
  • Poor lighting conditions. I have to nurse every 3-4 hours, including at night, so I am often on my laptop or phone in low light conditions. Or, I might be in a too-bright condition, like when the sun starts streaming behind me, and am unable to adjust the curtains due to a baby napping on me. What helps...
    • High contrast colors. Many websites these days use low-contrast text color combinations for design/branding reasons, which are difficult to read in poor lighting conditions. Props to the websites keeping it simple with black&white or other combos that pass the Contrast Checker guidelines.
  • No audio. I do have headphones that I can theoretically use while baby is nursing/napping, but it's better if I can hear my baby to make sure she's swallowing and breathing fine. So I generally have audio turned off on all my devices. What helps...
    • Subtitles. I turn the closed captions on for every YouTube video, even though most of them are autogenerated. The autogenerated ones are sometimes hilariously bad--I just watched an episode of The Canadian Baking Show with 10 different spellings of "croquembouche", including "pro-kombucha"--but they are still way better than no subtitles. 
Thank you to the websites that enable me to be both a nursing mother and a web user! Let's keep trying to make the web a more accessible place for everyone.


Sunday, May 22, 2022

My experience as a Unit-18 Berkeley Lecturer

From spring 2021 through spring 2022, I was a Unit-18 Lecturer for UC Berkeley in the EECS department. A Unit-18 lecturer is what is often called "adjunct"; it's not on a tenure track, isn't part of the "Academic Senate", and it's represented by a union. Since I don't have a PhD, I am not eligible for tenure-track lecturer roles at UC Berkeley.

Here's a high level overview of my 1.5 years at Cal, both in terms of courseload and "lifeload":



I include my lifeload above as I imagine my experience may have been different if I didn't have a young child to support financially and to care for in the evenings/weekends.


Here are my reflections on the various aspects of being a Unit-18 lecturer. I am grateful for the experience, as I've learned a lot, but alas, there were more negatives than positives in the end. I will be going back to industry, but perhaps one day will return to academia when it's a better fit.


Compensation: Too Low


My salary as a Unit-18 lecturer with a 100% appointment was about 100K annual compensation until our union's strike and new contract brought it to be about 107K. That compensation is technically for 9 months (since we "only work 9 months") but spread over 12 months.


That is the lowest salary I've had in quite a few years, especially since there is certainly work to be done over the summer/winter. There are also quite a few expenses to this job that I haven't had in tech jobs: parking fees ($118/month), meals ($15/day), A/V equipment for at-home Zoom instruction and in-campus hybrid instruction, snacks for staff events, etc. It's possible to ask for reimbursement for some of the latter costs, but I've had mixed success and have mostly stopped asking.


For comparison, if I were to take a software engineering job right now, I would earn a minimum of 160K (like at a startup with high equity) but more like 220K+. Plus sign-on bonus ($20-120K), stock options, annual performance bonus (10-40%), etc.


Courseload: Too High


Sp21: I actually found the courseload of my first semester at Berkeley quite reasonable. I co-taught CS61A along with Paul Hilfinger and co-taught CS302 with Dan Garcia. I had fortunately spent the month before starting at Berkeley going through the entire CS61A materials, so I felt prepared topic-wise. Hilfinger wanted to teach most of the lectures, so I instead focused my time on exam writing and other course improvements. That semester was also entirely over Zoom, which meant no commute time plus more compatibility with taking care of a 1.5 year old in the evenings. I was even able to attend staff meetings with my daughter napping on me.


Fa21: That semester was brutal. I co-taught CS61A with John Denero and CS169A with Michael Ball. This time, I gave all the 61A lectures, so I had quite a lot of lecture prep to do, ~6 hours per lecture. Fortunately, John wrote the exams so that was off my plate. I found it really difficult to balance CS61A (a massive class of 2000) with CS169A (still a fairly large class of 350), since 169A required a fair bit of work in writing quizzes/exams (5 quizzes, 1 exam), grading open-ended homework assignments, and staff management. I was also new to CS169A, so I was trying to go through the assignments before giving them to students, and that takes a lot of time.


On top of it all, I was also in my first trimester of pregnancy, experiencing the most fatigue and nausea I've ever had in my life, so it was difficult to force myself to stay up late to get everything done.


Sp22: Somehow still a pretty rough semester. I solo taught CS61A, co-taught CS169L (30 students) and co taught CS302 (30 students). I fortunately had the majority of my lectures prepped for CS61A, but I was admittedly eager to try out some course changes, especially since we'd received funding for a particular change that we'd been working on since the summer. Implementing changes in a course significantly increases the time required for new lectures, new assignments, TA training, support, etc. I found it hard to balance CS61A with CS169L and CS302, plus all the random other committees and commitments I'd picked up in the last year, especially on days where all of them suddenly had urgent things that needed doing. There were many nights where I thought to myself "I don't know how everything's going to get done by tomorrow, but somehow it will, please please I hope."


Generally, I think the workload formulas at UC Berkeley don't account for the many aspects of running a course. They consider the time required for lecture and office hours, but that is such a small aspect of everything involved. Many hours are required for staff management (given how large they can be!) and dealing with the increased number of edge cases that occur with large number of students (academic misconduct, Incompletes, extensions, incidents, etc). I think that teaching a massive course like CS61A, with perhaps 1 small course like CS302, should count as a 100% appointment. Otherwise, when faculty members are forced to take on too many courses, we often have to skimp on aspects, such as staff management or assignment refinement, and that skimping can have significant negative effects.



But You Get Winter/Summer Off!


Hahaha, no.


First of all, there is actually work that needs to be done during the summer. CS61A needs to hire 100 staff members for each fall semester, and it takes a long time to go through all the applications and determine which 100 people to hire, conduct interviews, contact references, etc. In theory, we were supposed to finish hiring by early June, but it just wasn't possible to hire that many people so quickly. 


Besides hiring, there's also preparatory work to do for the next semester, like if you're teaching a new course, since there's often no time allocated for that during the semester.


There's also grading that happens in the winter. Sadly, for CS169A, grading took so much time that we had to request an extension and then we stayed up til 1am on New Years Eve calculating the final grades and submitting them. Happy New Years! Resolution: Never do that again! 


But the real issue with the summer/winters is that my compensation as a Unit-18 lecturer was so low that I could not afford to not work at all during them. My bank account actually nearly went to $0 last summer, which hadn't happened to me since… college? I ended up taking on various curriculum/teaching gigs during the summer which paid some, but the payment came months later. I perhaps should have taken on software engineering consulting instead, which likely would have paid higher and sooner.


In the winter, I developed an online course for a company that would pay me based on the number of students that took the course each offering. The first cohort turned out to be small, so that didn't work out great for this year, but future cohorts may be larger, so the time investment may eventually be worth it.


If I was earning a higher base salary, then I perhaps could fully relax during the summer, as is rumored to be possible as a professor, but Unit-18 salaries put that dream farther out of reach.


Also, notably: I really couldn't take any vacation at all during the fall/spring semesters, whereas I could take a vacation every few months if I worked in tech. So I'm not sure how much it's really worth it if you have to go so hard for 9 months with no breaks in order to get those few months off. I think I'd prefer more breaks scattered throughout the year.


*Yes, there's a spring break, but I had to use that to prep lectures for the rest of the semester, due to a lot of overlapping deadlines in the post-spring-break weeks.


Benefits?: Health Insurance


My first lecturer appointment was only for a single semester (which may be standard practice?), and it meant I was only eligible for catastrophic insurance during that time. The HR officer advised me to get other insurance if I could, but my COBRA would have been $1500 per month, and I’m not married to my partner, so I stuck with the catastrophic insurance and just tried very hard to not get sick/injured. 


Unfortunately, I did have a medical issue at the very end of those 6 months, and ended up in a limbo for a few weeks between catastrophic insurance ending and comprehensive insurance kicking in, and I just constantly called an emergency nurse line for reassurance that I wasn’t dying. Finally, Kaiser kicked in and I was able to recover.


The Kaiser insurance plan is similar to what I've had in the past at tech companies, which I think is a good level of health insurance. I would have just appreciated it earlier :)


Benefits?: Maternity Leave


The maternity leave benefits for Unit-18 lecturers are not great. When I had my first baby while working in the tech industry, I got 4 months fully paid leave, no questions asked. At Berkeley, when I realized I was pregnant with a second baby due June 3rd, I had to do a lot of asking around to see how much leave I would be eligible for. I think it turned out to be  around 10 weeks, but since it would have been during the summer months anyway (during which Unit-18 lecturers receive payment already), HR suggested not going through the effort to formally go on leave. 


I also discovered I was eligible for "Active Service Modified Duty", which meant I could request a modification to my typical lecturing duties in the fall semester, as long as the department approved. I ended up requesting a semester where my only course would be solo instruction of 61A, but I would also do preparatory work for next semester's first time teaching CS160, plus writing the spring 61A exams and working on a few new 61A projects. Such a semester certainly would have been a lower workload than a semester teaching 3 courses, so I appreciate the chairs for approving it, but would still have been rough to balance with having a nursing 3 month old. 


Okay, But Teaching Is Fun?!


There are indeed many aspects of teaching that are very interesting intellectually and quite fun. What I love:


  • Lecturing. I like trying to figure out how to present something in a way that makes sense. Granted, I don't always succeed, but it's interesting to see when an attempt fails, too. I also love the questions that students ask, since it prompts me to learn something more deeply.

  • Assignments. Similarly, it's interesting to figure out assignments that will help students learn a particular topic. TAs often do a lot of assignment creation, at least in 61A, but I like working with them on that.

  • Autonomy. Probably the greatest park of academia is that we do get a fair bit of free rein as lecturers. If I want to experiment with a slightly different topic ordering or even a new topic, then I don't need to request permission from anyone above me. I do need to get staff on board and make sure they're comfortable with it, since they'll need to teach that in their sections, but that feels very different from the top-down decision making that often happens in tech.


However, there are also aspects of university teaching that are not that fun (to me), such as:


  • Academic Misconduct. I'm so sad when we discover students cheat. But we do need to look out for cheating, since it's unfair to students that aren't cheating if other students are freely allowed to cheat. 

  • Grading. Unfortunately, grades really do mean a lot at Berkeley, especially for CS61A, since L&S students must get a 3.3 average GPA in 61A/61B/70 in order to declare CS. Even a few points out of 300 can make a difference to someone's final grade and thus their ability to declare, so we get a lot of regrade requests throughout the semester. I've had some 20-email-long threads entirely about just 2 points. I totally get why students care about 2 points, since there's that dang GPA cap, but I still find it exhausting to reason about why one student should get 2 points and not another student. My best approach has to just been as consistent as possible, which often means erring on the side of being less generous.

  • Staff management. It's hard. I've done people management at various times in my life, but it's difficult to do it well while also trying to do many other aspects of teaching. I don't think I've done it particularly well in my time here. Part of that is never having managed undergraduate TAs, part of that is lack of time in being able to do mentoring, check-ins, etc. 

  • Service. There's this thing in academia called "service" referring to things like serving on committees. I believe it's viewed favorably for tenure-track faculty members when tenure is being decided, but for Unit-18 lectures, it mostly feels like unpaid labor. Some of the committees do discuss interesting topics and make important decisions, but I think Unit-18 lecturers should be paid more if that is going to be a part of our job, since we already have higher teaching loads than normal faculty.

  • Faculty Hierarchy. Unit-18 lecturers are very low down on the totem pole in terms of the classes of faculty members at the university. My first semester, I wasn't allowed on any of the faculty mailing lists. I'm still only a few of them, and I'll hear every so often about discussions that happen on the "real" faculty lists. There are also some faculty meetings we aren't allowed to join, like particular hiring discussions. It's not even that I want to be involved with all of these things; but it does start to feel bad when you realize increasingly how much you're excuded from.


I want to thank those at Berkeley who helped me get the lecturer position, as I've always been very eager to try out university lecturing. I hope that one day I may return as a lecturer at Berkeley or elsewhere, once it's a better fit for my financial and caretaking needs. In the meantime, I've decided to share my experience for others who are considering pursuing the same or similar roles.