1. Get a good architecture and plan the 1st time around. Laying out out a good structure and deployment strategy (DevOps) will not only make you code faster but will save you and your team a lot of headaches down the road when it comes to maintaining your software platform. Whether it’s just choosing frameworks or designing OOP systems (UML, interaction, & sequence diagrams) be decisive and stick with what makes best sense for you and your team. Many of these concepts extend even to JS world where you can use object composition, components, and DRY (Don’t Repeat Yourself) coding practices with your favorite single page app frameworks (i.e. ReactJS, ViewJS, AngularJS,). Failing to do this can cost less time on the frontend of things, but a significant amount later on in the project lifecycle.

2. Write out problems and solve the issue of “how” small programming issues will be developed beforehand. This is where pseudocode comes in handy.

Diagramming — Photo by Christina @ wocintechchat.com on Unsplash

I usually breakup my algorithms in terms of inputs, processes, and outputs. I know there is really no set way, but just writing out the general steps in plain english can be more beneficial than you would think. Several developers just start programming without a general idea and waste time causing things to break or not work as expected.

3. Finish the code using what you know and REFACTOR…REFACTOR….REFACTOR!!!!! Getting the piece of code just written will at least give you the ability to find time to go back and rethink a way you’ve done something. If you waste time by writing a small portion of the code and indecisively go back to modify a piece to work in another fashion you would of been better off writing the entire piece one way and then refactoring it all later. Also, writing code with techniques/frameworks you’ve already used in the past is a sure way to speed up your coding.

4. Do not write complicated code to show off your unworldly new/existing skillset…

“Programs must be written for people to read, and only incidentally for machines to execute.”
― Harold Abelson, Structure and Interpretation of Computer Programs

...
return listOfOperations.success.filter(v=>!!v).length 
 ? handleOtherOperation(state1)
 : secondListOfOperations.success.filter(v=>!!v).length
  ? handleOtherOperation(state2) 
  : void(0)

vs

...
if (listOfOperations.success.filter(v=>!!v).length) {
 return handleOtherOperation(state1);
} else if (secondListOfOperations.success.filter(v=>!!v).length) {
 return handleOtherOperation(state2);
}
return void(0);

Always use a linter to *force a style of general syntax to your and your team members code. Linters can be annoying at times, but your project leads can always add/remove rules. If you aren’t for sure what linters are, read this wiki article. It’s pretty much just a way for you to detect bugs and stylistic errors before they even occur through some pre-build setup.

5. Eliminate distractions & FOCUS. If you get distracted easy, go to a place where you don’t or use tools to block those distractions.

Photo by Jared Rice on Unsplash

There are several apps out there nowadays to help you overcome these hurdles. I personally go to my workplace with **only** work in mind and think by separating home from work that helps eliminate most of my distractions. FOCUS on the task at hand and get in the zone to work for long periods of time to be as productive as possible.

6. Understand what you’re doing. As I initially stated in the intro, having the capacity to write code faster will be based on your “knowledge”. It has little to do with your typing GWAM (Gross Words a Minute). Although, performing touch typing is a necessity for a programmer. My GWAM is 75–80 on average. Also, if you really want to dig into something new you don’t have to be an expert but reading the docs, watching tutorials, and going through example problems will set you up for the best success. Also, don’t be afraid to use/do something you don’t understand. My philosophy is if a human made it you’ll eventually be able to grasp the concept.

7. Code in timed sprints. I have made this one up on the fly and have been sticking with it.

Photo by MICHEL ANDRADE on Unsplash

I’ve noticed my daily productivity levels vary but self inducing time limits on my self helps me to stay focused on the tasks at hand. If you want to do this, I suggest you use a site like online-stopwatch.com, and attempt a 2 hour “mini-sprint”. I just set the timer and leave it going in a new tab, but you could easily just use the stopwatch on your phone with an alarm. Think of this like taking an exam, you have a set amount of time to do the task and it must be performed in that time. I also recommend actual code sprints that last 2–3 weeks for sets of tasks, since this is a proven SCRUM methodology.

8. Speaking of sprints, having caffeine to push you to “concentrate” will get you ready to solve problems at a much higher level than without it. I’ve experimented with this a lot and from my personal tests of drinking 1 cup of coffee a day vs. none I was able to crank out about 10%–20% more productivity. Also, according to an Baer from businessinsider.com, coffee/caffeine has these effects on productivity:

9. Pressure & Stress are great at helping you code faster. Although, micromanagement is not cool and will hurt you more than help you. These techniques are applied at most corporations and are “proven” to work.

Think about an approaching deadline, I bet you wrote code much faster the day before vs. the week before. Stress can be a powerful factor to help you perform better on any task.

10. Good setup and WRITING LESS CODE. Having a good ergonomic station will help you be *able to work long hours and use the tools necessary to write code faster than you ever imagined. When I say good ergonomics, I mean the basics listed below. I intend on writing another article later on these, but here are the top three:

  • A monitor that you can look at with the top of it at eye level.
  • Sitting in a chair, that is comfortable but also has good back support.
  • Not having your head leaned forward to distribute the weight of it evenly upon your neck (for extended work to stare a screen).

Several IDEs and text editors have plentiful shortcuts and features to help you code faster. Also, snippet builders such as the emmet plugin in vscode (see gif below) will drastically cut down on your redundant tasks. General code scaffolding techniques are always a great tool to add in to your workflow.

Emmet in VSCode — https://code.visualstudio.com/docs/editor/emmet

Writing less code will for sure always be the winner when in comes to coding faster. In addition to scaffolding, you can now use complete systems where code is generated automatically. I use API generators quite often. Anytime I build simple sites I reach for strapi and if it gets more complicated I use postgraphile or voyager. There are several of these out there and these aren’t the first to the market. Platforms like django have been doing this for years. Although, there is always a time and place to write your own API from scratch especially with larger platforms. 😁

Hope you enjoyed reading!