My Top 10 Programming tips for enhanced productivity

Tip 1 — Using consistent case in schema definition & throughout project

Using consistent case when defining schema and variables is important for productivity.
For example, I am working on a schema with mix cases. As I am not sure which one to follow when coding, I have to validate the name definition every time.
With my first interaction with the codes, I kept mixing the cases. I didn’t understand why there were errors on the screen. Similarly, I lose time while implementing the codes as I have to check the naming.

In one situation:
civilStatus: String,
name: String,
firstname: String.

In other schema, firstName:String is used.
One way to improve this situation when using TypeScript is with the use of Interfaces. However, they would be too cumbersome for Rapid Application Prototyping.

Some companies use coding standards and naming conventions for consistency.

Tip 2 — Descriptive property names

I find using relatively descriptive words better than abbreviations for property names.

For example, dob vs birthDate.

If possible, contextually descriptive words are even better if they are not too long.

For example,
const salaryReport = {}
vs
const updateSalaryReport = {}

They help ease understanding of the written codes without the need of comments explaining the flow or the logic.

Tip 3 — Copy paste programming

Forget hypes such as Functional or Reactive Programming. The most productive style of programming is the Copy Paste Programming. Copy and paste when possible instead of writing down the whole thing.

If you find you have a lot to type, copy paste programming will change the way you code. You will feel better. You will feel more productive. You get more done with less effort.

Coding resembles writing. If you are going to type the same words several times, it’s no fun.

For example, I had the following property to check for a valid date:

this.employee.affiliate.dateOfBirth.

However make sure the code you are copying from works — or at least test your codes well. Otherwise, you might copy bugs all round your application.

Nonetheless, Functional programming has useful concepts such as pure functions or avoiding side effects among others, many important for developing robust front end Web Applications with JavaScript.

Additionally, when I work on an already existing Web Development project in HTML, before typing anything, I try to look for existing codes to copy. I then edit to suit the requirements.

A related hack is using the baked in clipboard in Editors and IDEs such as Webstorm and Sublime Text Editor.

Webstorm : Ctrl + Shift + V

Sublime Text : Ctrl K + Ctrl V

Tip 4 - Use History Ctrl + H to navigate to recently opened pages that might be helpful

In my previous job, on an interesting project I worked in a senior colleague, I was once startled to find that most of the time, he only had one opened tab on his browser. He followed Zen minimalism. When he needed something, he opened his history and searched it. Years later, I use this shortcut almost every day.

Similarly, when using Gitlab at work for collaborating on multiple projects, instead of bookmarking pages I need, I prefer opening the history panel on the browser and directly search for the screen(s) I need.

For some reason, I always forget how to use conditional ngClass in Angular. I open history, type ngClass and press Enter. Looking at a familiar link, with one click I get the information I need without hassle.

Another related tip — using Ctrl + Shift + T to open the last browser instance.

When I close Chrome browser, filled with plenty of issues or tasks from Project Management tools such as Taiga or OpenProject opened in multiple tabs, on the next working day, instead of looking for each with the history feature, I prefer using this shortcut.

In one hit with three keystrokes, I get back to the last items I worked on.

Tip 5 — More Resilient Codes

Resilience is the ability of a system to return to its original state or move to a new desirable state after being disturbed.

Copyright © http://www.husdal.com/2008/04/28/robustness-flexibility-and-resilience-in-the-supply-chain/

Working on JavaScript for several years, I found the importance of making more expressive codes with multiple conditions if needed for resilience, less error prone and crash as early as possible in order to avoid possible bad data.

In short, in case of unexpected change, the system is reliable without corrupting data.

This can also be used:

But what happens if the type has changed in the schema, from array to object?

“A good programmer looks both ways before crossing a one-way street.” — Doug Linder

Tip 6 — Focus on one thing at a time

When working on the front end development on a relatively complicated UI screen, I only focus on implementing the layout positioning. Using CSS frameworks such as bootstrap, I try to get the correct responsive layout first with dummy data.

I then work on the styling to validate with the Web Designer. If correct, I proceed with binding the data with the elements on screen before advancing with form validations and additional CRUD operations. I try completing a component or page first before progressing to another.

A good scenario where you can reduce complexity and improve productivity when coding is working one on one issue or task at a time.

For example, a few days ago, I was working on a page with several components. I just completed one the previous day and started working on another in the morning.

On testing the page, I noticed the previously implemented component gave an error. I instantly had the reflex on shifting back to this component. But doing so would require me to switch context to another task which takes mental effort, open the required files on my text editor and on completion, test again.

Unless the second component depended on the first one, I focused on completing the one I was currently working on before eventually shifting to the one with an issue.

Tip 7 — Don’t work with a tired mind

There is a prevalent misconception nowadays especially in the creative world of design, writing and programming, commending that, working more hours means being more productive, even if it means working with a tired mind.

In fact the opposite is true.

When you work in such a state, you have trouble focusing on your tasks, have less empathy [1] and are more prone to make mistakes, which then takes time to solve — time that can instead be used to move the project forward.

You often lose lots of time and effort solving trivial typos, dealing with code clutter, unreferenced variables or functions solely because you are working with a tired mind.

“Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code.” Dan Salomon.

Here is some examples of recent uncomplicated issues I had difficulties dealing with, when working in a tired mind:

Each time I updated a value in an array of an object, the whole array was replaced by the value — as I did not reference the index: To illustrate with a plain example : [2,5,4,6] gave [3] when it should have changed 5 to 3 as in [2,3,4,6].

I used const objectName to populate data from another object but forgot to use spread operator for deep copy.

const finalObject = originalObject;

I had the original object being referenced twice, whose values were overwritten each time the copy was changed. Trivial but cost me unnecessary time and effort to debug.

const finalObject = {…originalObject};

I also often mix spreading object with array or vice versa. If defined well though, TypeScript helps mitigating this inconvenience.

Lastly, I got a template error indicating that multiple directives could not be used on the same element at line number X. The error message was concise and mostly unambiguous, yet I did not understand the concept behind without probing further. In fact, the solution was to avoid using ngIf directive in the same element that used ngFor.

Tip 8 — Use mnemonics

I like using mnemonics autocomplete, a feature built in editors or IDEs like Sublime Text, Visual Studio Code or WebStorm.

This hack has been productive for me when programming because :

  • I like writing descriptive function names and variables that often become long e.g. const hasEmployeeReportGenerated or def redirect_if_business_not_active()
  • On calling them, I either type enough words for the editor to display the names or copy and paste them ; with mnemonics I only write hERG for the prompt to display the variable hasEmployeeReportGenerated, thus being efficient and enabling me to focus on the logic
  • Moreover with mnemonics, I don’t have to remember their names entirely. Most often when coding, I recall only part of — therefore reducing the need to type them completely, which is cumbersome and error prone
  • I type less words to achieve the same result. Less words means less time and effort overall

With this small productivity tip, I type less characters on the keyboard, while focusing better on the logic and structure.

Tip 9 — Opinionated vs smart codes

Many software developers, myself included, try to write smart codes catering for different scenarios or values instead of writing opinionated but simple ones.

Flexibility in development is desirable but not at the expense of simplicity. You can write a function that checks the type of the parameter if its an array or a string — or you can enforce it only as a string.

You are less able to reuse this function unless you use wrappers to manipulate data for the parameters.

When you write opinionated functions with a single parameter type though, you don’t have to check for multiple types. You can only check for the type you expect or want to manipulate.

What’s even more interesting with TypeScript or Strong Type languages is you can restrict the parameter types. In this way, the caller knows exactly what type of value to pass and the function can be written in a simple way, designed to do only one thing. The compiler gives an error if the wrong type if used.

Tip 10 — Learn and use keyboard shortcuts

When I first started my Software Development career, the first advice I got from a senior colleague, was to learn the keyboard shortcuts of applications I was going to use everyday.

Looking for keyboard shortcut cheat sheets online or the manual in the application or in menus, I have hence made it a HABIT to learn enough shortcuts to become efficient.

Similarly you can become more productive, with a few keystrokes — you get things done quicker with less effort. You also avoid having to endlessly switch from the keyboard to the mouse and back and forth.

You don’t need to learn each and every shortcut. In fact, that is a waste of time as you most probably will only use a bunch of them. Instead, try looking the ones you used most often or the ones that are most impactful.

Sometimes, with willpower depletion or mental fatigue coming after a long day of work, looking for Graphical Elements or Menus on the screen can be exhausting, leading to errors.

For example, recently at work, I had to synchronise my repo before pushing my changes. However, due to tiredness, instead of clicking on the Pull button, I snapped the Push one. I got an error message to first pull from the remote branch, yet it took my forever to differentiate between the two buttons.

On Windows, the keyboard shortcut for Pull is Shift + Ctrl + L while for Push, it’s Shift + Ctrl + P. Both Push and Pull starts with P but Pull ends with L. Therefore, it’s easy to remember.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdallah Yashir

Abdallah Yashir

Senior Software Developer, Writer, Amateur Photographer, Reader