« All Episodes

Write the Code You Wish You Had

Published 5/18/2018

How do you write beautiful code? This is an age-old question for developers and in today's episode, we're going to talk about different techniques to come out of a coding session feeling confident and happy with your work.

Thanks to today's Sponsor: Bitrise

If you're looking for an automatic platform and configuration detection, to build, test & deploy in minutes check out Bitrise. They've got an open source library of 170+ integrations, and the best part there's no scripting needed! Run the same config locally with the open source CLI by downloading the bitrise.yml

If you're looking for a job, they're hiring tooling & dev-Ops engineers at their Budapest office

Get in touch

If you have questions about today's episode, want to start a conversation about today's topic or just want to let us know if you found this episode valuable I encourage you to join the conversation or start your own on our community platform Spectrum.chat/specfm/developer-tea

🧡 Leave a Review

If you're enjoying the show and want to support the content head over to iTunes and leave a review! It helps other developers discover the show and keep us focused on what matters to you.

Transcript (Generated by OpenAI Whisper)
How do you write beautiful code? This is an age-old question for developers, and it's one that's a little bit difficult to answer. People have different opinions of this. Some people say that code is like poetry. In today's episode, I'm going to give you a very simple technique to come out on the other side of your coding session. Happy with your code. My name is Jonathan Cutrell and you're listening to Developer Tea. My goal in the show is to help driven developers connect to their career purpose and to help them do better work so they can have a positive influence on the people around them. In today's episode, we are talking about writing beautiful code. What is beautiful code? Well, it kind of comes down to what you consider to be beautiful, but overall, most people would agree that beautiful code has nothing to do necessarily with the aesthetics of the code, although that is something to be considered. For example, beautiful code probably is not heavily indented. And so what we can do to help us define beautiful code is explain some of the things that it isn't. Beautiful code doesn't have one letter variable names. Beautiful code is understandable and it's explainable. As a byproduct, beautiful code happens to also be easily testable. Beautiful code may be insightful, but it's not necessarily clever. It's not necessarily tricky. So how can we arrive at this place whenever we're writing our code? We're going to talk about that right after we talk about today's sponsor, BitRise. BitRise is continuous integration and delivery for mobile for your whole team. They have dozens of integrations with your favorite service. So we're talking about writing beautiful code, but I want you to imagine a beautiful, continuous integration process. What does that look like? What buttons would you want to push and automatically have these five to ten steps or however many steps that you take to actually deliver your product into the App Store, for example? Wouldn't it be nice if you could just string all of those things together, those repetitive processes that you always run through? Well, that's exactly what you can do with BitRise. And not only can you do that easily with BitRise, but you can do it in a visual format. You don't have to string those services together yourself. It's not like an API system. It's a beautiful UI that allows you to piece together the parts of your continuous integration and delivery and not only that, but you can share it with your whole team. You can also run it locally by using the BitRise.eml file. There's tons of awesome integrations, by the way. Not only does it integrate with your most common services like, for example, if you wanted to receive a Slack message, you can do that, of course, with BitRise, but you can also do lower-level operations. For example, let's say that you want to implement an Armageddon backup plan where every release that you send out, you also FTP up a version of that release to some secure server. Well, with BitRise, you can do that. You can FTP as part of your BitRise workflow. You can even run shell scripts. So what this means is, even though they have 170 integrations, if for whatever reason, there's one that's missing, and not only can you submit that to BitRise's team, but you can also integrate with whatever services you want to with your own code. Go and check it out. Spekt out of them. Slash, BitRise. Thank you again to BitRise for sponsoring today's episode of Developer Tea. So we're talking about writing beautiful code. We've talked a little bit about what it is. We've seen beautiful code, and even though there is some subjective nature to this, we can agree on some of the common aspects. How do we get there? How can we actually write code that we love? Well, that's exactly the answer as it turns out. So often, we write code as a process of discovery. We try to figure out what we need to do rather than telling the code how we want it to look. So here's a phrase I want you to adopt. And this is how you're going to write code that you love. First of all, you have to adopt this mindset that you're going to write code that you love first, and then make it work. But here's the phrase, wouldn't it be nice if it's that simple? Wouldn't it be nice if what you'll often find is that you'll end that question by saying, wouldn't it be nice if I could just call a merge method on this array rather than writing all of the imperative code to do the merging? Or wouldn't it be nice if I didn't have to worry about all of this application state in the middle of this kind of logic code? And when you start asking these questions, you're identifying ways of making a code better. Because yes, indeed, it would be nice. It would be nice if there are methods to use that are doing things that you're actually writing imperatively. So these are instructions that you're giving yourself. When you say, wouldn't it be nice if you're providing yourself instructions for writing beautiful code? Other examples. Wouldn't it be nice if I could reuse this piece of code in five other places in this project? Wouldn't it be nice if I didn't have to write 10 lines of code to accomplish this thing because I could really can say it in two lines of code? I can really explain it very easily, but the code to do it is a lot longer. Wouldn't it be nice if I didn't have to write that code? What this does is it provides you again with a roadmap for code that you can write so that in the future, when you ask that question, man, wouldn't it be nice? Now you have the solution. Now you have the opportunity to write that beautiful code once again. Thank you so much for listening to today's episode of Developer Tea.I. Hope you start asking yourself this question as you're writing your code. Don't worry so much about it working right away. Instead write the code that you want. By the way, this idea didn't originate with me, but unfortunately in my quick searching I couldn't find who it originated with. Although I have a hunch that it probably originated with Avd Grim, the Rubyist behind Ruby Topas. I encourage you to go and check that out, Rubytopas.com. Thank you so much for listening to today's episode. Thank you again to BitRise for sponsoring today's episode. With BitRise you can use a workflow editor to piece together the perfect mobile continuous integration and delivery automation that you can share with your team. Go and check it out, spec that FM slash bitRise. Thanks again for listening to today's episode of Developer Tea.I. It's very easy to miss out on these episodes. If you are not subscribed, you're almost certainly going to miss out. Now if you have found any value in this episode or in previous episodes of Developer Tea, and you don't want to miss out on that same level of value or perhaps even greater value in the future, then I encourage you to subscribe and whatever podcasting app you use right now. Thanks for listening and until next time, enjoy your tea.