Your Intention Stack

Have you noticed the seam between habit-land and your editing software?

Habit: I want to go to the start of the next line – <end> <right>
Software: moves the cursor around

Habit: I want to tidy up that bit of code
Software: indent region

When we’re working, we have a stack of intentions. Mine, for one project I’m working on, looks like this:

  • Business problem: We want to mitigate the new year slump in sales
  • Proposed solution: Let’s implement a coupon codes feature and run a promotion with it
  • Story: I want to display the discount at the checkout after the code’s been entered (*failing acceptance test*)
  • Unit test: I need a way to calculate the discount
  • Code: Write a method to do that
  • Editing: Type some code, refactor it a little, indent everything
  • Habit: Press this key, press that key
  • Software: Perform those edits

Each of these layers is a world in itself, but today I’m particularly interested in the seam where our intentions meet software. How much of our editing do we perform inefficiently in habit-land when we could push it down to the software layer? When we want to indent some code, are we mindlessly indenting every line individually when there’s a feature to indent the whole region in one go? Is this a common code construct that could be inserted with a snippet¬†instead of typing it every time? Could we write an emacs lisp function to perform that mini-refactor every time we need to?

With attention to this interface between our intentions and our code, we can minimise the friction at that interface and make the experience of coding that much more joyful.


Next week, I’m releasing Emacs-fu, an email course on emacs designed to stick with you and make your editing more flowy. Pop your email down here and you’ll receive an awesome-blog-reader-person discount:



Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Twitter

Random readings...


     
     
     

    One Response to “Your Intention Stack”

    1. Oleg
      26 April 2013 at 16:30

      That’s not really the last edtied location but the last position of the cursor. To be able to get back to the last edit point in a buffer is also very useful. I’m doing it like this:(defun goto-last-edit-point () “Go to the last point where editing occurred.” (interactive) (let ((undos buffer-undo-list)) (when (listp undos) (while (and undos (let ((pos (or (cdr-safe (car undos)) (car undos)))) (not (and (integerp pos) (goto-char (abs pos)))))) (setq undos (cdr undos))))))(global-set-key (kbd “C-c SPC”) ‘goto-last-edit-point)

    Leave a Reply

    CommentLuv Enabled