Low (Human) Memory Computing
When programming, we often discuss the amount of memory a program will use, but we often ignore a much more finite resource … human memory. People can only keep a few things in our heads at once and our memories are pretty fallible. By using some tools and conventions, we can add a new member to our dev teams that will let us write code faster and with fewer errors.
Strongly Type Languages
The difference between getting a lot of help from your editor/compiler and getting almost none is pretty striking. I know
substring function, but do I want
substring? Saving a trip to google several times a day can really add up. Switching from
Typescript gives you a compiler and editor that will give you a smart team member. That smart team member can:
- Tell you when your code doesn’t make sense
- Rename functions and variables for you
- Tell you what arguments a function takes
- Find all the usages of a function
Typescript is the easiest jump to strong typing and a strong editor that I have seen. If you are writing something besides
Clojure all have a concept of static or destructured imports. Avoid these when programming with a low memory mind. Change your imports from:
Now your source code will show where your code came from (either the file you’re in or another one). When you type
/ your editor can show you the other functions in the import. Chances are you are going to need more than one.
When your team learns something you’ve been doing is going to cause problems, you can either do nothing, write some documention, or write a convention test. A convention test is a kind of automated test that can check your source code for issues and let you know how to fix them. Turn what your team learned into a test that will steer your developers away from issues. Here are a few examples:
Java.util.HashMap, it can cause infinite loops
returna call to
Promise.rejectto avoid executing the wrong code
- If a function has
asyncmake sure it also has
- Migrations need to have the initials of a DBA in the commit
Creating a set of conventions tests gives your team an extra member that has much better memory than you do.
Programming tools are created to help us, when using these amazing tools keep an eye out for when they can help keep your cognitive load down. You can stop remembering so many things and can focus on getting your work done.