Programmers/Engineers are ‘dime a dozen’. But smarter programmers are a small population!

Here are some essential tips to becoming an efficient programmer.

Customize your IDE!

Today’s tools like the Integrated Development Environment (IDE) are quite powerful. But most programmers end up using only a fraction of this power. Be it, Android Studio, IntelliJ IDEA, Eclipse or Xcode, they have lots of features to make programming easier and faster.

Live templates/Shortcuts – these are the simplest kind of tweak that you can do in the IDE.

For example, if you are an Android developer and frequently import log statements like the below:

private static final Logger logger = Logger.getLogger(<classname>);

You can just create a shortcut and assign it to say “logger”.

And the next time you type “logger” and press Tab, the whole declaration would have been created for you! As easy as that.

Or cases where you need to add Log.d statements enveloped inside a IS_DEBUG check, just create a custom live template. Then just type “logd”, and you are set.

if (Util.IS_DEBUG_LOGGABLE) {

    Log.d(TAG, “Some awesome message”);

}

Saves so much of typing effort and characters/words!

Command line is your best friend!

Ssh

Do you find yourself frequently logging into a remote machine with ssh?

ssh your_user_name@server_ip

Just create an alias into your bash_profile or bash_aliases file:

alias toprod=’ssh myname@prodserver’

And the next time you need to login, just type “toprod” on the command line!

(prodserver is an entry in the /etc/hosts file on the local machine). Ex:

xx.xxx.xxx.xxx prodserver

regex

If you need to edit files or find-replace some strings, it’s much more powerful to use a regex. This can be used either on a command line or in your text editor. And most text editors today support find and replace using a regex.

Ex: A simple example. Say you have a string “oranges,mangoes,bananas” and you need to have them listed each on a single line. Normally, you would just move to each “,” and press the Enter key. But try doing this for lots of data, and you will hurt your fingers!

Instead, in your Text Editor / command line, just find the text “,” and replace it with “,\n” with regular expression turned on.

Likewise, with regular expressions, you can easily find text at the beginning of each line “^” or at the end “$” and replace. On the command line, you can use grep or sed/awk to achieve the same.

Git

Although all IDEs have VCS support, sometimes using command line can be simply faster.

And create shortcuts in your bash_alias or bash_profile files.

Ex: ga = git add .

gc = git commit -m 

gp = git push

gco = git checkout — 

All this is just a one-time effort you would put into creating and saving your settings, but in the long run it saves so much effort and time!

A script in time saves nine!

Programmers do a lot of repetitive tasks. If you are a server guy, then you would end up deploying a lot of files/jars from your machine.

Or if you are an App Developer, uploading App builds can be time consuming and need lots of mouse clicks.

Instead, one can just write scripts and automate this task. As a one-time exercise, writing the script may take a day or two or more depending on the complexity. But for a task (of uploading files) which you will do almost every day for a decade, it’s an effort worth its time!

And the actual task will then be completed in seconds!

For example, if you are an iOS developer, you can use readymade scripts like fastlane or just write your own shell scripts which use xcodebuild commands for building, archiving and even uploading to the App Store! No more click <wait>, click <wait>, tap <wait>, tap <wait>, click, click!

Android developers can use the Play Store Developer API and achieve the same result!

These tips and tricks are not just limited to your development tools, but can be applied to your other office tools and sites like Gmail/Slack etc.

Keyboard is faster than the mouse!

As most experienced programmers would agree, the keyboard gets the job done way faster than a mouse! So wherever possible, use the keyboard instead of the mouse.

For example, in Slack, if you wish to quick edit your last reply, just press the ↑ arrow key! Likewise, to reply with an emoji, you don’t have to use your mouse. Instead just use the keyboard and type the emoji and few letters. Example to reply with a Thumbs Up emoji 👍, just type :+1 and hit enter!

And similarly, for the most frequent tasks that you find yourself doing, like building the project, refactoring code, creating constants or running, just check out what are the shortcuts available and use them! Ctrl-B or Ctrl-R or Ctrl-Shift-F11 etc.

If you are used to one type of IDE, you can always change the keyboard shortcuts in your new IDE to match your comfort level!

The above blog has been collaborated on by our Tech Team. For more such articles, stay tuned to Square Off’s Blog space.

Check out the world’s smartest AI board, that makes its own moves!