Saturday, March 31, 2012

As the story dragged on


The main reason I decided to experiment with non user-visible stories was to keep stories short. That part worked great; as long as they were short, I breezed through the stories and was eager to start the next. But then one particular story — I'm looking at you, story 19! — turned out to be a lot more work than expected. As the story dragged on, I lost my motivation... and then it took even longer to get it done. I would like to avoid this situation in the future, if possible.

But how? By adjusting my process, of course! Ideally, I should be able to complete each story in one sitting; and now that stories don't need to be user-centric, there is no reason not to make them as small as needed. If they aren't, then the plan needs to be refined. Thus, this time, I am going to break something even more fundamental than the user-centric nature of stories: the fixed-length iterations! How naughty.

This iteration will end in one week, or when a story drags on for more than a day, whichever happens first. If it is the latter, I will have the opportunity to adjust the offending task, by dividing it into smaller chunks.


Alternatively, I could rethink my design so that the offending task is not needed, or vastly simpler. Or just different. Or more fun to code.

I mention this possibility because I stumbled upon a post from a writer explaining how she quintupled her productivity by optimizing her process, and she found out that she was more productive when writing scenes she was enthusiastic about. Well, I was enthusiastic about Story 20. And hated Story 19. I'm not sure why.

In order to figure it out, from now on I am also going to write down the best and the worst story of each iteration. Hopefully, a pattern will emerge. Although, to be honest, even if I had an easy criterion to distinguish stories which are going to be fun from those which are going to be boring, I don't really know what I could do with that information. Sure, some stories are less pleasant than others, but they still need to get done, right? Unlike passages in a book, if the code is boring to write, it doesn't mean the user won't enjoy the result. Who knows, maybe I'll find a different software organization which minimizes annoying tasks?


Iteration 5

As yet another crazy departure from conventions, I'm dropping story numbers. They haven't been very useful so far.
  • Setup continuous compilation (using Substrate to detect when the source files change).
  • Use signals to propagate errors.
  • Implement an InputNode which can bake itself.
  • Implement a Gui which links the input nodes with the input pane widget.

Saturday, March 17, 2012

Who cares about the user?

As promised, I am going to play with my process. Unlike what I promised, I am not going to waste an entire iteration on this. I am going to waste several!

I have already tried one change: scheduling optional stories. It didn't work, but I'm glad I tried. I am not on a tight schedule, so I can take the time to experiment and see what works. I even tried the Spiral idea of trashing all my code and starting from scratch using my newly accumulated experience: that's what I did on the very first iteration, when I decided to drop everything and start fresh, Agile-style this time. What should I try for the next iteration?


Well, is there something from the last iteration which could be improved? Let's see, was there anything at all which went wrong? Let me think. Oh, right. Maybe the fact that I totally failed to produce anything at all?

Yeah, during the past iteration, I didn't accomplish much. Or rather, that's what you would think if you only looked at the number of stories I completed: zero. And indeed, when I run Substrate, it looks exactly as it did two weeks ago. But that is only part of the picture! Sure, the look didn't change and there are no new buttons to click on, but I did spend a lot of time working on Substrate, trying out new architectures and comparing design approaches. Even as I worked, I felt like I was wasting precious time, because days went by and my metric wasn't improving.

Well, screw the metric. Screw the users, I mean. Erh... that's not what I meant either.


This iteration, I am testing a variant on story descriptions: instead of focusing on user-visible features, I am going to focus on developer-visible features. If code needs to be written, then I don't care whether that code is producing buttons, menus, bells, or whistles: by golly, this code is going to be divided into small story-like chunks and assigned to an iteration!


Iteration 4

This iteration is still about geting Substrate to interact with external files, but the steps to reach this goal are more detailed. Stories 18 and 20 have no user-visible impact.

Story 10 (1 story point): I can save the current project. Use a version number in case the format changes.
Stories 11 to 16: Postponed.
Story 17 (1 story point): I can reload and run the entire project.
Story 18 (1 story point): Simple filesystem-backed key-value store with one file per key.
Story 19 (2 story points): The project reloads when the filesystem copy of the store changes.
Story 20 (2 story points): Specialized store interface for strings, integers, and string arrays.
Story 21 (1 story point): The project stores the active input tab.


p.s.: Don't take the title of this post seriously. The only user Substrate ever had, so far, is myself.

Thursday, March 15, 2012

Unifying the Agile and Spiral models

If, like me, you have never heard of the Spiral model of development, here is a summary: it is a bit like Agile, except that all the code is thrown away at the end of the iteration. Also, the scope increases each time, so the iterations grow longer and longer.

Yes, I know this sounds like a terrible idea, but that's only when compared to Agile as a reference point. From that angle, Waterfall is the model where you only get one, very big, very long iteration, and hope to get it right the first time. When put in the context in which it was invented, doesn't the Spiral idea of starting with a smaller version of the project seem like a great improvement?

Not throwing away the code all the time sounds like an even better improvement, but when I first heard of the Spiral model (just a few hours ago), I thought the opposite. Throwing code away! What a novel and intriguing idea! Should I try? Maybe? Being in an Agile team doesn't guarantee good design, after all. And changing a bad design is sometimes a large endeavor. With Substrate, for example, I haven't been able to implement any story at all this iteration, because I was busy refactoring the entire application to use MVC.


Instead of being forced to either drop all the existing code or keep all of it, I suggest we should be allowed to do either. And those two possibilities are just two ends of a continuum: using version control, we can easily revert to a number of intermediate steps between the two extremes, whichever is most convenient.


An Example

Let's start with an empty project, in the middle of Design Space, the space of all possible designs.



We discuss the product idea, draw a bit of UML, and end up with a particular design (a particular point in Design Space).



A few iteration go by, moving the project toward the goal established in the design.



While implementing new features, suppose we come up with a new design for the project. Could happen! Otherwise, we would still be doing big design up front and it would work great. The goal is moved a bit to the left.



Since we are using iterations, we adapt to this unexpected change without a sweat. We just start writing the new code with the new code in mind!




But what if the new design was very, very different from the first?



In that case, starting from scratch is less work.



But this is not an all or nothing decision. Yes, you can start from scratch, but you can also start from any other past point. Just pick the one which represents the least amount of work!



Future Work

Now, as I said, I only heard about the Spiral model today, so there are still many rough corners in my generalization of it and Agile. For one thing, going back in time means removing some features, and if those features have shipped already, maybe you don't want to remove them. Feature Space is not necessarily aligned with Design Space.

The other big problem is that history is linear, while Design Space is multidimensional. When your goal changes its position, it probably won't move across all the dimensions, only some of them. So while it is true that some of your code can be thrown away, most of it probably shouldn't; in order to reach the commit you want to restart from, you will have to throw away some commits which are still good, just because they were submitted after the restarting commit. I recommend using a history-rewriting tool such as git, but when I tried, solving all the merge conflicts was still a lot of work.


Ideally, each new feature could be implemented on a bare-bones version of the application, containing only the elements on which the new feature builds. In that setting, implementing the new feature is much easier, because there are no unexpected interactions with the other features, the codebase is small enough to be understood all at once, and the debug-edit-compile cycle is fast. Theoretically, using feature branches, maybe this ideal could even be reached!

The problem, of course, is that the unexpected interactions bite back once we try to merge all of the feature branches into a complete product.

I think I am going to try anyway. If I can afford wasting an entire iteration redesigning my code, maybe I can also waste one redesigning my process?