CodeMash 2011 was great!! I really enjoyed the talks, the venue, the food, and the chance to meet up with friends. So, in an effort to remember everything, I’m recapping things on my blog. This is not exhaustive, nor is it all that polished. It’s kind of a high level summary with links to resources as appropriate.
Here is Part 1 of 2, which covers Wednesday and Thursday. Friday’s notes are still in my nice little Moleskine notebook that they handed out at CodeMash.
Here are the sessions that I attended at CodeMash 2011. The links point to the info from the mobile site that I used while at the conference. The mobile site (http://codemash.mobi/) worked very nicely, and I ended up using it, even though there was an Android app available. I think I favored the site because I figured it would be the most up to date, and because it had a feature that let me create my schedule very easily.
- PreCompiler: Ruby Koans – A Gentle Introduction to the Ruby Language (Half day morning)
- PreCompiler: Android Application Development, From Start to Published (Half day afternoon)
- Keynote: Chad Fowler (Author of “The Passionate Programmer”)
- Netflix in the Cloud
- Asymptotics and Algorithms – What You’ve Forgotten Since University
- Microsoft WebMatrix Product Launch
- LINQ Scalability
- Functional Programming for Everyday .NET Development
- Mixing and Matching Platforms in a Command-Query Architecture (CQRS)
- Cocktail Party
- Waterpark Party
- Keynote: Scott Chacon (of GitHub)
- Are You Satisfied With Your Tests?
- Write Managed Applications For Android with MonoDroid
- Infinitely Extensible
- Anatomy of an E-commerce Web Site
My 2 Cents
PreCompiler: Ruby Koans – A Gentle Introduction to the Ruby Language (Half day morning)
This session was really helpful. They introduced a couple things about Ruby, helped us get it installed on our laptops, and then got us started on a set of instructive unit tests called Ruby Koans. These unit tests are setup so that they all fail initially. The goal is to work through the tests, correcting them as you go, and learning how Ruby works along the way. There is a nice little script that wraps these test together, making it easy to run the tests and see how far you’ve progressed.
You can download the Ruby Koans, and get some helpful setup advice from the Ruby Koans download site. These are great exercises and make it a pleasure to learn Ruby! The link is for the windows install instructions, but there is also a *nix page.
I’m intrigued by Ruby. As a language, it has some neat features and provides a refreshingly new set of ideas. It has a certain elegance to it, making it attractive as a language. There is also a culture and set of practices that typically come with the language. The community seems to be passionate about the language and eager to help others. The practices include an assumption (practically a requirement) to do unit testing, with a “starting point” of 100% coverage as a goal.
Some of the cool features include:
- Calling a Function = Sending a Message to an Object
Function calls are actually “sending a message with parameters”. This enables a feature called “MethodMissing”, where the object can catch calls to a method that doesn’t exist. Then it can react in interesting ways.
This feature is used in things like Rails to provide “lazily created” Find_By_ methods. The method doesn’t exist initially, but if MethodMissing intercepts the call, and it starts with “find_by_” then it will add a method to the object that does the appropriate lookup.
This is also used in a library called “Builder” that can be used to create XML documents by simply setting properties on an object. The Builder library (aka gem) watches for these calls and uses them to construct an XML document behind the scenes.
There are some neat features in the language that make programming a pleasure. For example, arrays and hashes can be compared, modified, and constructed very easily using language semantics. Similar operations are possible in .NET with BCL and other library features, but in Ruby, this appears to be part of the language itself.
There were some things that surprised me about Ruby too…
Until recently, it didn’t support multi-threading. Concurrent execution required a separate process. This is not a big deal on Linux / Unix, but still seemed a little strange for my Windows saturated mindset.
Overall, I think I’d like to continue exploring Ruby and it’s cousin IronRuby. I’d also like to explore some of the popular usages of Ruby, such as Ruby on Rails to see how that all works.
- Ruby-Lang.org(Official Ruby site)
- RubyInside.com (Ruby Blog)
- Peep Code – Rails screencasts
- TryRuby.org (Code Ruby in your browser)
- Book: “Agile Web Dev with Rails“
- Book: “Learn to Program” (uses ruby to teach programming)
- Book: “The Best of Ruby Quiz“
PreCompiler: Android Application Development, From Start to Published (Half day afternoon)
Of all the sessions, I think this was possibly my favorite. It really helped me get over that initial hurdle of understanding. The speakers were:
The session started with instruction and assistance in getting our laptops setup with the dev environment (Eclipse, Android SDK, etc). This took a while for some, but I had installed it ahead of time. I wish I could claim this was intentional, but mostly it was coincidental that I had already messed with android development on my own.
Once most people were up and running, the speakers introduced a bit about Eclipse. Then we talked a bit about the android project structure. Then we walked through a couple sample apps and did some exercises on our own.
The main exercise was to duplicate Jeff’s “Simple Counter” application. This app displayed a count and had three buttons (Increment, Decrement, and Reset). Jeff’s version had a nice design to it with stylized numbers and some related sounds. I’m pleased to say that I was able to re-create this in Eclipse within the allotted time. Mine lacked the bells and whistles, but it worked!
Recreating Jeff’s sample app and seeing his other demo apps were the most helpful for me. I was able to draw parallels between my understanding of .NET and XAML, get past the differences of Java’s syntax, and start to see the light at the end of the tunnel.
Here are some of the “words of wisdom” and cool things that they shared:
- 1.6 is the lowest common denominator between phones & tablets. This is a good version to use if you want broad compatibility. It is also notable that not all of the 2.2 and 2.3 features are implemented by the hardware, so using those features can be problematic.
- Relative layouts are typically the best option. This is because of the large variation in screen sizes and the effects of screen rotation.
- It is possible to have different layouts for landscape vs portrait. This can help optimize the UI.
- IDs with an @+id prefix mean that the compiler will generate the ID related to that resource. These resources can be referenced inside the XML by using an alternate ID syntax that doesn’t have the “+” in it.
- Selectors let you change a button based on pressed state. Selectors go in the drawables resources. These are somewhat similar to styles and triggers from XAML.
- The built-in designer is a bit cumbersome and somewhat fragile. Speakers noted that it crashes periodically, and it can be difficult to drag things into the proper positions.
- There are a number of open source designers that make designing layouts easier.
Open Intents (Sensor Simulator)
- Helps test apps by simulating the sensors of the device. Specifically, the orientation sensor.
- Jeff noted that in his apps, he found Google’s GSON library to be the best option for JSON serialization.
- It is recommended to use a tool to limit network bandwidth on the PC’s emulator in order to simulate the phone’s speeds. This will help discover the user experience issues that might happen in production.
Keynote: Chad Fowler (Author of “The Passionate Programmer”)
Chad Fowler’s (@chadfowler) keynote on Thursday morning was really good. He’s a fun speaker and skillfully delivered us through a thread of topics ranging from McDonalds to Six-Sigma to IT Outsourcing.
My takeaways from his presentation…
- What is quality? We talk about this frequently and use it as justification for many design patterns, abstractions, testing disciplines, and methodologies. In the end, quality is a bit of an elusive concept and is somewhat in “the eyes of the beholder”.
- “Zen and the Art of Motorcycle Maintenance” provides and interesting look at the pursuit of quality from a discipline other than IT.
- “Code quality is ‘Form’. Companies care about ‘Function’.”
Books to read…
- Zen and the Art of Motorcycle Maintenance
- The E Myth Revisited
- The Passionate Programmer
- The 4 Hour Work Week
Concepts to Consider…
- Outsource parts of your life: http://www.AskSunday.com/
The idea here is that you can call them up and ask them to handle some tasks that you’d really rather not handle yourself… like scheduling a dentist appt, booking tickets, etc.
- Outsource parts of your job: http://vmgbpo.com/
As above, you outsource parts of your job. In this case, the company has a bit more business / professional focus and could do things like research for an article, line up interviews, etc.
- McDonalds… You might not consider their food high quality, but that’s not necessarily their top goal. Where do they exhibit quality? In their ability to consistently and reliably reproduce a restaurant environment over and over. Their quality is in their franchise process.
- Six-Sigma… A strange subculture with strange acronyms and strangely complex process charts. But that could describe any area of IT. So, when the jokes and jests are done, Chad feels that Six Sigma offers us some valuable lessons. In the end, it helps groups take the ambiguity and emotion out of a discussion so that the team can get down to a measurable and precise definition of what’s needed.
- Outsourcing… Love it, or hate it… That all depends on your perspective. Chad explained that for part of his time he was offshore, operating an offshore team. While there, he began to have the feeling that his team was the group who “knew what they were doing” and the other guys were the ones messing everything up. Why? I think I’ll need to read the book to get that full picture.
Netflix in the Cloud
Carl Quinn (@cquinn) delivered a nice presentation, originally created by Adrian Cockcroft.
The talk is available on InfoQ (http://www.infoq.com/presentations/Netflix-in-the-Cloud).
Netflix desires to:
- Make the cloud a commodity item, where vendors compete on various aspects of their service, but present a similar and/or standardized set of APIs and interfaces.
- Forge a path to help the rest of us understand how to survive and thrive in a large scale cloud based deployment
Netflix chose Amazon Web Services because they wanted to go with an established vendor, who had experience in the cloud and had supported other larger clients. Netflix did not want to be the biggest fish in the pond for the chosen vendor, and as a result, be somewhat of a guinea pig.
The talk was very good and there are a lot of other lessons in the slides. For me, it was good to see information about AWS. It helps me to understand Azure a bit more, both in how they are similar and in how they differ. There was also some good info about how Netflix architected their systems to be modular, performant, fault-tolerant, and loosely coupled. The last point about loose coupling was especially interesting to me. Carl explained a couple points of their design that specifically addressed some implicit coupling that existed in the prior version. The solution involved some interesting approaches, including a product called AVRO to address data format and serialization concerns.
Asymptotics and Algorithms – What You’ve Forgotten Since University
Gary Short (@garyshort) gave a nice talk that walked through the steps in analyzing and calculating the “Asymptotic Notation” formulas used to compare algorithms. For me, this was very helpful since I did not go to school for CS. His talk started with an Insertion Sort algorithm and showed how we could derive the O(n) = n^2. We then went on to analyze the Merge Sort algorithm (with a nice explanation of it’s strategy via an analogy using a deck of cards). From this, we derived that a merge sort has more of an O(n) = n log n behavior. As part of this explanation, Gary shared that he prefers to use the “Master Method” when handling recursive algorithm derivations.
Gary shared a couple of good resources for further study:
- Harvard Podcasts on Algorithms and Asymptotics (available on iTunes)
- “Beginning Algorithms” book
Microsoft WebMatrix Product Launch
During lunch, Microsoft was there to do their live webcast event announcing the RTW of WebMatrix and a host of other related technologies. The session included a number of notable names, including Josh Holmes, James Senior, Shaun Walker (of Dot Net Nuke), and more.
The broadcast was pretty cool, and Microsoft brought in some nice equipment to make it happen. It was cool to be a part of it and see it all happening live. I’m excited for WebMatrix. I hope it catches on since it’s got some great work behind it. It was the impetus for NuGet, it has a sweet new view engine (Razor), and it makes it super simple to make a site that has some powerful integrations with services on the web (paypal, facebook, etc).
Jim Wooley (@jimwooley) put together a very nice presentation on how to use LINQ efficiently. He used some unit tests to demonstrate some common pitfals and showed how to do some easy performance comparisons.
His slides are available online at ThinkLinq.com.
Some of my takeaways…
Just the use of linq (instead of a for loop) has a perf cost. It’s not huge, but there is a cost. This cost is related to the closures and state machines that linq has to build behind the scenes.
Using LINQ for complex scenarios results in radically simpler code that the equivalent non-linq version, making the overhead become somewhat negligible compared to the maintainability of the linq-based version. There is also a lot to be gained by using well tested linq operators over the equivalent set of custom code required in a non-linq version.
For LINQ queries that are used against a database (Linq to SQL, EF, NHibernate, etc), there are a number of things that can affect the performance. Some simple ones include:
- Use .Any() rather than .Count() >= 1. This translates to EXISTS() in SQL, which can “short circuit” the evaluation once it finds the first match. The .Count() version must iterate the entire set, which is not necessary.
- Turning off ChangeTracking in a query can improve perf for read-only data
- Be careful about Lazy Loading. This can end up sending large numbers of queries to the database. If the code will need to access all of the records, then fetch them eagerly with a .Include() or the equivalent.
LINQ joins on in memory instances don’t have a good performance characteristic. The algorithm is effectively a table scan over the two collections. There are implementations of .Join() available to make use of in memory indexes over the two collections. These indexes have an initial setup cost, but dramatically improve performance for larger collections. An example of this is available via the I4O project.
Functional Programming for Everyday .NET Development
I was really looking forward to hearing Jeremy Miller (@jeremydmiller) talk. I’ve followed him on Twitter for a while and appreciate his passion for high quality software and good application of patterns / principles. Jeremy has written a couple well known libraries like fubuMVC and StructureMap.
His talk on Functional Programming was not quite what I expected, but it was excellent nonetheless. I expected that the talk might include F# discussions and usage in a more real-world, every day case. Instead, we got some nice examples of using a functional style in C#. The examples showed how to use the power of the language (lambdas, delegates, etc) to move toward a functional design.
Jeremy showed a number of examples of this style using some of his production code, as well as some sample apps. These included examples of a “Continuation Passing Style” implementation and a discussion of the surrounding concepts.
His MSDN article is available and explains this much better than I can do here.
Mixing and Matching Platforms in a Command-Query Architecture (CQRS)
I went to this one because I’ve heard of CQRS and like the idea. Unfortunately, I was late to the session and missed the CQRS part. The remainder was a demonstration of connecting a ruby front-end to RabittMQ, which in turn talked to a .NET backend. This was interesting, but without the CQRS discussion (which I missed), I didn’t get a whole lot out of it.
Part 2 (Friday’s Sessions) coming soon…