Short Row Wrapping

Short rows are this little magic thing that you can do in hand knitting where you knit a row over only some of the stitches to create a piece of fabric that is longer in one part than in another, and also when coordinated correctly a sequence of short rows can cause the fabric to curve and bend. It's makes things possible in hand knitting that aren't at all possible using other textile process, because you're creating a piece of fabric that is a custom shape in three dimensions. Short rows appear for lots of reasons: dropping the bottom edge of the sweater, sloping the shoulders of a sweater, forming a top-down-sleeve cap, or to turn a sock heel, for example.

The problem with short rows, is that it can be quite difficult to hide them in an existing fabric, because there's a little gap or hole where the short row starts. Solving this little problem has given rise to an entire discipline of knitting techniques. Most of the time, after knitting a short row, you "wrap" the next stitch, which you slip and move the yearn around, as the basis of a transition. This anchors the yarn from the short row, and helps reduces an awkward effect on the stitches that you knit.

The problem is that the "wrap" is (often) visiable in your knitting, so that's in ideal. The options are:

  • in garter stitch the best thing to do is to just ignore the wrap. If the tension of the wrap itself is right, the wrap doesn't look out of place, and you can just ignore it.
  • most of the time you want to "process" the wraps, by picking up the wrap and knitting it together with the (now formerly) wrapped stitch. Getting the tension on this is quite hard, though you can twist the wrap or clean things up in the next row most of the time. If you're having trouble with wrapping:
    • consider wrapping in the other direction. So that you move the yarn to the front of the piece before or after slipping the stitch, depending on what you're presently doing. In my practice, wrapping front to back is slightly tighter than wrapping back to front, but I think this depends on your hands a bit.
    • rather than wrapping the stitch, a small yarn over can serve the same purpose, as long as you're sure to knit the yarn over with the stitch that was not part of the short row. Use this if your wraps are too tight.
  • for sock heels, and in some other situations, you can skip the wrap, but slip the first stitch of the short row and decease the short sliped stitch into the next (non-short row) stitch on the next row. This works only in situations where you can stand to decrease 1 stitch for every short row turn.
  • Some folks enjoy not processing the wraps, in situations where you're knitting a sleeve cap off from the shoulder down in a sweater. You can see the wraps, but because you're doing lots of sequential short rows, it looks like a pattern.

The Org Mode Product

As a degenerate emacs user, as it were, I have of course used org-mode a lot, and indeed it's probably the mode I end up doing a huge amount of my editing in, because it's great with text and I end up writing a lot of text. I'm not, really, an org mode user in the sense that it's not the system or tool that I use to stay organized, and I haven't really done much development of my own tooling or process around using orgmode to handle document production, and honestly, most of the time I use reStructuredText as my preferred lightweight markup language.

I was thinking, though, as I was pondering ox-leanpub, what even is org-mode trying to do and what the hell would a product manager do, if faced with org-mode.

In some ways, I think it sucks the air out of the fun of hacking on things like emacs to bring all of the "professionalization of making software" to things like org-mode, and please trust that this meant with a lot of affection for org-mode: this is meant as a thought experiment.


Org has a lot going on:

  • it provides a set of compelling tools for interacting with hierarchical human-language documents.
  • it's a document markup and structure system,
  • the table editing features are, given the ability to write formula in lisp, basically a spreadsheet.
  • it's a literate programming environment, (babel)
  • it's a document preparation system, (ox)
  • it's a task manager, (agenda)
  • it's a time tracking system,
  • it even has pretty extensive calendar management tools.

Perhaps the thing that's most exciting about org-mode is that it provides functionality for all of these kinds of tasks in a single product so you don't have to bounce between lots of different tools to do all of these things.

It's got most of the "office" suite covered, and I think (particularly for new people, but also for people like me,) it's not clear why I would want my task system, my notes system, and my document preparation system to all have their data intermingled in the same set of files. The feeling is a bit unfocused.

The reason for this, historically makes sense: org-mode grew out of technically minded academics who were mostly using it as a way of preparing papers, and who end up being responsible for a lot of structuring their own time/work, but who do most of their work alone. With this kind of user story in mind, the gestalt of org-mode really comes together as a product, but otherwise it's definitely a bit all over the place.

I don't think this is bad, and particularly given its history, it's easy to understand why things are the way they are, but I think that it is useful to take a step back and think about the workflow that org supports and inspires, while also not forgetting the kinds of workflows that it precludes, and the ways that org, itself, can create a lot of conceptual overhead.

There are also some gaps, in org, as a product, which I think grow out of this history, and I think there are

They are, to my mind:

  • importing data, and bidirectional sync. These are really hard problems, and there've been some decent projects over the years to help get data into org, I think org-trello is the best example I can think about, but it can be a little dodgy, and the "import story" pales in comparison to the export story. It would be great if:
    • you could use the org interface to interact with and manipulate data that isn't actually in org-files, or at least where the system-of-record for the data isn't org. Google docs? Files in other formats?
  • collaborating with other people. Org-mode files tend to cope really poorly with multiple people editing them at the same time (asynchronously as with git,) and also in cases where not-everyone uses org-mode. One of the side effects of having the implementation of org-features so deeply tied to the structure of text in the org-format, it becomes hard to interact with org-data outside of emacs (again, you can understand why this happens, and it's indeed very lispy,), which means you have to use emacs and use org if you want to collaborate on projects that use org.
    • this might look like some kind of different diff-drivers for git, in addition to some other more novel tools.
    • bi-directional sync might also help with this issue.
  • beyond the agenda, building a story for content that spans multiple-file. Because the files are hierarchical, and org provides a great deal of taxonomic indexing features, you really never need more than one org-file forever, but it's also kind of wild to just keep everything in one file, so you end up with lots of org-files, and while the agenda provides a way to filter out the task and calendar data, it's sort of unclear how to mange multi-file systems for some of the other projects. It's also the case, that because you can inject some configuration at the file level, it can be easy to get stuck.
  • tools for interacting with org content without (interactive or apparent) emacs. While I love emacs as much as the next nerd, I tend to think that having a dependency on emacs is hard to stomach, particularly for collaborative efforts, (though with docker and the increasing size of various runtimes, this may be less relevant.) If it were trivially easy to write build processes that extracted or ran babel programs without needing to be running from within emacs? What if there were an org-export CLI tool?

Docker Isn't A Build System

I can't quite decide if this title is ironic or not. I've been trying really hard to not be a build system guy, and I think I'm succeeding--mostly--but sometimes things come back at us. I may still be smarting from people proposing "just using docker" to solve any number of pretty irrelevant problems.

The thing is that docker does help solve many build problems: before docker, you had to either write code that supported any possible execution environment. This was a lot of work, and was generally really annoying. Because docker provides a (potentially) really stable execution environment, it can make a lot of sense to do your building inside of a docker container, in the same way that folks often do builds in chroot environments (or at least did). Really containers are kind of super-chroots, and it's a great thing to be able to give your development team a common starting point for doing development work. This is cool.

It's also the case that Docker makes a lot of sense as a de facto standard distribution or deployment form, and in this way it's kind of a really fat binary. Maybe it's too big, maybe it's the wrong tool, maybe it's not perfect, but for a lot of applications they'll end up running in containers anyway, and treating a docker container like your executable format makes it possible to avoid running into issues that only appear in one (set) of environments.

At the same time, I think it's important to keep these use-cases separate: try to avoid using the same container for deploying that you use for development, or even for build systems. This is good because "running the [deployment] container" shouldn't build software, and it'll also limit the size of your production containers, and avoid unintentionally picking up dependencies. This is, of course, less clear in runtimes that don't have a strong "compiled artifacts" story, but is still possible.

There are some notes/caveats:

  • Dockerfiles are actually kind of build systems, and under the hood they're just snapshotting the diffs of the filesystem between each step. So they work best if you treat them like build systems: make the steps discrete and small, keep the stable deterministic things early in the build, and push the more ephemeral steps later in the build to prevent unnecessary rebuilding.
  • "Build in one container and deploy in another," requires moving artifacts between containers, or being able to run docker-in-docker, which are both possible but may be less obvious than some other workflows.
  • Docker's "build system qualities," can improve the noop and rebuild-performance of some operations (e.g. the amount of time to rebuild things if you've just built or only made small changes.) which can be a good measure of the friction that developers experience, because of the way that docker can share/cache between builds. This is often at the expense of making artifacts huge and at greatly expanding the amount of time that the operations can take. This might be a reasonable tradeoff to make, but it's still a tradeoff.

My Code Review Comments

I end up reviewing a lot of code, and while doing code review (and getting reviews) used to take up a lot of time, I think I've gotten better at doing reviews, and knowing what's important to comment on and what doesn't

  • The code review process is not there to discover bugs. Write tests to catch bugs, and use the code review process to learn about a specific change, and find things that are difficult to test for.
  • As yourself if something is difficult to follow, and comment on that. If you can't figure out what something is doing, or you have to read it more than once, then that's probably a problem.
  • Examine and comment on the naming of functions. Does the function appear to do what the name indicates.
  • Think about the interface of a piece code:
    • What's exported or public?
    • How many arguments do your functions take?
  • Look for any kind of shared state between functions, particularly data that's mutable or stored in globally accessable, or package local structures.
  • Focus your time on the production-facing, public code, and less on things like tests and private/un-exported APIs. While tests are important, and it's important that there's good test coverage (authors should use coverage tooling to check this), and efficient test execution, beyond this high level aspect, you can keep reading?
  • Put yourself in the shoes of someone who might need to debug this code and think about logging as well as error handling and reporting.
  • Push yourself and others to be able to get very small pieces of code reviewed at a time. Shorter reviews are easier to process and while it's annoying to break a logical component into a bunch of pieces, it's definitely worth it.

Sleeve Survey

I somehow managed to knit the body of a sweater in like 10 days, and am once again knitting sleeves. I also want to re-knit the cuffs of the last sweater, because I'm coming to terms with the fact that I'm not really happy with them, and my current plan is to knit the sleeves of my next sweater before knitting the body, which means I have a little bit of a queue for knitting sleeves.

In preparation I measured a lot of sleeves of sweaters that I've knitted (and still have, to try and figure out what I like. Here are my conclusions:

  • I realized that regardless of the shoulder shaping, the length of the sleeve should be basically the same. This is based on the assumption that the shoulder fits, and sometimes you can compensate for an illfitting shoulder by modifying the length of the sleeve, so take it with a grain of salt.
  • I've been measuring sleeves, on drop shouldered garments from the shoulder seam to the cuff, and for other shoulder shaping, from the underarm to the cuff.
  • I prefer sleeves that are a little bloused (e.g. bigger, with a more aggressive cuff,) because I like to wear sweaters over shirts, so having a bit more room makes things more comfortable. Also having floppy cuffs is not great.
  • The sweaters that I like the most, seem to have 21 inch sleeves total with 1-2 inch cuffs. I try and spread the decreases out, as evenly as possible. The cuffs seem to be between 8 and 9 inches around (ideally,) and shoulder apertures tend to be between 18 and 20 inches around.
  • I'm tentatively coming out in favor of knitting all sleeves from the shoulder down to the cuff, but I do want to give it a shot going the other way at least a couple of times before I'm definitive on that subject. When you knit the sleeves first of a sweater, the process of knitting the sleeve dictates the yoke of the sweater, which means if you're off a bit in the sleeve the whole sweater seems off. Knitting sleeves after the yoke, means you don't have to figure out the entire sweater when you're knitting the cuff.
  • Separating thinking about the sleeve cap from thinking about the sleeve, is conceptually useful (sleeve caps take a while, the process of knitting them in the round is different,) even if this doesn't make a lot of sense when you're actually knitting or thinking about a garment.

Values for Collaborative Codebases

After, my post on what I do for work I thought it'd be good to describe the kinds of things that make software easy to work on and collaborative. Here's the list:

  1. Minimal Documentation. As a former technical writer this is sort of painful, but most programning environments (e.g. languages) have idioms and patterns that you can follow for how to organize code, run tests and build artifacts. it's ok if your project has exceptional requirements that require you to break the rules in some way, but the conventions should be obvious and the justification for rule-breaking should be plain. If you adhere to convention, you don't need as much documentation. It's paradoxical, because better documentation is supposed to facilitate accessibility, but too much documentation is sometimes an indication that things are weird and hard.
  2. Make it Easy To Run. I'd argue that the most difficult (and frustrating) part of writing software is getting it to run everywhere that you might want it to run. Writing software that runs, even does what you want on your own comptuer is relatively, easy: making it work on someone else's computer is hard. One of the big advantages of developing software that runs as web apps means that you (mostly) get to control (and limit) where the software runs. Making it possible to easily run a piece of software on any computer it might reasonably run (e.g. developer's computers, user's computers and/or production environments.) Your software itself, should be responsible for managing this environment, to the greatest extent possible. This isn't to say that you need to use containers or some such, but having packaging and install scripts that use well understood idioms and tools (e.g. requirements.txt, virtualenv, makefiles, etc.) is good.
  3. Clear Dependencies. Software is all built upon other pieces of software, and the versions of those libraries are important to record, capture, and recreate. Now it's generally a good idea to update dependencies regularly so you can take advantage of improvements from upstream providers, but unless you regularly test against multiple versions of your dependencies (you don't), and can control all of your developer and production environments totally (you can't), then you should provide a single, centralized way of describing your dependencies. Typically strategies involve: vendoring dependencies, using lockfiles (requirements.txt and similar) or build system integration tends to help organize this aspect of a project.
  4. Automated Tests. Software requires some kind of testing to ensure that it has the intended behavior, and tests that can run quickly and automatically without requiring users to exercise the software manually is absolutely essential. Tests should run quickly, and it should be possible to run a small group of tests very quickly to support iterative development on a specific area of the code. Indeed, most software development can and should be oriented toward the experience of writing tests and exercising new features with tests above pretty much everything else. The best test suites exercise the code at many levels, ranging from very small unit tests to ensure the correct behavior of the functions and methods, to higher level tests that test the functionality of higher-order functions and methods, and full integration tests that test the entire system.
  5. Continuous Integration. Continuous integration system's are tools that support development and ensure that changes to a code pass a more extensive range of tests than are readily available to developers. CI systems are also useful for automating other aspects of a project (releases, performance testing, etc.) A well maintained CI environment provide the basis for commonality for larger projects with a larger number for projects larger groups of developers, and is all but required to ensure a well supported automated test system and well managed dependency.
  6. Files and Directories Make Sense. Code is just text in files, and software is just a lot of code. Different languages and frameworks have different expectations about how code is organized, but you should be able to have a basic understanding of the software and be able to browse the files, and be able to mostly understand what components are and how they relate to each other based on directory names, and should be able to (roughly) understand what's in a file and how the files relate to eachother based on their names. In this respect, shorter files, when possible are nice, are directory structures that have limited depth (wide and shallow,) though there are expections for some programming language.
  7. Isolate Components and Provide Internal APIs. Often when we talk about APIs we talk about the interface that users access our software, but larger systems have the same need for abstractions and interfaces internally that we expose for (programmatic) users. These APIs have different forms from public ones (sometimes,) but in general:
    • Safe APIs. The APIs should be easy to use and difficult to use incorrectly. This isn't just "make your API thread safe if your users are multithreaded," but also, reduce the possibility for unintended side effects, and avoid calling conventions that are easy to mistake: effects of ordering, positional arguments, larger numbers of arguments, and complicated state management.
    • Good API Ergonomics. The ergonomics of an API is somewhat ethereal, but it's clear when an API has good ergonomics: writing code that uses the API feels "native," it's easy to look at calling code and understand what's going on, and errors that make sense and are easy to handle. It's not simply enough for an API to be safe to use, but it should be straightforward and clear.

The One Page Brainstorm

For a few years, rather than really double down on some kind of electronic note taking and task management tool, I've mostly done that kind of work long hand, using pen a paper. I'm not great at using a pen to write, but it can be fun, and I quite enjoy the opportunity to take a step back, slow down, and focus on some brain work. I don't really have a system, as such, though I did read the bullet journal website and I guess I probably stole some of those ideas.

I definitely keep a pad on my desk that's some kind of loose idea of "things I want to get done today or in the next couple of days." Its less a "todo list," in the sense that it's not really an exhaustive list of everything that I need to get done, and I don't use so that I can write things down and then forget them, but more so that when I sit down at my desk, I can more quickly find something useful to do, and that every few days when look over the previous list, I can get a sense of what I've done (or not done.)

I also, and this is perhaps more interesting, have a notebook that's just for brainstorming. I've sort of intentionally selected "half-size" (e.g. 6.5" x 8.25") notebooks for this purpose. My routine is pretty simple: make a point of sitting down with a pen and a blank sheet of paper periodically and just brainstorming or writing about a topic. It's really easy to fill a page and often easy enough to fill the facing page with a bunch of ideas about whatever topic it is, usually something I'm writing but also sometimes code or another kind of project.

I think I developed this practice when writing fiction, which I don't seem to do much of, any more, (though I've been making notes for a couple of years so I suspect it'll happen,) but the idea is less to be systematic about the notes, or to collect them in ways that will be textually useful in the future, but more as a way of focusing and putting all or most of your attention on a problem for a few minutes. Often, though, the notes are useful, both because they force you to answer questions about what you're working on and can function as a creative jumpstart, both when doing work as a thing to review and also because sometimes once you start doing the mental work moving into actual work (typically for me, typing) becomes compelling. I suppose there is almost a meditative quality to the activity.

When thinking about writing fiction, the "write a half sized page full of notes" about an anecdote from a character, or a bit of worldbuilding, or a description of a plot progression (at any scale,) makes a lot of sense and use a useful exercise.


In some ways, I suppose, this is a little bit if a follow up to my Get More Done post, as one of the things I do help begin to make progress or make sure that it's easy to focus and have a clear idea of what to do when you're ready to write more formally.

How to Become a Self-Taught Programmer

i am a self taught programmer. i don't know that i'd recommend it to anyone else there are so many different curricula and training programs that are well tested and very efficacious. for lots of historical reasons, many programmers end up being all or mostly self taught: in the early days because programming was vocational and people learned on the job, then because people learned programming on their own before entering cs programs, and more recently because the demand for programmers (and rate of change) for the kinds of programming work that are in the most demand these days. and knowing that it's possible (and potentially cheaper) to teach yourself, it seems like a tempting option.

this post, then, is a collection of suggestions, guidelines, and pointers for anyone attempting to teach themselves to program:

  • focus on learning one thing (programming language and problem domain) at a time. there are so many different things you could learn, and people who know how to program seem to have an endless knowledge of different things. knowing one set of tools and one area (e.g. "web development in javascript," or "system administration in python,") gives you the framework to expand later, and the truth is that you'll be able to learn additional things more easily once you have a framework to build upon.

  • when learning something in programming, always start with a goal. have some piece of data that you want to explore or visualize, have a set of files that you want to organize, or something that you want to accomplish. learning how to program without a goal, means that you don't end up asking the kinds of questions that you need to form the right kinds of associations.

  • programming is all about learning different things: if you end up programming for long enough you'll end up learning different languages, and being able to pick up new things is the real skill.

  • being able to clearly capture what you were thinking when you write code is basically a programming super power.

  • programming is about understanding problems [1] abstractly and building abstractions around various kinds of problems. being able break apart these problems into smaller core issues, and thinking abstractly about the problem so that you can solve both the problem in front of you and also solve it in the future are crucial skills.

  • collect questions or curiosities as you encounter them, but don't feel like you have to understand everything, and use this to guide your background reading, but don't feel like you have to hunt down the answer to every term you hear or see that you don't already know immediately. if you're pretty rigorous about going back and looking things up, you'll get a pretty good base knowledge over time.

  • always think about the users of your software as you build, at every level. even if you're building software for your own use, think about the future version of yourself that will use that software, imagine that other people might use the interfaces and functions that you write and think about what assumptions they might bring to the table. think about the output that your program, script, or function produces, and how someone would interact with that output.

  • think about the function as the fundamental building block of your software. lower level forms (i.e. statements) are required, but functions are the unit where meaning is created in the context of a program. functions, or methods depending, take input (arguments, ususally, but sometimes also an object in the case of methods) and produce some output, sometimes with some kind of side-effect. the best functions:

    • clearly indicate side-effects when possible.
    • have a mechanism for reporting on error conditions (exceptions, return values,)
    • avoid dependencies on external state, beyond what is passed as arguments.
    • are as short as possible.
    • use names that clearly describe the behavior and operations of the function.

    if programming were human language (english,) you'd strive to construct functions that were simple sentences and not paragraph's, but also more than a couple of words/phrases, and you would want these sentences to be clear to understand with limited context. if you have good functions, interfaces are more clear and easier to use, code becomes easier to read and debug, and easier to test.

  • avoid being too weird. many programmers are total nerds, and you may be too, and that's ok, but it's easier to learn how to do something if there's prior art that you can learn from and copy. on a day-to-day basis, a lot of programming work is just doing something until you get stuck and then you google for the answer. If you're doing something weird--using a programming language that's less widely used, or in a problem space that is a bit out of mainstream, it can be harder to find answers to your problems.

Notes

[1]I use the term "problem" to cover both things like "connecting two components internally" and also more broadly "satisfying a requirement for users," and programming often includes both of these kinds of work.