Muscle Memory

Eight years ago, a friend of mine introduced me to the world of Unix (you know who you are -- thank you). After mastering the finger ballet that is emacs, I then discovered the wonders of modal text editing in VI. Those are the first *real* programmer editors that I've used.

The power of Emacs lies in Lisp. It is a very programmable editor. It is so powerful, there actually came a time when Emacs is the application that I use for majority of my tasks. It has a mail reader, news reader, file manager, web browser, - it even has Tetris!

The power of VI lies on the conciseness of its commands and its integration with command line utilities. Unix provides lots of little utilities for slicing and dicing text. On a conceptual level, these utilities are very much like SQL for text files - you can query and join files (cat), filter lines (grep) and do all sorts of things with text.  In this conceptual level, VI is like Query Analyzer for text files.

These editors both have a steep learning curve. It took me a few hours just to get used to the environment and learning the basic commands.  That sounds silly - editors should be simple - open a file, type in text, save, and close. These editors are not like that. These editors are arrogant. If you make a mistake, they will just pout and let you figure it out. However, once you've learned the commands/shortcuts, muscle memory kicks-in and you'll not even notice that you're using a different editor at all. Then you'll have withdrawal symptoms every time you use another editor. :w

As a programmer, you owe it to yourself to learn at least one of these very powerful utilities. Even in this PostIntelliJ era, these editors are still very relevant. Of course I'll still use built-in editors of VS.NET/Eclipse on my day to day work (I guess once you're addicted to Intellisense, you can never go back), but there will always be instances where the built-in editor just doesn't cut it. CSV, XML, HTML, CSS files, SQL scripts are all those files that doesn't have the same level of tooling present on mainstream programming languages. Whenever the need arise, you can pull out your VI and start slicing!

:wq

Posted by jop | with no comments
Filed under:

Logged

Notepad has this cool feature that I never seen anyone ever use. When you create a file and place the text .LOG on the first line, Notepad will take that as log file. Everytime you open that file in Notepad, a new line will be appended containing the timestamp and the cursor will be placed under that new line.

I've been using this feature for years now. This is my sole reason for still using notepad. I maintain a LOG.TXT on my home directory, and whenever I think of anything that needs to be remembered, I just [Win-R] LOG [ENTER], type in the idea [Ctrl-S] and [Alt-F4] - my idea is now safely tucked with a free timestamp.

I still have the log files from way back 1998. Most of my entries would actually make good blog articles. Maybe I can post some of them here.

Btw, I first saw this feature on Windows 98. When I tried it out on Windows XP and 2003, it is still there. I wonder if this still works in Vista?

Posted by jop | 3 comment(s)
Filed under: ,

Tears, Flying and Nightmares

I almost got teary eyed after watching the official StarCraft 2 cinematics and gameplay videos. The game brought back a lot of memories - flying command centres, shouts of frustration, and people getting nightmares because my zerglings have reached their bases... again.

Now, if I can only find out where I placed my build order cheat sheet...

Posted by jop | 5 comment(s)
Filed under:

The Web -- Distilled

I know that Google has a mobile website, but I didn't know how good it is. I never had a chance to try it out until I got a new Playstation Portable.

Digression: I was initially eyeing the Sony Reader but I just can't find the device here in Singapore. Despite being online for almost all of my waking hours, I'm still very much a low-tech buyer. I have never bought anything online and I don't even have an online banking account. I like to touch whatever it is that I'm buying before I take out my Moleskine (which doubles as my wallet). I'm not going to start now. The Playstation Portable, however, is quite popular here. I'm quite interested in the big screen - perfect for reading PDF (which is does not support) and HTML (which is does). Anyway, there are applications that can convert PDF to HTML so there's no problem there.

Back to the main story.

PSP supports WiFi. That's a good thing because Singapore now has island-wide free internet access. Just what I need  ;-). - free internet access while waiting for the train. Naturally, I'm going to find out how to read my RSS feeds from PSP. The device has a built-in RSS reader but I don't want to use that. I use Google Reader at home and at work it is working quite well. I can access Reader using PSP but I can only get the top menu bits. The device's browser doesn't support Ajax!

I guess the next best thing is the mobile interface. You can access using this URL - http://www.google.com/reader/m and you will be asked to enter your username and password. The interface is very minimal but usable - just what I like (I'm one of those people who still uses lynx). It strips out the ads and just leaves out the text and images.

And here comes the best part: when you click any link on Google Reader Mobile - you also get a mobile version of the site that you are going to! Instead of going to the address directly, the url will be passed to the Google and all ads are also stripped out. What you get is just the essense of the page.

Btw, nothing going to stop you from using Google Mobile on your desktop PC. You can get the distilled version of your website on any browser. Quite useful when you are at work pretending to, erm, work. :-p. Use responsibly.

Posted by jop | with no comments
Filed under: ,

Envy

Distributed builds? How come Visual Studio does not have one of these?


http://www.apple.com/macosx/features/xcode/

Posted by jop | 2 comment(s)

Freedom!

...eight more months...

Meanwhile, 10 Reasons You Should Never Get a Job
Posted by jop | 2 comment(s)

New Toy

I had a nice chat with a collegue about the ORM tools that we've used. I once did a project using NHibernate and I've been very satisfied with the experience. His tool of choice is base4.

It's the first time that I've heard of base4, so I quickly visited its site. I think it looks good. It even has a 15min-video showing off how fast you can get to a database (Northwind) using it. Not bad.

I think I got a new toy.

Posted by jop | with no comments
Filed under: ,

CBT Games

Computer-Based Training modules are boring.

No, I'm do not mean writing CBT software. I haven't done that sort of applications yet.

I'm bored of actually using them. I've been assigned half-dozen Oracle CBT modules last week. At first, I wanted to breeze through the modules, clicking on Next, Next, Next, Next, stopping only in places where the stuff is not boring or something interests me enough to actually read something. I was through after a few minutes. A module is supposed to take 6-8 hours. I did it in 10 minutes. I am a genius. Sure enough, there is a test after the module. I got 76%. Bummer.

I went back to the training knowing that my "Push the Freakin Button" technique won't work here. The tests expect you to type in SQL code and is very unforgiving. Just a misplaced click and you've messed up your answer. Just a wrong "AS" and your ass is gone. You won't even get half a point for effort. Sheesh.

I don't think CBTs in general are bad. They just don't work for me. I'm the kind of person who learns by making mistakes[1]. CBTs generally  never reward mistakes.

What if CBTs are written as adventure game? I'm not thinking about WarCraft or Ragnarok, though that won't hurt. I am very fond of those antique text-mode adventure games: mud, nethack, zork. Interactive Fiction.[2] Adventure games are fun (if you've got a good imagination. But hey, who doesn't?) and I don't think it is impossible to write well defined quests that teach about EXTRACT(MONTH FROM '10-OCT-06') or puzzles based on how to round dates on months. Weird ideas, right? I told you CBTs are boring.

[1] I think that is why test driven development is very appealing to me. TDD allows me to make a lot of mistakes, helping me learn a lot about the problem domain, and finally lets me correct my mistakes.
[2] I wanted to give you links but it's late and I'm really tired. If someone is interested, I'll post good ones as comments.
Posted by jop | 1 comment(s)
Filed under: ,

End of the Internet

Google Reader got a new look:



It still sports the same VI-inspired key bindings (j for down, k for up) and it even has a new Tag switcher:



There is also a new Goodies tab on my Settings page. This section grabbed my attention:



What is this? Google Reader without using the Google Reader UI? That's odd.

I dragged the Next link onto my bookmarks toolbar (see first image) and with a simple keystroke (Safari automatically binds bookmarks to Cmd+1, Cmd+2, Cmd+3) I was able to navigate through my feeds. It redirects me, one by one, to the feed's website. Instead of seeing content being rendered by Reader, I'm getting the real page. I'm starting to like this.

In a few minutes, I finished all my feeds. Google Reader congratulated me for reaching the End of the Internet.


Wow.
Posted by jop | with no comments
Filed under:

Little Things

Why do I love my Mac? It is because of the care and attention to details that the Apple developers have put to it. I never expected something this petty can affect the way I use my computer. They must have had a lot of spare time.

Let's see if you can find out what I'm talking about.




Clue: the window on the left is the Safari's Download manager, halfway through a file named get_video, while on the right, the icon of the same file.
Posted by jop | 2 comment(s)
Filed under:

Spreading the Infection

cruizer raised a thread on the forums:  Suggest a good demo for TDD for .NET MSDN Event. I wrote this as a reply on his thread.


I've also done a few short courses about TDD. Despite my mediocre communication and delivery skills, attendees still rate the courses highly (I think they don't want to hurt my feelings). But I'm most concerned about this question: How can I apply it to my project? You've shown us a program for scoring bowling games. So what? I'm not writing that type of application. Wow, now I know how to convert numbers to words. Btw, we have an existing library that does that. It can also handle different languages so you can print cheques in french, german, chinese and with a few configuration changes, even alibata. My application has a UI. It writes to a database. It accesses a web service. It employs some wierd calculations that depending on some random user input. How can TDD help me there? Do you have a demo about that, too?

From the feedback that I got from the attendees, I've dreamed up this training course.


The scenario is this: you are one of the developers of on ongoing application designed using TDD. You've got a new team member [pick someone in the audience to act as the new guy] and he is given a task: to implement a new piece of functionality [estimated to take about an hour or two] and add it to the application. As a new joiner, he knows nothing about the application. As one of the developers of the application, you are responsible for introducing him to the team practice of test driven development. You are going to pair with him and help him implement the new functionality. You will initiate the discussion by writing the first test and he will try to implement them. If he is stuck, you'll switch places. The other attendees watch and learn along with your (hopefully) willing victim.

Pros: 

  1. It is a real world example involving an existing application. Attendees would immediately see the benefit of TDD in terms of how it helps in the design of the new functionality.
  2. Attendees would see a clear benefit of maintaining a large number of running tests.
  3. They'll have an existing application to refer to whenever they want to know something about TDD. How do you test a database? How do you test the UI? What do tests look like? How many tests do I need to write? Show them the code and let them use it as a template.
  4. It is very interactive. It no longer matters if other attendees feel sleepy because you've got the full attention of your victim.
  5. At the very least, one of the attendees would surely be able to guage how hard/easy it is to start doing TDD. You picked someone in the audience, a beginner, to have a hands-on designing and coding using TDD. If you happen to "infect" him too, that's good enough for me. :D

Cons:

  1. You need to write an application that you can demo or you need an existing application to use, probably, open source.
  2. It might be hard to direct. You are picking a random someone from the audience. This is no longer just a presentation. You can try creating a script and let your victim just read from the script but that would make this less real.
  3. It might take longer that time allotted to you. But I guess that's a good thing too.
  4. You might need some special hardware (handsfree mic and a good projector, for example) for this to work.
  5. I haven't tried this on a presentation yet, so it might not work. :D

Will this work? Add some nice, hot food and it surely will.

Posted by jop | 2 comment(s)
Filed under: ,

Afraid to Commit


I attended a Configuration Management Training Course at work today.  Rational ClearCase is the software sanctioned by the company. When my outlook client told me about a training invite on my inbox, I was surprised to see that the training is scheduled to take one whole day. Why on earth would I spend one day learning just a version control system?

I turned out that ClearCase is a very complicated beast. Before you can effectively use it, you need to be familiar with VOBs, views, elements and config specs, rules, dynamic and snapshot views, label types, branch types, etc. Even then, you need to understand the proper way of checking out and checking in stuff, reserved and unreserved checkouts, using tools like ClearCase Explorer, Clearcase Type Explorer, Merge Wizard, Apply Label Wizard, and a whole boat load of stuff. Abstraction leaks everywhere.

However, this is not the point of this post.

About halfway through the training, one of the attendees started crying out his emotions regarding one of his bad experiences with  ClearCase. On a previous project, he and his team lost a weeks worth of work when their ClearCase views got corrupted. Let’s just say that a ClearCase view is database of sorts that ClearCase uses to store files that are not yet checked in. It can be located either on a drive on your local machine or on a shared network folder. In the case of the attendee’s team, their views are all stored on a shared network folder. The drive containing the folder got corrupted, and all the files that they’ve checkout and modified were swooshed.

Let’s skip the fact that the clearcase view got corrupted (sh*t happens) and move on to a more important point. Why do they have weeks of uncommitted work in their views? If they only checked in their code before going home, the effect of the corruption would not be as bad. Of course, it still is a days work down the drain, but at least that is not a weeks worth. For a team of 5 people, that is a lot of man hours.

I talked to my some of my colleagues and it looks like it is not and isolated case. What are these developers afraid of? What can’t they just commit or check in their work at least once a day?

It has always been my habit to check in files whenever I’m done with something that I have been working on. Before TDD, that was at least once a day. When I started doing TDD, commit happens at least once an hour. If I am doing lots of refactoring, I am committing code after each and every refactoring: every few minutes. I’d like to think that I’m just getting better; that’s why I’m committing more frequently. But I think real reason is because of TDD, I now have a better feeling of when I am done.
Posted by jop | 2 comment(s)
Filed under:

Book Lust

I've been saving space on my bookshelf for Agile Software Development, Principles, Patterns, and Practices, for more than two years now. I have visited a lot of bookstores in the Philippines looking for the book but not one copy surfaced. I even scoured the P2P space (I am so bad) for even a page from this book; still no luck.

Last Saturday, I was strolling inside Borders on the corner of Orchard and Paterson (Singapore) and meditating on the apparent ugliness of their filing system, when, on the corner of my eye, I happen to notice "C#" along with "Patterns", "Agile", "Practices", "Principles" all on the same spine. I delicately pulled out the Book of Wisdom in between "Rails Recipes" and "Switching to Mac: the Missing Manual" and ran to the counter.

My bookshelf is still longing for the book; I think it is too precious just to be shelved. I've read the roman numbered pages on my way to the cashier, the preface, foreword and introduction in the toilet, and chapter 1 in the MRT on my way to work.

Good thing the book is hardbound.

Posted by jop | 4 comment(s)
Filed under: ,

Agile Forum

This is a two-week old link, but it seems no one here still has knowledge about it. Ron Jeffries is hosting a new agile forum:

It is my pleasure to offer the Agile community a new resource, an Agile Forum. I'm hoping it will be a brand-neutral, consultant-neutral place, open to and shared by everyone who is interested in advancing him- or herself in Agile, or in bringing Agile to the world. I'm inviting you to help make it a place you'd like to be.

Nice.

Posted by jop | with no comments
Filed under: ,

xUnit Patterns

To all those who are test infected, the xUnit Patterns site catalogues a few wheels that you need not reinvent.
Posted by jop | 2 comment(s)
Filed under: ,
More Posts « Previous page