- WTF twitter.com/realdonaldtrum… 10 hours ago
- Nice I love D3! gag.gl/eK0juj 21 hours ago
- RT @blackgirltech: If you're a Black woman & want to learn how to code but need some financial help, you should apply for the https://t.co/… 1 day ago
- Louie is growing so fast! https://t.co/hfvOqScGp3 1 day ago
- RT @vibronet: Open standards should be table stakes for everyone - but won’t be enough to save you from vendor lock-in https://t.co/TbMebtG… 1 day ago
November 8, 2011Posted by on
I have subscribed to Derick Bailey’s blog for several years. He is one of my favorite Los Techies. I think he has a firm understanding of agile development practices and is one of the many progressive .NET developers to jump ship and start doing Rails development. So I was pretty excited to see he was producing his own screencast series over at WatchMeCode.net.
I am a rabid consumer of screencasts and even attempt to produce some of my own. So I am aware of some of the time and effort needed to create a quality screencast. Derick’s initial offering is a bit pricey at $14 for a single screencast, but you do get to download the video and do whatever you want with it. Derick offers HD 1680×1050 and iOS ready 720p versions. The encoding is very good, text is quite readable and the sound quality is great.
Derick starts out by first wrapping his current plugin’s implementation in a module and explicitly exposing a public API. In this refactoring he introduces a Memento object that represents the public API he wants to expose to users. He then moves on to introduce an internal Serializer object that handles all serialization concerns. This refactoring leaves his original code fairly lean and responsible for stack manipulation, so he names it as MementoStack. While he is focusing on clearly defining single purpose types, he identifies several minor smells like excessive guard clauses and repetitive if switches related to the type of Model being stored. He introduces a TypeHelper type that encapsulates the type decision and exposes a single API, which removes the concern from the other objects. This was a particularly clever refactoring which was worth seeing. After all the refactoring, Derick is able to identify a couple of bits of redundant code that he quickly explains and removes. This refactoring was interesting in that it wasn’t very apparent until the other refactorings had paired his code down to small easily digestible functions. Finally, he breaks a dependency from the MementoStack to the Serializer, by pushing the interaction concern up into the main Memento object greatly simplifying the two and giving the Memento object behavior.
Derick was able to completely refactor his plugin and end the session with his original Jasmine test suit all green. It was very enlightening to to wach him make a modification, run the tests, troubleshoot any failing tests until they passed, then start the whole cycle again. These failing test situations were not simple contrived examples, you could hear the surprise in Derick’s voice as tests failed. Listening to his troubleshooting techniques in these real situations was pretty fun.