The Swift Programming Language – Day 2 – Classes

Oof, starting out the day kind of rough yesterday. I’m working through the first two paragraphs of the book’s section on introduction to classes and I’m a bit stumped. In general I understand object oriented programming, inheritence, polymorphism, etc… Having said that I sometimes get caught upon the syntax and the issue I’m having today doesn’t even really have to do with classes I don’t think. Right in the beginning of the intro to classes there was the following experiment:

“Add a constant property with let, and add another method that takes an argument.” 1

I understand what ‘creating a constant property’ is and know how to do this using let:

let shapeColor = "Green" 

What I don’t understand is the “add another method that takes an argument” part. An argument is just a variable something that you pass into a function. I assume it just wants me to create a function (is that synonamous with method?) that takes an argument… which I’m assuming it’s trying to get me to use the constant that I just created (shapeColor). I don’t really understand this in context of the class I just created? What am I missing here? Here’s an exerpt of the code I just wrote from the example in the book:

class Shape {
    var numberOfSides = 0
    let shapeColor = "Green"
    func simpleDescription() -> String {
        return "A Shape with (numberOfSides) number of sides."

After doing a bit of reading on StackOverflow I think I might have a feel for it now. It seems like a method is a function that you use to get at a property contained in a class. In the example below. I’m just calling the method and passing it a color which then returns a string that uses the color I passed into it. I think i was a bit confused because the book was calling it a method but the sytax still refers to it as a function (‘func’).

class Shape {
    var numberOfSides = 0
    let shapeColor = "Red"
    func simpleDescription() -> String {
        return "A Shape with (numberOfSides) number of sides."

    func getColor(color:String) -> String {
        return "My shape is the (color) color - which is very nice."


var shape = Shape()

  1. ”Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks.

Learning Swift Programming – Day 1

The Swift Programming LanguageOkay, well technically it’s not Day 1 (but i wan’t to recap my learnings once a day and this is the first post).  I’ve been working through the “The Swift Programming Language” for about a week now. I’m on page 18 of the book and I’ve written ~287 lines of code in the playground. It’s a ton of fun to go through but I find myself not exactly understanding everything.

Specifically this example below.  I understand that is sorting and that reversing the $number will reverse the sort but I have no idea why?  The books says:

“You can refer to parameters by number instead of by name—this approach is especially useful in very short closures. A closure passed as the last argument to a function can appear immediately after the parentheses.” 1

Reading that above, and writing the code below I still don’t understand what $0 and $1 are referring to? They are a stand-in for the variables but what variables exactly? I understand that I must be passing the array of numbers and ordering them based on one being more than or less than the next. I also get in the side bar that to complete the first and second function it took 9 iterations. I’m assuming then that the sort function must sort an array… and that maybe it’s running until the function returns false so until $1 is no longer > than $2. But I’m totally guessing here. Any help understanding this would be appreciated.

let mySort = sort([1,5,3,12,2]) { $1 > $0 } // no idea what this is doing?  I'm assuming it is sorting the array of numbers.

let theSort = sort([1,5,3,12,2]) { $0 > $1 } // no idea what this is doing?  I'm assuming it is sorting the array of numbers.

  1. Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. 

Is Pandora Radio missing a big business opportunity?

Is Pandora Radio missing out on a business opportunity? Not knowing anything about the recording industry I’ll admit I might have this all wrong but I was thinking that perhaps Pandora should be using it’s strength in data mining and analytics to sign new recording artists. It seems similar to the challenge that Netflix and Amazon are facing with licensing content… and have since gone after creating their own original content. I would think that Pandora could combine deep analytics and profiles for the music they play along with the demographics of their listeners and the data about likes and dislikes they provide to predict the next big artist or song that has yet to be discovered. They could then sign that artist themselves and license that music at a significant discount compared to what they would pay a current record label? Maybe they could even partner up with “The Voice” or “American Idol” to promote their up and coming artists?

Anywho, that’s what I talk about in this short video post that I recorded after thinking about on my way home from work tonight.

My thoughts on enterprise office computing

Microsoft Cloud Computing SlideI was recently asked by someone to give my thoughts on enterprise office computing.  The general context was around what my perspective was on an “any device, anywhere” type capability inside the enterprise. She was looking to understand what would make organizations more effective and productive?

Below are my inputs on specific questions in the context above:

Q: What are today’s pain points to being productive and effective with today’s office computing hardware and software in the enterprise?

  1. Hardware is lacking in power and performance for our developers and analysts because the enterprise hardware refresh rate is not keeping pace with the big data needs. Enabling these folks to have a yearly stipend towards purchasing their own hardware and self-supporting it would bolster their productivity. Give them an easy way to partition off their work login from their personal login and easy way of migrating their data between machines (see point 2 below) and you’ll have happier employees with a much faster refresh rate.
  2. Keeping the content, settings, and application virtualization in the cloud and prevalent on any device they log into w/int the 4 walls of the enterprise or via virtual walls created by VPN would be critical.
  3. Having a common ‘cloud based’ content enterprise storage across all devices (like Dropbox, evernote, or Google Docs) would increase productivity. Continue reading

Grading my 2011 Goals

Another year has gone by and I’ve just spent some time reviewing my goals and grading my progress against them.  I failed.  2011 was a rough year and as I write this having looked back on the year I don’t feel good about the progress I made against these goals.  I feel stronger and more healthy than I have in years and I but with respect to the expectations I had set for myself in January of last year I’ve failed. These are my expectations and will be my goals again in 2012… now I just need to figure out how to execute.

The specifics:Read More: (2011 Grade: 4/5)

  1. Read one fiction book every three months: Grade 4
  2. Read one non-fiction book every 2 months: Grade: 2

My 2011 Progress

In 2011 I finished reading 3 fiction books (“A Galaxy Unknown“, “Rainbows End“, and “Wired“) and there’s a 50/50 shot that I’ll finish reading “Abraham Lincoln – Vampire Hunter” by the end of the year. In 2011 I finished reading 2 non-fiction books: (“The 4-Hour Body: An Uncommon Guide to Rapid Fat-Loss, Incredible Sex, and Becoming Superhuman” and “Delivering Happiness“); I started, but did not finish, 3 other fiction books (“The perfect gene diet“, “The Power (the secret)“, and “The Shift: Taking Your Life from Ambition to Meaning“).

My 2012 Plan Continue reading