Keeping on your daily routines

tl;dr Use Routinely (android app) to keep your routines. Or Coach Me if you want to be social.

While living in Korea I used everyday ankidroid (an android app for anki) to learn and retain Korean vocabulary. The key point is use it day after day so your don’t forget what you are learning. But after I came to Barcelona I noticed I didn’t keep that routine.

How can I keep a routine? I guessed there should be some kind of app that can help me. After asking about it on twitter and doing some research I listed 4 candidates: Habit Streak, Routinely and Coach Me.

Actually I got more suggestions, but I tried to find an app that perfectly matches my needs: small, with a list of routines (things I should do everyday) to tick, and some kind of alarm that alerts me when the day is over and I didn’t finish all my routines. I didn’t want just another ToDo app. So here goes the review…

routinelyI tried Habit Streak, but found out the UI is really bad (you need to go to a submenu to tick a routine!). So I discarded it and tried Routinely: surprisingly it matches my needs. It is visually clean, with an easy interface; and comes with alarms for every routine and a widget with the number of remaining routines to do.

As I found what I’m looking for, I didn’t review any other app and started using Routinely as soon as I installed it. It’s really helping me to improve my productivity.

Actually a friend suggested me Coach Me, and it looks quite similar to Routinely, but with a social layer (“share with friends”). I guess one or another will be better for you depending on your self-control skills. If you need to show people your skill as a way to force yourself to improve, choose Coach Me. Otherwise Routinely will be good enough.


Tracking your time while working

Years ago, when I started remote-working, I realized I needed to be extremely serious with my work-time. If you work at home it’s absurdly easy to get distracted with housework around you. Or open facebook again (but thanks to a firefox plugin, Leechblock, that never happens again).

hamsterI thought I needed to track my focused time somehow. Despite there are online tools for this task, like RescueTime, I wanted something in my desktop. So I first gave a chance to Hamster-time-tracker. It comes in all linux distros, so installing it is simple, but for the best results I suggest you to set it to run at startup.

The good thing of Hamster is that it’s simple. Choose the task and start tracking. It can show you summaries with all kind of information (useful to report to your boss), but if you need anything more elaborated you can even get the raw data yourself, as it saves the tracking details in an standard SQlite database (in linux, ~/.local/share/hamster-applet/hamster.db).

I used Hamster for years, in a sick detailed way: a kind of micro-tracking. For instance, if I go to the toilet, I stop the clock; if I go to the kitchen to brew some tea, I stop the clock. This way I started to understand how I really work. In my case, in blocks of 1~1.5 hours. Also I realized that getting more than 4~5 hours of real focused work per day is impossible. Finally I understand some days I’m really productive (5 hours) while others I’m not (30 minutes).

Recently I updated my laptop and wanted to test an even better time tracker. With Hamster I can’t create subtasks easily. When working in a project, all of us start defining tasks, and splitting them into subtasks. But it’s also very common to discover, while working on a subtask, that you need to split it again. Or create an extra one, or…

task coachI started using Task Coach, which allows you to split tasks anytime, while tracks the time. You can even track time for a particular subtask or for a task (sometimes useful when you are doing small stuff). You can set tasks as active, inactive or completed, and easily filter them to see the big picture or the detailed view.

Whatever you do, you may want to improve. And the better way is to track how you work, as a first step to have data (metrics) to analyze and improve. In my experience, tracking the time you are working focused helps you to see how well (or bad) are you doing and rewards yourself (or punish yourself) seeing the data.


Links about quality website development

Just for reference, here I’m writing down some interesting links I’ve recently seen about quality while developing and maintaining websites.

That’s enough to keep me busy for months. But these days I’m also trying ideas, using CSS3 and HTML5 features, so I’m using a lot what it could be the best website with compatibility features.


Deal with soft SPAM

Adverts are everywhere. And they try to get your focus at all prices. I hate that. Even these days, that in theory they send you proper tailored adverts matching your needs, I get annoyed… because actually you just get SPAM.

Moreover, in Internet we have something that I call “soft SPAM“, that basically doesn’t sell you anything but disturb your focus. I’m speaking, for example, about the “Who to follow” block in twitter or “Recommended pages” in facebook. It might be useful when you create a new account, but it is totally disturbing in your normal live activity.

Do you want to remove the “who to follow” block on Twitter? Just use Addblock (a plugin for Firefox, Chrome, etc that you MUST have) and create a new filter, with the following line:

twitter.com##div.js-recommended-followers

In case you want to remove Facebook’s “Recommended friends/pages” block, just use:

facebook.com##div.ego_section

After that, you live will be a bit easier ;-)


Good password trick

· You shouldn’t use the same password in different places.
· You should change your password from time to time.

Despite these 2 basic rules, most people has just 2 or 3 passwords, and use them everywhere. So I’d like to share the following trick, that I heard from my former boss:

good password = your usual password + first character of the website/place’s name + last digit of the year

For example: if your usual password is “sadshoes”, and you are setting it on facebook, your new password should be “sadshoesf3″ (“f” from facebook and “3” from 2013).

This will be far more stronger than just “sadshoes”, and if somebody breaks your password, he will only be able to enter in facebook. This will also force you to change your password every year.

Other stuff about passwords:
· Do not think that somebody will try “manually” to break your password; nowadays a bot will try to break your password using a long list of common words used as passwords.
· Never use pure words, or concatenated words, alone: bots also try these.
· Moreover using common text-to-digit translations, like “LOVE” to “L0V3″, is not secure: bots also try these!


10 years to master

You need 10 years to become an expert on a field. No more, no less. 10 years of continuous effort. Think about a famous musician, a famous athlete or even a professional Go player. There is at least 10 years of hard-work in almost all cases before he becomes a star.

Looking at this video by Danny MacAskill, I imagine those 10 years he spent improving his technique!

When you start with a subject, you experience different statuses, from novice to expert. But there is a key point that only an expert can do: he makes it look easy. As if you can take your bike and do same things showed in the video. Actually I could say I have 8 years of experience on Go, and perhaps 10 years on PHP, but I feel there is still a lot to learn. Despite sometimes people see that expert magic on me.

I wonder which new expert skills I’ll have in 10 years. Things that you start now doing often can become key points of your life. Things that perhaps you don’t really consider, like gardening or doing DIY. So, be sure to avoid wasting your time, and focus on practicing interesting skills. We’ll see what happens in 10 years.


Telecommuting: when good forms are forced

Pouchong TeaCurrently I’m working for a company, at home. It’s a small company: my boss is located in Mexico, I’m (project leader) here in Spain, and there are 3 developers in India. We just use Skype, Google Docs and email, and we have no big problems, just the ones related to the time zones.

“When you work remotely you work less”, they say. Actually this is the usual excuse for bosses to avoid telecommuting, because they feel they can control you less. But this idea is totally wrong!

Let me explain an interesting effect. Imagine a man working in a office with fixed time (like 9am to 5pm); when he sees the clock marking 5pm he stops working and runs home (except just in case of a final deadline for a project). That is, he doesn’t really take care about finishing the job. Perhaps he has not done a lot of it, and instead he spent a couple of hours with minesweeper! Meanwhile, I don’t have a really daily schedule: but I usually do something like 9am to 6pm, with some stops. The thing is that when I see 6pm in the clock, I do NOT stop, just think “is the task (scheduled for today) done?”. Usually it’s not done, so I work a couple of hours more. Of course it depends on each person, but usually remote working make you more implicated with the job.

On the other hand, the company is forced to have a really good system to schedule tasks. Other methods to control the work that everyone is doing are welcomed as well. Things like an updated calendar for tasks, good version control system and code reviews, ways to verify the quality of software, job reports, etc. The company has to firmly use methods of control in order to survive. But this is a good thing: the work is better organized! In my case, we usually have a meeting on Friday (evening, morning) to set the tasks for each single day of the next 2 weeks, and review the tasks done during the current week.

So, the real benefits of telecommuting, from the company’s perspective: no need to rent an office (and no need to pay its bills), better organization of the work, and happier employees. Sounds good, specially nowadays with a economic crisis around. The only real problem is the communication with the team, but with video-conferences you can reach a just enough level of interaction. However, this doesn’t work for all kind of people, but you can train them (even remotely!) to work with the discipline needed to telecommute effectively.


Software metrics (PHP focused) part 2

In part 1 I spoke about lines of code and average of lines per day. Two indexes that are quite naive. Let’s see some better metrics, most of them object oriented programming focused.

Third stop: Tests and code coverage
If you have unit tests you can easily control that nothing vital is broken in each contribution. A unit test stress a class, so if there is some change in it, you can verify that the expected behavior remains the same. Moreover you can get an analysis of which lines of the code are actually executed in a test suite: that is, the code coverage of the test. You will see high values in well tested classes and low values in classes that need more tests.

Tools? Of course, PHPUnit, with the help of xdebug to get the code coverage.

Four stop: Cyclomatic complexity
Cyclomatic complexity is just the amount of different paths the execution can go throughout. For example, in our main project we have a total of 3048 paths. This value can be interesting to detect places in code that have become too complex and maybe need some cleanup.

Five stop: Pure OO software metrics
There are some interesting software metrics for object oriented code organized in packages, used basically to value which packages (groups of classes) are of better quality than others. Values that show the relation among classes, dependences, the resilience to change, etc.

Last stop: Ratios
Combining some of the previous values you can get interesting ratios. For example:
– Cyclomatic complexity per lines of code: 0.2, a very good value.
– Lines of code per method (class function): 22.02, a normal value that we have to lower.
– Method per classes: 8.25, a good value.
– Average number of extended classes: 0.4, a good value.
– etc…

Tools? The excellent pdepend is used here. Have a look at the end of its example page to see the amount of data (and funny but interesting diagrams) you can get.

Finally, all those values and tests are compiled each single time a programmer sends a commit to our code repository, and I get a mail with all the details, including the lines added, the author’s name, and all the values that change. So with a quick look I can assure that the contribution is ok, or there is some code to improve. I wonder how many companies (which develop in PHP) use something like this. I bet less than 100 in the world!


Software metrics (PHP focused) part 1

Managing a software project with various programmers and around 10 contributions per day is a complex thing.
How can we measure the quality of every single contribution?
How can control the work of the programmers?

First stop: Lines of code

The easiest thing to measure in a project is the source lines of code it has. For example, the main project we are developing at work has ~30k lines (k=1000). That is, 24k of pure code and 7k of comments (and I’m counting only pure PHP OO code, without HTML, CSS or javascript).

Is this that simple to count? No, it’s not. The main problem is that programming is brain work, where creativity, skills to solve problems, and smartness are put in play. It’s like writing a novel: can you say that one novel is better than other just counting the pages it has? Can you say a Boeing 717 is worse than a 747 because it weights less? As the Wikipedia’s article says, only this metric can be useful when comparing 2 projects with different order of magnitude. However, the ratio comments per lines of code (in my case 1 comment every 4 lines) usually is a good index of quality.

Second stop: Average lines per day

Calculating the average lines of code per day can be tricky as well. At my job, a senior developer usually does ~50 lines per day, but a junior programmer does ~130 lines. Is that much? Well, having a look at some metrics about a similar project, phpMyAdmin, in Ohloh (a website with metrics for open source soft), and doing some maths, it’s suggestion is just 17 lines per day! On the other hand, if you google for “lines of code per day” you will get really wide values, from tops of 1k (using code generators: tricking) to normal less-than-100 values. Moreover, the deviation from this average value is actually huge: one day I can do 2 lines, other day I can do 200.

Senior does 50 lines, junior 130… is the senior one a slacker? Of course is not… usually the code from the senior one is better: less prone to errors, more adaptable, more concrete function’s names, more elegant, and does more things in less lines. The more the better? Actually the less code needed to solve a problem, the better. About this topic, I recommend reading the article : Code is your enemy!.

Tools? We use phploc for counting lines of code, and phpcpd for detecting cases of duplicated code. Both tools are developed by Sebastian Bergmann, the author of PHPUnit (the most popular testing framework for PHP).

Next, in part 2 of this post, I’ll be speaking about other metrics, like code coverage, cyclomatic complexity and some interesting ratios based on software package metrics.


Holidays

Which one is better?
a) Use all (or most) of your free days in a row. You totally disconnect from work issues, but when you come back your’ll have a flood in your mail inbox.
b) Use them little by little, so do small breaks during the year. You don’t totally forget about work things, but you recover some energy several times.

Basically the thing depends on how many days do you need to reach a real disconnect status. And this also depends on what are you going to do during holidays: if your holidays include a lot of activities, you don’t need a lot of time to remove any track of work from your mind, but if you’re going to spend your time at home or next to your office, you’ll sure need more days.

Then, the key is to find the average amount of days you need to disconnect, and do as many breaks as you can with this length… if your employee lets you so.