9 tips to type your code fast

Before taking out the keyboard, sit down for two seconds with a notepad and a pencil. Try to decompose the task into big steps. Then each step to smaller.

9 tips to type your code fast

Learn to type fast

Learn to type using at least the thumb, index, and middle finger of each hand. You will never type as quickly as a typist who is specially trained for this, but it will always be faster than typing with just two index fingers.


Think before you act

Before taking out the keyboard, sit down for two seconds with a notepad and a pencil. Try to decompose the task into big steps. Then each step to smaller. Pull your algorithms in the dark (we are not in college, nobody asks you for detailed pseudocode, and if you prefer to draw them rather than writing them, it works as well) but pull them before. Think about data modeling. If you are doing object-oriented programming, think about your objects, their attributes, their methods.

Programming is a bit like Danish construction toys that use small bricks: we go much faster by following the instructions than by assembling the bricks at random and going back when we make mistakes.


Use design patterns

Design patterns are excellent tools that will help you get faster in the above step. To use the analogy with LEGO bricks, design patterns are pieces of pre-written instructions that you simply need to adapt to your problem.


Use frameworks

Practically all modern languages allow the use of frameworks. The use of frameworks allows you to start projects with skeletons of pre-designed applications. You will then focus on the logic of your application, and not on its architecture. You will always need to ask yourself if that framework is appropriate (or even, for simple applications, if a framework is even necessary), but once the answer to this question is found. You will save time.


Use libraries

If you are not at university, school, or more generally, in training, and you need to use a wheel, trust a library that provides wheels, do not reinvent it.

 Whatever your problem, and whatever language you use, there is most likely a library that will allow you to accomplish what you want to do with a few lines of code.

 If you need to read JSON files in a Java program, you will go faster using the Jackson or Gson libraries than by parsing your files manually.

 If you need to calculate square root in Python, you will go faster by using the sqrt function of the Math module (sqrt is short for square root), rather than bothering writing an implementation of l 'dichotomy extraction algorithm or Heron's algorithm.


Know your language(s)

Beyond the basic algorithmic tools (the keywords), all modern languages are equipped with standard libraries. These are all the little extras that make one language attractive compared to another. Learn how to use these tools intelligently.

 If you know what you are doing, the Java streams API will save you a lot of programming time, compared to equivalent code using loops or recurrence.

 In some cases, a well-placed switch will take infinitely less time to write than a series of if / else if / else which will also be unreadable when you have to modify your code. In other cases, it is the switch that will make you lose time.


Use build and dependency management tools

Tools like Maven, Gradle, npm, pip, ant, CMake will save you a lot of time on your compilation phases, and on dependency management for those who manage them as well (this is not the case for ant or Cmake for example). When you develop, you waste a lot of time recompiling and redeploying/relaunching the application for testing or when correcting errors. Using these tools will allow you to increase the proportion of time you spend developing.


Use a source management tool

There is a choice Git, SVN, CVS, mercurial ... Use one. These are powerful collaborative tools, but even more powerful backup tools. If you make a big dumpling, you will not have to think about what you need to fix to go back, just take the last functional commit.


Use an IDE

Integrated Development Environments are extremely powerful tools. You will still need to know how to do things without them, but if you have the option of using them, do it. They will spot compilation errors for you before you even attempt to launch your project, they will integrate several of the above tools, so that, you can use them in one click, some will be able to provide you with visual representations of your code (for example in the form of UML diagrams), they will allow you to configure, deploy and launch your project in just a few clicks.

What's Your Reaction?