Programming Partition-Aware Applications