Learning Swift and the Best of Both Worlds play

Well, having suffered through Objective C and liked XCode compiler, it has sure been interesting to see what Apple has come up next with Swift. It’s the brain child of Chris Lattner. He’s had a pretty incredible career, developing LLVM (a compiler backend) and then Clang (a front end) and finally XCode that’s been used for Apple’s development tools.

The Swift uses LLVM and runs in the same environment as Objective C, but has scripting like constructs built in as well as being strongly typed, so it is in the middle ground between scripting simplicity and the power of C. The iBook is actually a pretty good description of everything that it can do with native support for sequences, lists, ranges, it is pretty neat. If we were doing a marketingplaybook.com essay, it would be about how Swift is the best of compiled and interpreted languages:

  • It has the really nice abbreviated syntax of a Python but has the strict type checking of Objective C (sometime even more so)
  • It has the power of classes and because it uses the LLVM backend, you can mix and match it with Objective C

And Playgrounds let’s you make changes and insert code and see what is happening on the right pane. Pretty cool because Swift incrementally compiles so it really is the best of both worlds.

Others are doing the same thing with Google Go and Facebook Hack, so there’s so much more for programmers to learn. How fun is that!

Check this out for coolness where a data structure as a series of sequences and dictionaries and this looks at all the numbers in the sequences to find the largest number:

let​ ​interestingNumbers​ = [
​ ​"Prime"​: [​2​, ​3​, ​5​, ​7​, ​11​, ​13​],
​ ​"Fibonacci"​: [​1​, ​1​, ​2​, ​3​, ​5​, ​8​],
​ ​"Square"​: [​1​, ​4​, ​9​, ​16​, ​25​],
​var​ ​largest​ = ​0
​for​ (​kind​, ​numbers​) ​in​ ​interestingNumbers​ {
​ ​for​ ​number​ ​in​ ​numbers​ {
​ ​if​ ​number​ > ​largest​ {
​ ​largest​ = ​number
​ }
​ }


Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/us/jEUH0.l


This thing definitely has it’s subtleties, for instance the use of question mark to say that the variable may have a legitmate value or a nil is pretty cool but different syntax. Touch-magazine explains it pretty well though.

First there is this cool idea of a data type type that applies to all types, so this means you can make any type Optional:

enum Optional : NilLiteralConvertible {
case None
case Some(T)

This interesting syntax means that there are two cases, with a nil for case and then Some(T) means just return the type. So it allows something like `OptionalInt` which says it can be a nil or an integer value. So that `Int?` just maps to `Optional<Int>` 

There is a different use of the question mark, where it is syntactic sugar that says if the object is a nil then don’t execute it.  Finally, there is the ability to cast things as needed, so there is both “upcasting” and “downcasting”, so you there is this idiom that says takes something and cast it down to its more basic component. For instance, if a string is an object, then the “if let” gives you a nice temporary constant to refer to it as that “downcast” item.


var str : String

if let object=str is NSObject {

   println(“I’m an object at my core”)



Similarly you can upcast something, so for instance with the `as?` it means that if you can see if it is the higher level object or through a forced conversion


var floatValue : Float

if let intValue=floatValue as? Int {

  println(“I can treat this object \(floatValue) as a integer \(intValue)by a forced cast which cuts off the decimal part for now”)



Amazon Affiliates

It’s been interesting to see how the affiliate programs really work. A great example of creating a business platform. As an example Amazon provides affiliates with a margin when anything goes through their site. For instance Amazon Gift Cards is a passthough that allows this site and Amazon to integrate

First we make it possible

In all the work we’ve been doing as we are on the frontiers of technologies, I remember the first ad campaign I saw about technology. It was a great presentation by some great folks and it had a simple theme:

First we make it possible

Then we make it practical

How you get there is all about how you create a really large change in the users mind and how they get excited about it. It leads to having mind share way before the revenue figures get large. Here are some companies that did that like Apple (Apple II, Mac, iPod, iPhone, iPad, whew!), Blackmagic (in video cameras), Go Pro (in adventure cameras), Microsoft (Windows)

Shoot 5K video

Gizmodo makes a pretty darn good point, it a dSLR can shoot 14 fps at 22MP, then you can use it to shoot short videos. As frame rates rise, maybe you get to the point where it won’t cost $30K to shoot a fast video….

This is a great example of how one market and intrude on another. A reverse kind of stealth play when something enters the market from a completely different direction.

Kickstarter…another way to test ideas.

Most of the buzz about Kickstarter has been about how it allows companies to start without venture money. To us though, it is really about something that is more fundamental. It is a way to test market an idea and also to refine the product before you inuvest the dollars. I’d put a company on kickstarter just to see what the response is and also to get some enthusiasts to help you design the product. It is a great way to get a stealth play off the ground.

So for example, using an iPod nano as a watch is a good example. They needed $10k and raised more than $900K. But the bigger import is understanding that people want gadgets like this. 

The D16 is another example. It is a low cost camera in the tradition of 16mm cameras. Not every filmmaker can afford a $30K Canon C100 camera, so like the old days of 16mm, they have found a stealth play that undercuts the traditional and very expensive Sony, Canon and Red hegenomy.

Stocks, bonds, commodities and apple

John told me that an smart analyst looks at stocks excluding apple. It is hard to imagine a company better executing on a drag race than apple. A remarkable achievement but illustrates a very traditional approach to losing.

Apple started out as just another PC company in the sense that there were dozens. It was distinctive in that it like the other systems back then ran in a drag race with its own hardware, processor, software and peripherals.

In the end apple lost to the weight of industry horizontal integration and scale. Intel could invest far more in processors then Motorola and then IBM. Tcp/ip networking had far more volume than AppleTalk. Same for FireWire vs USB. Mac OS vs all those Windows apps

The miracle was Steve took the company from a losing drag race to running a stealth add-on play. He ended up getting the economies of industry standard hardware and software by adopting pci bus, unix, USB, tcp/ip, etc. and most of all in allowing migration (eg rosetta to run old apps) but not being a slave to (eg discontinuing support in 3-5 years).

That let him win in important niches so converting to a stealth segment play. Notably education and graphics design.

But the real innovation at that point was the conversion back to a full drag race with the introduction of the iPod, MacBook, and iPhone. Each of these were best of breed products at rock bottom prices that won on innovation and vertical integration. From the retail stores to AppleCare to the iTunes store, the products were simply easier to use

And because they had manufacturing economies they were low cost leaders. So even at rock bottom prices, they generated enormous cash.

The amazing thing has been to see the companies with the money not invest their dollars but in a horiZontally integrated world, it is very hard to beat a vertically integrated company if it is nimble. There r simply too many organizational boundaries to be crossed. And most importantly the richest companies are hurt last so while they should be responding first, first their ecosystem dies and then they fight when they lose their most important allies, their partners.

So here we are with apple worth more than Microsoft, intel, Sony and Nokia combined. Wow.

What’s next? Well they have converted their drag race into a platform war. Now apple has development resources focused on iOS (underneath that is Unix) and they are converging OS X with iOS so they will have a single platform an software store as well as hundreds of millions of Apple store customers they touch directly.

And with their push into the home most likely following the iPhone model of close integration with wireline broadband providers and content, it looks like the horizontally integrated consumer electronics providers are next.

It is the ultimate model of one platform for phones, tablets, computers and soon televisions. Wow.

The best logos

Panamsat has to be the winner here. It is so great when a radical company does a drag race (in this case against a government consortium Intelsat) and actually wins. But maybe what that means that sometimes the playbook is meant to be broken. It’s a wonderful story, but the logo perhaps tells it all. What a corporate logo! Wikipedia covers it well, but Rene basically broke the satellite monopoly. Sometimes it might not be smart to go at a monopoly, but in this case, its a long story, but focusing on the work.

Valuations (aka as Facebook)

This isn’t exactly a marketing thing, but it is interesting today to see how different companies are valued and what is the logic of it all. Makes me stratch my head a little, but it can either make sense analytically as people have very different view of forward earnings and revenues. Basically, in the old days, the idea is that P/E is a forward valuation based on past earnings, so if you have a P/E of 10, it implies typically that the future growth will be 10%. This is called a PEG ration (P/E to Growth) and that is a PEG of 1.

Today, with companies going public that have negative earnings, you either do P/S (price to sales) or you do what is called a forward P/E (that is use the estimate for when the company is profitable. So for instance in the notational company with a 10% growth in earnings, that means a one year forward P/E would be 9 because it grows 10% in the future. Similarly a five year forward PEG assuming the company grows 10% a year (1.10^5 = 1.6x) would mean a P/E is 10/1.6x or 6.2x. 

So let’s look at some companies that are going or recently have gone public

Facebook. S-1 shipped today (the reason for this piece). The valuation is $80B in the private market on $4B revenue and $1.5B operating profit so probably $1B in net income which means $80B/$1B is a P/E of 80. They would expect $6B next year and $2.5B in operating profit so that is 66% growth. That actually makes the PEG ratio pretty reasonable at 80/66 = 1.2x

Groupon. This one is hard to value as it has negative earnings




Groupon playbook

Well Groupon has to be the storybook IPO of 2011 and it will probably be the biggest company on planet earth, sometimes what works for gigantic momentum plays (eg mega drag race) won’t work for anyone else.

They have billions of capital so can buy large high pressure sales forces. That gives them an incredible advantage like the army of timeshare condo salesman or if you have ever watched Tinmen, aluminum siding people.

In this case I’ve heard time and time again how well their sales tactics work. We just took a massage from a new business owner here in Hawaii. They have two sales reps here and she was promised a huge repeat installed base. Instead they doubled the number of groupons from 450 to 900 and doubled the term to 18 months on her. They now hold over $100k of her money and will pay her on 60 day terms and sounds like they will keep it all if redemptions don’t happen.

It’s brilliant because they get all the money upfront. As a small startup she feels she has no choice but to honor it. She is working basically 24-7 for no profit for groupon for the next year. And the rep is no where to be seen.

And let’s face it the customers haven’t turned out to be long term but very demanding price sensitive folks who won’t repeat. not something to build your business on.

What can we learn from this. Well for Groupon it’s an extraordinary opportunity with so many new businesses forming all the time and extremely profitable. But it sure won’t work for everybody…

Blooks and Blogs

I can’t believe it has been five years since The Marketing Playbook got published by Penguin. Quite a long ride for us. The more interesting thing is to see how much the book publishing business has changed. Now you don’t necessarily need a publisher, you can self-publish on Kindle. Now blogs commonly become books (blooks which are a cute name :0). For everything from Julie to Julia to 101 Things to do with your ex-wife’s dress.

Maybe that’s the future for everything but as barriers to entry fall and technology changes, that’s when the market really does evolve.