Since the 6 odd years I have been programming professionally, I have seen again and again that it pays off to be organized while programming. What do I mean by this? Take the example of my recent work flow.
1. I had to code on my desktop.
2. When I think it is in some stage for testing, SFTP it to the server.
3. On the server, go to a particular directory and build the executable.
4. Now, switch to a different directory and bounce the server.
5. Once bounced, go to a different directory and monitor the logs.
7. Now open the app do some operations and check the data base whether a particular field with a user id has the expected value.
8. Update this particular user with some other value and do some operations.
9. Now delete some of the fields for this user and repeat the above.
There are too many distracting things here that makes you loose your focus like opening a tool to sftp, switching too many directories on the server, executing multiple sql queries. Now, instead of doing it the lazy disorganized way, let us see how we can stream line it, so that we can focus on the code and not on some tasks like sftping, switching directories, etc.
1. I set up WinSCP to monitor my code directory and automatically sync it with the remote folder so that I do not have to manually do this. As soon as I save my source code, WinSCP syncs it with the remote directory.
2. I wrote a shell script that automates steps 3,4 and 5. Now I do not have to switch between too many directories on the server.
3. Instead of having a single MySQL query browser open and commenting un commenting sql statement in that, I had multiple MySQL query browser windows open with each window having one SQL query that I want to execute.
Now my workflow is:
1. Write code and save.
2. Execute a shell script in the remote directory.
3. Open the app in the browser, do some operations.
4. Open the MySQL browser corresponding to the query I want to execute and just press run.
It may look like “What the hell is this moron talking about?”, but we hardly try to automate our tasks and do it in a more efficient way due to various reasons, like inertia, “How much time will it save?”, “Who will do all that?”. But once you have your work flow stream lined and do away with the distractions that take your mind off the task at hand, you will be amazed at the productivity gain. I have a very simple philosophy, try to do away with all sort of distractions that make you loose your flow.