Thursday, August 29, 2013

Testing is Fun

When I started programming, testing was the thing you did after you finished your first draft of a program.  If you've built a website, you may test that it displays the page as you designed it.  If you've built a calculator, you test that adding positive numbers, negative numbers and fractions all work right.  After testing, you'd find some bugs, fix them and say "Oh well, I guess it's time to ship".

Better late than never, I finally hopped aboard the test driven development band wagon.  Armed with Google Test, I'm beginning to make testing part of the early stages of my development process.  There are probably lists that detail all the benefits to test driven development, and you can and should search for them on your own.  But some benefits that I've personally experienced and felt are:

  1. Thinking about testing makes me write better code.  If you want to write unit tests, you need to separate your program into distinct modular components, so you can test one part at a time.  Of course, writing small byte-size units of code is generally a good programming practice anyway - so that's one win-win. 
  2. Testing gives you confidence.  All programs have some bugs, but testing helps you out in a few ways. 
    1. Before you check in code, testing might help you catch a bug.  So, buggy code doesn't enter your repository.  Nobody but you knows that you're a sloppy programmer!
    2. After your code has rolled out to the world, your test might find a bug before any user's notice it.  Although not ideal, maybe you can roll back changes or submit a fix before any clients begin complaining.  Only your coworkers know you made a mistake!
    3. One of your clients spots a bug and you get called up to fix it.  Testing will help you isolate the problem.  You know what tests have been written and what edge cases haven't thoroughly been tested.  Hopefully your tests help you fix the problem faster.  So, your clients know that you had bugs, but they marvel at your customer service.  
Now that I've experienced some of the benefits of testing, I can't imagine writing code without them.   

Tuesday, August 27, 2013

Pocket > Google Reader

A few months ago Google Reader was retired.  I quickly passed through the 5 stages of grief, and I knew I'd find something that would fill the void.

I started with Feedly.  This app looks much nicer than the old Google Reader app.  However, I found it hard to use.  It was just a bit too slick, with too many animations, and too many views.  It's not a knock on Feedly.  I suppose there's someone that likes all of the eye candy, but it wasn't for me.  I eventually found and settled on this dirt simple Rss reader - Sparse Rss.  

Sparse Rss has been serving me well, but in the midst of transitioning away from Google Reader, I started reading more articles that were brought to my attention via Twitter, Google Plus and even email.  I realized that I needed a place to store these articles that came at me from multiple sources.  The answer is Pocket (aka Read It Later).  I mainly use the Android App, but I've also used the Chrome App.  

Pocket looks great, yet is super simple to use.  It automagically decides on the best view for articles so that they are very easy to read.  It's hard to explain.  Somehow, the articles look great in Pocket.  It is as if they optimized the UI to make it best for someone who wants to read.  Perfect.

Even better, I found out that they have a developer API.  There are already a number of existing applications that use RSS to add articles to Pocket.  I will try them out and see if any of them improve my Pocket experience.  But even if I can't find an app that I like, I can't complain because the option is always there to write one myself.  Thus, the onus is on me, which is great.

Update: I usually use pocket on my phone, but today I decided to read some articles over a web browser.  They have this feature, where if you press "/", a quick screen guide for keyboard shortcuts is shown.  The guide itself looks great, and it is incredibly useful.  I already started using keyboard shortcuts (mostly j and k to navigate through a list).  This application always impresses me.