« All Episodes

Automation: Creating Higher Order Functionality and Building an Automatic Schedule

Published 9/16/2015

Today's episode is a short discussion on automation. We'll explore some helpful ways to look at automation that help make it more than simply scripting repeatable steps.

Go to https://digitalocean.com to get started on cloud hosting. Use the promo code "DEVELOPER TEA" at the checkout after you create your account to get a $10 credit!

If you enjoyed this episode and want to know when the latest episode has gone live, subscribe to the podcast, and be sure to check out other podcasts and content on the network that makes this podcast possible: Spec.fm. Until next time,

Enjoy your tea

Transcript (Generated by OpenAI Whisper)
Hey everyone and welcome to Developer Tea. My name is Jonathan Cutrell and today I'm going to be talking to you about abstraction and automation and how you can use those in your work and in your life. If you've been a developer for very long at all, you've probably heard the term automation enough to make you sick. As you're probably aware, automation is the process of making something automatic. But the problem is as its developers, we often don't take advantage of building our own automation tools. We're usually building the automation tools for other people. And that is really what abstraction is. We're building abstractions of people's processes and that gives them the automation that they need to make their businesses more efficient. And is responsible for a lot of the efficiency gains that we've seen since, for example, the industrial revolution. We found ways of taking the processes of building things, for example, and putting them into machines that could build them faster and with more accuracy and more dependability than a human could. So that is really what automation came from. But today I want to give you a few tips and ideas to help spark your creativity and hopefully inspire you to create useful automated systems for yourself and maybe to share with other people on GitHub to help automate the things that you do every single day. Now the first tip is kind of an obvious one and it's really the basis for building automation in general. And that is notice the things that you do repetitively. The things that can be automated are the things that you do repetitively, the steps that you take repetitively. If you do it more than twice and you expect to do it again, automated. Now, there are different ways to automate these kinds of things and when I say these kinds of things, I mean, there are certain steps that you take with code that can be automated. For example, you could create a build script or perhaps you could create keyboard macros. Very simple idea for automation came about when we got autocomplete, when we got tab completion in our respective editors. So this idea of automating is you keep on writing the same word and the given file. Well now you should be able to press tab and automate the finishing part of that word, the final few letters of a given word. Another thing that developers do that can be automated is we spin up servers and today's sponsor happens to be digital ocean. We're going to talk about how you can spin up a server really quickly with digital ocean in just a little bit. So that's another thing we do. While you're spinning up a server, you can use a tool like chef or anzable to automate that process as well. But then there's also consumer level tools, applications that we can take advantage of. One that kind of straddles the line between the developer and the consumer level tool is Zapier. I'll include links in the show notes for these different services. But Zapier allows you to connect an API from one service to an API from another service. And when they otherwise wouldn't necessarily be connected without you having to write your own code, but Zapier has written all of the abstractions to allow you to connect those dots without having to write the code. Another example of a all the way on the other end of this spectrum, an example of a consumer level tool is if this than that, that's ift.t.com. If you aren't familiar with if this than that, it is a very powerful tool. It just takes a lot of the most popular applications that have open APIs and allows you to connect different actions between them. For example, you can connect your location on your phone to your, I don't know, your hue light bulbs so that when you're getting close to your house, you can turn on your hue light bulbs. Of course, there are more business oriented actions that you can take. For example, you can press a button on your phone to start recording time. If you're a freelancer, this could be a really easy way of putting entries in a time sheet, for example. I don't want to focus too hard on if this than that, but I wanted to give you just kind of a bonus tip. I have tt.t.t. they recently released their Maker channel, which allows you to send a post request to their service and trigger something as a result of that post request, which basically means that you can do something on your end for the triggering part. And on their end, they will respond by triggering a particular service. Go and check it out. It's a little bit hard to explain on air without going in more detail, but I recommend you check out if this than that and start thinking about the options that you have for automation using if this than that. So that's really the basis of understanding what to look out for in order to automate it. The things you do repetitively, especially if you've already done it more than twice and you expect to do it again, then you should consider automating it. This is kind of a general rule for automation and determining what things to automate. Now, it's important for you as the developer to determine the granularity of automation that you want to actually create for your tool. And as a general rule, I would recommend starting very broad and then going specific and then creating interfaces between your different automation tools. So this is the idea of having kind of a single responsibility for whatever tool you create and then allowing those tools to talk to each other. This is also similar to the Unix philosophy of limiting each tool you create to a single job and then allowing those tools to kind of collaborate to feed the output of whatever you have done with that tool into the next tool. And this brings me to my second point about automation or I guess suggestion and that is don't automate the details, only automate the steps and allow yourself the opportunity to configure the details. So for example, if you're a Rails developer, you've experienced the Rails generator and other frameworks have similar tools a lot of the time. But basically what the generator allows you to do is run something from the command line like Rails generate, scaffold or Rails generate model and then you pass in the details about that particular generated piece of code that you want to be available. For example, you could generate a post model with a title and a body and maybe you want to add tags to it. You could generate all these things using the same automation process but when you pass in your specific details that automated process can then take those details and run them through the steps. So the idea here is that you don't want to add the name of the model into the automation task because how many times do you want to generate that same exact model, probably only once. But you may want to generate multiple models for a given project and allowing your automation steps to be configurable to pass in the details makes it much more flexible, much more usable in the long term. So an easy way to think about this if you are writing a tool, for example, if you're writing a script, is to think about the things that you are setting as variables or that you're passing in as configurable options and consider making those configurable when you're actually executing that script. So now's a perfect time to talk about today's sponsor, Digital Ocean because we're talking about automation and taking out those time consuming tedious tasks and replacing them with an automated process. And that's exactly what Digital Ocean does for you. If you're looking to deploy a cloud server, you can deploy an SSD cloud server on Digital Ocean in 55 seconds. I know because I actually have done this before. You can actually do this for $5 a month too. That gets you 512 megabytes of RAM with a single CPU, 20 gigabytes of super fast solid state drive disk space, a terabyte worth of transfer. That's just $5 a month. Now if you use the code developer to you check out, you'll get $10 worth of credit, which is basically like getting two months for free. So go and check it out digital ocean.com. Don't forget the code developer to you at checkout. And of course, this all will be in the show notes. So let's continue on with number three in my third tip for you as you consider ways of automating things as a developer. And that is to view automation not as a series of steps, but rather as an abstraction to enable higher order leverage. I'm going to say that one more time. View automation not as a series of steps, but rather as an abstraction to enable you to perform higher order leverage. Now what does this mean? Well, automation shouldn't simply accomplish a few extra steps for you a little bit faster than you would accomplish them. It should instead enable you to do more powerful things. For example, I use gulp, gulp.js to automate my front end development build process. This allows me to do things like write in SCSS instead of plain old CSS and auto prefix the output code automatically. This also allows me to use new language features and JavaScript thanks to Babel, which is connected through Gulp. It even lents my code as I go along. So I get a report of what I've done improperly. I wouldn't get this normally, even if I was taking those steps myself, I would have to build that report myself. So having that report given to me automatically is a higher order of development for me. And at this level means that I can use new, better processes that give me more leverage as a programmer. It doesn't just speed up what I'm doing, it actually enhances it. And it gives me new features that I otherwise wouldn't even have. It is much more like an abstraction than a series of steps. It's much more like an abstraction than a shortcut. So I encourage you to look for automation tools that give you new features, that give you new ways of doing things rather than just making the old way a little bit faster. Okay, so number four, don't just apply automation at a code level, but consider how to automate your schedule and your personal behavior. So we've kind of jumped away from the technical aspects of automation now. Now when I talk to you a little bit about how this can apply to the way you think about your life to the way you think about your day-to-day actions. So this may sound a little weird at first, but let me break it down a little bit further. When automating with code, we make steps automatic so that they happen without much or any effort. We also provide these abstractions and higher order leverage to ourselves that we otherwise wouldn't have. So I want you to think about what steps you can take in your schedule so that the important things happen for you with less effort. This will leave energy for the things that need your effort the most. Automating your behavior is truly about learning how to form habits. I highly recommend checking out James Clear. You can find him at jamesclear.com, and of course this will be in the show notes, but I've talked about a few things on the show in the past from James Clear. One is the concept of habit stacking. If you have two or three small habits you want to build, you should do them all at the same time every day. For example, if you want to exercise and floss and eat a healthy breakfast, then do all three in a continuous routine together. Another simple idea I learned from James is the concept of the two-minute rule, which has two parts. The first part is if you come across something that needs to be done and it only takes two minutes or less to do, do it immediately. Now you might remember this. If you have read getting things done from David Allen, and that is where James Clear actually got it, but James adds a secondary part to the two-minute habit. That is, if you want to build a habit, start with the two-minute version of the habit. If you want to start refactoring your code, for example, spend two minutes each hour refactoring one small piece of that code. If you want to network with your coworkers a little bit more, spend two minutes when you get into the office and maybe two minutes at lunch, building a relationship with someone. If you want to try being more active every day, take two minutes and just put your workout clothes on. If you want to have a cleaner living space or a cleaner desk, take two minutes in the morning to make your bed, or two minutes at the end of the day to clean off all the trash that might have accumulated on your desk. Creating your behavior and your schedule definitely takes some energy. Certainly, just as it takes energy to create automation tools with code, but usually that energy is rewarded exponentially over time because those tools feed into your productivity and they feed into your ability to do other things more efficiently. It gives you the opportunity to spend your effort on things that truly need your effort. Now, what are a few other places automation can be useful in your life? There are some intersections between code or technology and habits. For example, you could put on yourself a few automated restrictions in your inbox or on your computer to keep you from being distracted on a day-to-day basis. For example, you might auto-file all of your social incoming emails. Go ahead and file those into a folder and never let them get in the way of the more important emails or the business-oriented emails for the day. You might use an app like I do called Focus, which disallows you from visiting sites that are distracting or otherwise unproductive for you. Of course, I have to recommend to you that you take a minute to go back and listen to the episode about forming defaults, useful defaults for yourself, so that you can start building habits based on default scheduling. So now that you have listened to this episode, I'm going to ask you to do something for me. I want to hear what your ideas are for automating different parts of your job and different parts of your life, whether they are entirely based on writing code to take steps for you or if you are looking to automate different ways of building habits. I would love to hear what your ideas are. Reach out to me on Twitter at Add Developer Teaor email me at Developer Tea at gmail.com. Thanks so much again to today's sponsored digital ocean. If you are looking to spin up an SSD cloud server in just 55 seconds, go to digitalocean.com and sign up, go ahead and spin up a server, use the code Developer Teaat checkout for $10 off that is basically like getting two months for free digitalocean.com. Thanks again to digitalocean. And thank you for listening to Developer Tea today. I appreciate every minute you spend with me on this show and I look forward to the next one and until next time, enjoy your tea.