Friday, November 2, 2012

Monkey Space 2012

SUMMARY: Monkey Space is the annual conference on cross-platform and open source .NET development. At $300, it was money well spent. Mono/.NET code is running on all major devices and represents a compelling platform for flexible, performant, future-proof development. Things to keep an eye on: Xamarin for mobile development, ServiceStack for web services, Type Providers for type-safe access to just about anything.

Below are my notes from the talks I attended...


Keynote by Miguel de Icaza

Miguel is the CTO of Xamarin, and the director of the Mono Project. A few points from his talk follow:

  • Casual gaming platform for Sony and Nintendo mobiles is Mono-based.
  • Unity also leverages Mono
  • Mono 3 is out and includes a fully-featured C# 5 compiler
  • Half Xamarin sales are iOS, half are Android
  • Forecast that in five years everyone will have mobile device

Direction

  • no longer to port Microsoft APIs to other platforms
  • rather exposing every native feature on every platform
  • ServiceStack is becoming industry darling for web services (Mono first)
  • aggressive optimizations
    • LLVM optimizer
    • will hardware accelerate some data types like matrix (OpenTK, XNA)
  • static analysis tools
  • working on profiling tools

ServiceStack by Demis Bellot

I heard that this was Demis' first talk on ServiceStack. If so, the only reason I might suspect that is that he had enough material to fill a day. It was my favorite session at the conference.

The slides are available on slideshare: http://www.slideshare.net/newmovie/what-istheservicestack-14819151

Demis described his past experience at the BBC, and how their zeal to do everything the right way lead to a slow, unwieldy architecture. He used this to motivate the discussion of ServiceStack's design choices such as a fast JSON parser, few dependencies, POCO DTO's (Plain Old CLR Object) (Data Transfer Object), etc.

What we did right at the BBC

  • pub/sub
  • message queues
  • DTOs

References

What is a Service

  • reusable capabilities available remotely
  • many clients
  • accessible, interoperable

Some Interesting Features

  • Supports Google protocol buffers
  • IAuthProvider for authentication
  • Develop on Windows but deploy to Linux so can scale at $0 license cost.

F# 3.0 by Don Syme

Don Syme presented some of the latest features of F# 3.0. Of particular interest were Type Providers. Type Providers are a tool for generating rich static types for data and functions that are normally accessed dynamically. He demonstrated accessing data from Freebase.

Dr. Syme is clearly an advocate of functional and multi-paradigm programming. My favorite quote from the talk was: "The dark days of object fundamentalism are past us" ... "we got lambdas in C++".

Here are some interesting links for diving deeper:


Moving to Mobile by Somya Jain

Somya described the pitfalls he ran into when transitioning to mobile development.

  • Memory
    • constrained. No swap.
    • varies by device
    • low memory warning
  • Memory bugs
    • Leaks
    • Overrelease
    • Long lived references not GC'd
    • How to detect?
      • Instruments (iOS)
        • Use zombies to detect objects used after freed
      • Android Memory Profiling
  • Bitmaps
    • Decoding, scaling, cropping happen on main thread
    • do some things on background thread
    • use in memory caching tools
      • NSCache (iOS) LRUCache (android)
  • Network
    • Slow, intermittent
    • 3G v WiFi
    • Use multiple network connections (e.g. Downloading multiple files e.g. 4 at a time)
    • use caching, offline mode
    • consider pre-loading data when know the user's steps
  • CPU
    • do performance intensive stuff on b/g
    • consider gpu

Tip: Always test performance on the device (worst one required)


Micro ORMs

Simple, lightweight, but no automatic relationships

Can use multiple on same project to leverage their strengths

http://johnnycode.com/MassivelyDapperSimpleData/

Dapper

https://github.com/SamSaffron/dapper-dot-net

  • Use POCOs or Dynamic
  • Intellisense with POCOs
  • caches reflection mapping

Massive

  • optimized for writing
  • uses ExpandoObject for reading
  • serializing an expandoObject to JSON does so as a dictionary; not quite what you expect
  • ActiveRecord-like hooks like AfterUpdate

Simple.Data

  • Syntax is easy to grok
  • Mocking support out of the box
    • using SimpleData.Mocking ... MockHelper.UseMockAdapter(new InMemoryAdapter())
  • Can get back a dynamic or strong-typed object
  • ActiveRecord-like FindBy

MonoGame

See tool called Project Linker for synchronizing projects and content compilation


Graffiti

Graffiti is "a cross-platform high-performance rendering engine" optimized for mobile hardware.

  • data-driven
  • retained mode
  • time-driven animations, independent of frame rate
  • takes advantage of C# syntax
  • uses XNA Reach profile for low power hardware

MonoDevelop Workflow

Monday, January 2, 2012

The Server / Clients Architecture

Modern software applications should be divided into client and server components. This is not a new concept. What's new is that you need more than one client.

The ubiquity of heterogeneous personal computers pluralizes the client.  I expect to be able to access Pandora from my work computer, home notebook, phone, tablet, video game console, car and blu-ray player.

As users demand this Cloud Experience, the implementation demands a Server / Clients Architecture.

The responsibility for storing the user's data belongs to the server.

The responsibility for providing a device-appropriate interface to the data belongs to each client.

Many application developers will resist.  On the surface it seems like more work for questionable gain.  But there is no stopping this trend.  And I believe it is in our best interest to embrace it.

First, we need not fear having to re-write each client from scratch.  We will be able to share code between them.  Identifying patterns is a hallmark of good architecture.

Second, the more clients you have, the more valuable your server becomes.  This plurality of clients opens doors to new opportunities: technical innovations, pricing models, market segments, service offerings, competitive advantage, ...

So, application architects, I encourage you to ask yourself how you can apply the Server / Clients Architecture pattern.  This is only the beginning.  We may enable our users to experience a synergy between their devices as yet unrealized.