All programmers need a productivity boost and perfect memory now and then — sometimes throughout the day. We each want to be productive no matter of the reasons — to code more, to fix more issues, to reach the project deadline, to accomplish project goals. But whatever the reason, these productivity tricks will do the job:
Create Reference project:
Do reference project with all your code snippets. This might not seem like the usual programming tip, but give it a thought: if you already did something, you may need it in the future. You’ve worked extra hard, you've worked extra hours, and finally manage to solve that issue. So why to not save it for future reference. Do you want to reinvent the wheel? Do you want to struggle again hours against solved puzzle?
Once you did something then it's better to document it and save it. You can add all important code snippets in a project with general purpose. This is investment that is going to be paid multiple times. This is your personal multiplication table. You can always rely on google, stackoverflow and other sites. But you will lose your personal addition to those solutions. You may lost hours to follow the same steps instead of saving time and searching for improvement of the known solution.
My Reference Project
My reference project consists of several sections:
- java - java snippets like complex loops, date format, file access, database access:
- String operation - regex, replace of non ASCII
- numbers operations
- Date formats
- Data base - insert, select, delete etc
- automation test
- difficult problems - produce multi dimension matrix from a list by given criteria
- crazy or funny codes - check example below:
- python - image writing, machine learning, genetic algorythms
- groovy - automation testing, small useful programs like reading big files
- html - customized themes, working snippets.
Print 1000 times something without loop:
public class Names {
public static void main(String [] args) {
String s1 = "Shreyash\n";
String s3 = s1 + s1 + s1;
String s10 = s3 + s3 + s3 + s1;
String s30 = s10 + s10 + s10;
String s100 = s30 + s30 + s30 + s10;
String s300 = s100 + s100 + s100;
String s1000 = s300 + s300 + s300 + s100;
System.out.print(s1000);
}
}
Source : How do I print my name (Shreyash) 1000 times in Java without looping?
So having all this at on place I can in several seconds to find exactly what I need. Sometimes I think that I have a solution. I already knew how to do something. And finding the solution I understand that the problem that I have know is not the same as the one from the past. Similar but not the same. So without losing time I can work for another solution.
Why is important to have this project
Because the information is going to grow exponentially with every new year, new skills and techniques will emerge. Without good reference point based on your personal experience you are going to be lost. Imagine that this project is your map in IT world. Every piece of code, every solution, every mistake will be on this map. And if you don't have a map you are going to scatter by memories which could be misleading or fading.
Work off-line - now is possible.
To increase your productivity you need to disconnect from Internet. But how to work offline and without distractions when all the information is on the web. Just do your project and use it as reference. All you need is most probably there. Of course if you need something more you can always search on the web. The point is not to be fully disconnected but to have maximum concentration and focus on your current task. Have you ever distract from the related topics on Stack Over Flow - for me is happening all the time. That's why I prefer to use a source of information without distraction and which is proofed by my experience.
How to write the code
Usually I do Classes based on topics. For example regex searches which are very tricky or some special code snippets. And later I put reference to the code as comment:
//https://www.quora.com/How-do-I-print-my-name-Shreyash-1000-times-in-Java-without-looping
public class Strings {
public static void printNoLoop() {
System.out.print(String.format("%01000d",0).replace("0","Shreyash\n"));
}
}
Finally I will have clash named Strings and method printNoLoop.
Do it on regular base with priority.
Usually I spent 15 - 30 minutes every day for code revision and analysis at the end of the work day. Everything important I put in my Lab Diary and / or in the reference project. You know what those tasks are important so do not postpone them. If you postpone for a week you can forget the correct steps or order. Sometimes when you put things off, they end up being things you don’t really need to do. But sometimes they are things you just gotta do. Those are your tough tasks.
Do them first thing on the day or at the end of the same day.
After several years of work on your reference project and good documentation you will be able to increase your productivity hundred times.
Read more about programmer productivity tips for developers: How To Become A Better Programmer