Efficiency tips and tricks for coding newbies

PivotHQ
4 min readOct 24, 2022

Disclaimer: All of these tips and tricks are assuming you’re on a Mac and are using VSCode.

If I have a dollar for every time a bootcamp student tells me they didn’t have time to do xyz, I’d buy a Steam Deck to de-stress. Many students feel pressured to finish their program ASAP for various reasons. Some are on monthly payment plans, and some think the faster they complete the program, the sooner they’d find a job. Whatever the reason is, Most students choose to take shortcuts to stay afloat. Sometimes this means submitting solution code just to move along or submitting spaghetti 🍝 code that’s made up of 20% of every StackOverflow answer.

After over six hundred conversations, I’ve seen students spend so much time scrolling through their unorganized files to search for some functions they wrote the night before. After 10s of them not being able to find it, I generally ask them “Why don’t you just cmd + F or cmd + shift + F?” More often than not, you could tell many of these students have never done this before ✊. This means they’ve been wasting however many hours on something as simple as navigating a project, which is heartbreaking!

Another thing that drives me, and would anyone who reads and writes code, insane is when students show up with unformatted code like the snippet below.

function doSomething(a){if (a === True){console.log(‘do something’)
}else if{
print(‘do something else’)} else{
return;
}
}

As a beginner, it’s already hard enough to read good code, I can’t imagine how hard it is to read something like this.

The list of these inefficiencies continues. This article is meant to help you find an extra few hours a week by optimizing your workflow/habits. This is by no mean an exhaustive list, so please do reach out to us with your tips, we’d be happy to make any addition 🙏

Terminal — Why drag and click your mouse in the dreadful file explorer/finder when you can type everything?

  1. Navigate around and deal with files/directories
  • Find out where you are: pwd
  • Move around: cd
  • Create a new file: touch
  • Create a new directory: mkdir
  • Copy files: cp
  • Move files: mv
  • Delete files or directories: rm
  • Download files found at specific URLs: curl
  • Search for fragments of text inside larger bodies of text: grep
  • View a file’s content: less, cat

MDN has an awesome write-up with examples that you should check out.

2. Terminal history autocomplete

You know you used a command last week to activate a virtual environment, but can’t remember how it goes? You could key up repeatedly until you find it, or if you remember some part of the command ctrl + r then type your search string and hit enter when you find the correct command.

If you use Zsh, this tool is very nice because you don’t have to do a manual reverse-search. Never re-type any command in full again!

VSCode

  1. Format the current file — shift + option + f

Never find yourself manually indenting code again

2. Format on save

Or better yet, have your code formatted upon saving and never use the shortcut above on individual files 😃

  • cmd + shift + p to open Command Palette.
  • Type and select Preferences: Open Settings (JSON)
  • Add "editor.formatOnSave:true"
  • Save settings.json and go on to your merry way

3. Quick open— cmd + p

Stop scrolling through your explorer aimlessly. If you know some part of the file name, type the file name and hit enter to switch files.

4. Multi-cursor

Ever had to edit the name of a variable that’s scattered throughout the entire file? Try selecting the first instance of the variable (could be any contiguous block of code) and do cmd + d to select the next occurrence. VSCode doc has a pretty cool guide here.

VSCode multi-select

5. Who wrote this code?!

Ever wonder who wrote certain lines of code, when, and why? Install the GitLens extension to find out. More details and instructions here if you have never installed a VSCode extension before

Gitlens annotation

That’s it for now. Happy coding 💻!

--

--

PivotHQ

Specialized content for coding bootcamp students. Behind every career change, there is a team of people who helped along the way. We hope to be a part of yours.