A big part of writing great code is the series of “aha!” moments we have on the job that teach us to solve problems faster and more effectively. For engineers that are just starting out, getting a head start on those inflection points never hurts. So from one engineer to another, here are some learnings and hacks I’ve collected over the past few years on everything from the dangers of abstracting to why we should all be rubber duckies from time to time.

Ask For Feedback Early

Try to get feedback on code as soon as it makes sense. If you're working on a Pull Request flow like we do at HubSpot, make a trivial change just so you can open the PR and have a place to discuss design and code. It's faster and takes less energy to iterate on prototypes than a 'finished' product. Depending on how your team is structured, getting immediate feedback might not mean writing code at all. Mockups, whiteboard wireframes, and sketches are a lot cheaper to throw out than hundreds of lines of code.

 

Be a Rubber Ducky, Find a Rubber Ducky

Have you ever talked to someone about a problem and realized the solution as you were describing it? In these situations, the person you’re talking to is a real life rubber ducky. Thinking out loud gives you clarity around a problem so everyone on your team should be open to being a sounding board, including you. Having rubber duckies to lean on will help your team work through problems faster and move on to the next challenge.

 

Get End-to-End First

When working on a new problem or feature, it's easy to dive right into the nitty gritty details. Instead, I've found it’s better to get end-to-end as quickly as possible (or alternatively, to a "Hello, world!"). For example, say you need a user click on a web page to trigger a complicated calculation and then save some results to a server. It’s tempting to jump right into figuring out the meaty calculation. A better approach is to set up the event handler for the user action, mock the calculation with some fixed values, and then fire the API request to the server. That way, you can test the system end-to-end before working out every detail and there’s a feedback loop to help you iterate and code faster. The design might not be perfect at first but by seeing how the pieces fit together, you get a clearer picture of the full system you're trying to design.

We take this concept even further with HubSpot's development process by pushing features to production before they're even finished so that we can test them internally. Our gating infrastructure makes this possible, but more on that another time.

 

Step Away From the Keyboard

Sometimes putting in debuggers, console.logging everywhere, and just bashing at the keyboard is a good way to test code. Other times, when you're having a tough time managing a complex design or problem, you need to stop looking at your screen. I’ve come up with solutions and have had some of my best insights in the bathroom. Silly, but true. My wife, who’s also a software engineer, does her best thinking when she’s falling asleep. (HubSpot actually has a nap room for that reason.) So get some rest, go for a walk, or read a book. Just find ways to think away from your computer.

 

Automate To Get More Done

It's not a secret that efficient developers automate many of their tedious processes. But there’s a common misconception about automation that it's only about saving time. While that’s one important benefit, automation gives you the chance to chase a train of uninterrupted thought and increases the likelihood that a task will actually get done.

For example, say there was a long, complex SQL query you needed to run frequently to get some metrics. You’d be much less inclined to run the query if you had to type it every time. But if you saved the query on your clipboard using a program like Alfred, or somewhere else that’s easy to access, you’d probably run the query often instead of putting it off. Automation doesn’t just help us get tasks done faster, it helps us get them done when we otherwise might have avoided them altogether.

 

You Can DRY Off Later

It's tempting to write perfect code and figure out every abstraction when you're designing new code. But abstractions can be dangerous. They can slow you down on a new project, even when they seem obvious and easy to design. So rather than abstract right away I simply copy and paste large chunks of code while I’m prototyping. It helps me move quicker at the start of a new project and usually reveals better abstractions and concerns than I would have discovered on a piece of paper or whiteboard. The caveat though is that you actually have to clean up the code before it rots.

 

Stay Active

Coding doesn't burn too many calories so it's important to force yourself to stay active. Get a good stretch in a few times a day and walk around from time to time. We have a push-up club at HubSpot that does push-ups together before lunch three days a week. It helps to keep the blood flowing throughout the day.   

Sitting for long periods of time causes a lot of developers (myself included) back and shoulder pain. If you have this problem I strongly suggest trying a standing desk. We have motorized desks here that switch between standing and sitting height, and I bought a cheap standing desk on Craigslist for those work from home days. Anyone who works at a desk most of the day should prioritize staying active in one way or another.

 

Read Ahead

Reading documentation, technical articles, and code can be confusing and maddening. Before flailing your arms and scratching your head, read ahead and get more context. Programming concepts are difficult to express in a linear form but by jumping ahead you can get a better handle on what a previous sentence or code snippet is talking about.

 

Take Meticulous Notes

This tip might not jibe with the less organized devs out there. I take detailed notes in Evernote every day about what I worked on, the problems I encountered, and how I solved them. Setting aside time daily, or even weekly, to write a quick status update will help organize your thoughts so that you can revisit them in the future. These notes are invaluable when you're facing a problem you’ve solved before but can’t quite remember how. They also have the added benefit of making it easy to recall your accomplishments next time a performance review or 1-on-1 with your manager or comes around.

 

Plan for Tomorrow, Today

Finally, before going home for the day or when you get home at night, make a to-do list of everything you’ll try to accomplish the next day. That way, when you get to work in the morning, you’re focused and have a clear agenda to hit the ground running with. Personally, getting a good, productive start to the day often sets the right tone for the rest of the morning and afternoon.

What lessons and hacks have helped you become a better engineer? Share your advice in the comments below or tweet us at @HubSpotDev.  

 

Recommended Articles

Join our subscribers

Sign up here and we'll keep you updated on the latest in product, UX, and engineering from HubSpot.

Subscribe to the newsletter