Trying Out MVVM

Last week, I wrote that I was jumping from strategy to strategy, hoping to find the inspiration that I needed to break through my coder’s block. The eureka moment hadn’t arrived by the start of this week, so I decided to cross my fingers and start refactoring to an architecture that seemed like it could plausibly work.

Earlier in the year, I learned about Model-View-ViewModel architecture (MVVM) on episode 3 of Justin Williams’ CocoaRadio podcast. I was in the late stages of building my first iOS app at that time, so it was too late for a major architectural re-think. But I did take some inspiration from MVVM by creating a few classes that presented model information in a view-convenient format.

I hadn’t thought about MVVM much since then, but in my research late last week, I read lots more about it. Here’s a few of my favourite links:

Many of the stated benefits of MVVM, like greater testability, serialization and code re-use, don’t really apply to my current project — but I was struggling with managing state — so I decided that implementing MVVM was worth a shot.

It’s still a little early to declare victory, but I’m happy with how the refactoring effort is going. I now have a view model layer that contains all of the dynamic state for my views and the actions to manipulate that state. Each view model defines a delegate protocol, so a view can register to be notified when the state changes. It feels like a very practical separation of concerns — it’s way easier to reason about state and state transitions when I’m not being distracted by how the views need to be updated to match the new state.

I've reached feature parity with what I had working on my old architecture, and a couple of new features fell out naturally after the refactoring work. That's a great sign. I’m hopeful that the rest will fall into place over the next week or so, then I’ll start polishing the UI and code for release. That’s both exciting and scary! Check in again next week for another update...

Working Toward an Architecture Eureka!

I had a quiet meeting-free week, so I got back to working on my SwiftBoard project. Early in the week, I was making decent progress, but by mid-week my progress had stalled. Adding each subsequent feature was taking longer and longer, and the code was definitely getting smelly. I could tell that I’d reached the point in the project where the original architecture was no longer sufficient — it was time to refactor.

Sometimes this stage is a quick bump in the road. I can see quickly where I’ve gone wrong, or I find a parallel to another project I’ve worked on, and I’m good to go.

I haven’t been that lucky this time. I’m working in a new language (Swift), and I’m tackling more complex user interactions on iOS than I’ve tried before. It’s enough out of my comfort zone that my old bag of tricks doesn’t help me much. It feels like the coding equivalent of writer’s block… it would be a waste to keep slogging through new features in the existing architecture, but I don’t know what the new architecture should be yet.

When I’ve been stuck like this before, there wasn’t a linear path to solving the problem. I’ve tended to pull at the problem from all angles, then eventually the eureka moment strikes. I’m hopeful that will be the case again this time, so I’ve been jumping between research, quick throw-away code spikes, diagramming, and exercise. I feel like I’m closer to the solution, but I’m not quite there yet. Maybe a weekend off will be just the ticket?

Indie Diary - Day 100

I’ve had an eventful and mostly positive first 100 days of independence. This update is way overdue, so it’s a long one... here goes!

Fun Times

Conferences

I attended three great conferences: Çingleton in Montreal, CocoaConf in Seattle, and CocoaLove in Philadelphia. Going in, I was anxious about overcoming my shyness enough to meet new people, especially some of my heros. I ended up doing ok, definitely better than I had worried about. I met a lot of nice, interesting and smart people, which was great… but I mostly chickened out of introducing myself to the “big name” people. I think the best recipe for getting better at this is to keep at it, and to work on doing a little better each time.

Coaching with Jaimee Newberry

One of my favourite podcasts is the currently on hiatus, Unprofessional, co-hosted by Jaimee Newberry and Dave Wiskus. In a couple of episodes, Jaimee touched on the idea of life design, treating everything about your life and career as something that can be designed, using techniques that are similar to how we design software. This made a ton of sense to me, especially in this new phase of my life. I did some more research, and found out that Jaimee had started doing life design coaching. I worked up the courage to write to Jaimee to learn more, and the more I learned about it, the more certain I was that it was going to be a huge help for me.

I’m six sessions into working with Jaimee, and it’s been awesome. We’ve been working through who and what’s important to me, and ensuring that that’s where I’m investing my time. We’ve talked about dealing with burn-out, and I did an exercise that has really helped in moving past the baggage I had from my last job. We’re working on building confidence and new habits, and on how I can share my voice.

If that sounds interesting and helpful to you too, get in touch with Jaimee, she’s the best!

Friends and Family

In the last couple of years, I’ve been lousy about spending enough time with friends and family… but I’ve had a great time catching up. As I start to get busier again, I need to remember to not sacrifice this important time.

Toronto International Film Festival

Colleen and I have talked about going to TIFF for a long time, but we made it happen this year. I really enjoyed the festival, it was refreshing to see a bunch of films that I knew almost nothing about before the screening. I would definitely go to TIFF again, the only thing I’d change is that I’d stay closer to downtown the next time. It would have been nice to have a place for a quick power nap and a healthy snack on the days we saw 3 or 4 films. (P.S. Go see Jon Stewart’s directorial debut, Rosewater, which is in theatres November 14th)

Challenges

Travel vs Momentum

I’ve done a lot of traveling, which has been fun, but it has made it difficult for me to build and maintain momentum on my product design work and coding projects. At times, it has been pretty discouraging to have a couple of quiet days where I could make progress, and then to not make as much of the time as I wanted to.

Consumption

I feel like I’ve fallen into a pattern of consuming way more than I’m creating. It’s so much easier to devour podcasts, blogs, books, etc. than it is to create and release things… but it’s way less satisfying.

I’m back at home at my desk for the next six weeks, so I need to focus on projects that I can finish and release so I can start reversing my ratio of consumption to creation.

What’s Next?

SwiftBoard

I’m a couple of weeks into a side project where I’m re-implementing some of the UI interactions from the iOS SpringBoard application in Swift. The idea was that by working from an existing design, I could focus on learning Swift and some iOS frameworks that I hadn’t used before. I still feel that was a good idea, as I’m not having to make design and product decisions as I go… but I may be trying to learn too many things at the same time.

I’m going to keep at it, with the goal of being done by the end of the year. I feel like there’s a lot of lessons still left to be learned by finishing it up, and also by releasing the code. I definitely suffer from the fear of “being wrong on the Internet”, but I think I need to get over that fear if I’m going to be successful as an independent.

Product Design / Research

I have a product idea that I suspect could be viable and interesting for me, but I’m working on building more certainty. Unfortunately, this is the kind of work that’s hard to measure, and it risks being an excuse to go consume more blog posts and books. To make it more concrete, my plan is to pretend that I have decided to build it, start making some design and implementation decisions, and estimate the cost to build and operate it. From there, I’ll take a step back and see if it still feels like a good bet. My goal is to know by the end of my next 100 days whether I’m going to go for it or drop the idea.

Writing

Releasing code or products is always going to be on an infrequent schedule, so I feel that writing regularly is going to be important for maintaining creative momentum. My goal is to publish something on this blog every week from now on. Please sass me if I’m not doing it!

Debugging FTW

Daniel Jalkut wrote up a great debugging tale in Burn After Releasing, where he traced a crashing bug into WebKit's source, submitted a bug and a patch, and found a workaround for his application. That's a win, and pretty darn cool.