 So yeah, I'm Michael Harper. I am a Sun River resident. So Sun River is down or up the road, depending upon how you define down or up, about 15 miles. So if you are working on more than one project right now that really requires your attention and you probably shouldn't be here anyway, raise your hand. OK, now keeping your hands up, how many of you also had to remove eight inches of snow from your driveway this morning? Yeah, exactly. OK, so I am, like I said, I live up in Sun River. And it turns out I'm 50% of the Sun River iOS developer community. Yeah, there's another gentleman by the name of Dick Lovekey. And we found each other on Twitter because I think we're probably the only two people in the Sun River on Twitter anyway. We're only about 2,500 people live out there anyway. So this is awkward. OK, I'm going to move this a little bit less awkward. I appreciate the guys who came in front of me and set the bar incredibly high for keynote presentations, I'm assuming that they're easy to get. I'm pleased to see all the MacBooks in the audience. There was a time when that would have been what happened. Because we all think different now. Yeah. So let's get on with why I'm here. So just briefly, my road to Objective C. Why am I talking to you about Objective C? Good question. OK, mobile developers. How many mobile developers do we have out there? So what's interesting is where I got started. Anybody remember a language called Fortran? Oh, yeah. Anybody know about the Prime Mini Computer? One. Oh, right. Yeah. That's about how important that is in my life. My experience actually goes back before this 1980 starting point. But that was like yellow schools of paper and pointing keywords in 110 bot. Not real applicable to what's going on today. But what I did learn when I was at Cal Poly in the 80s was I took this elective class called C. And it was on this wacky platform called Unix. And then from there, after I graduated, I went to work in San Francisco to invest in a banking company. I was working on doing developments on Macs that actually weren't all in one. They actually had a separate keyboard monitor and a base unit. They had color. Yeah, it was exciting. So I taught myself C++. Kind of on the C continuum here. And then I encountered this Goofy language, a project that I started working on next. And this Goofy language is called Objective C. So I'd gone from C to C++. And it was a good thing that I taught myself C++. And a good thing I took the elective because otherwise I would have been armed to face the world with Pascal. So I ended up working on this Next Step project in the mid-90s and encountered Objective C. And then about 10 years later, I ended up recording that same project from Next Step to run it on Mac OS X, which I thought was really cool. And to be able to see the evolution of what it started on Next, I still thought Objective C was relatively Goofy. And then we get the iPhone SDK. And we're doing mobile development on iPhones and iPod architecture with Objective C. So I couldn't resist the allure of writing iPhone apps. Just too sexy and too cool to be able to pull your phone out and go, I made this, right? So I started doing Objective C programming. I don't see any Ruby or anything else on there. I must have filled in on something else. Oh yeah, Java. So in the mid-90s, let's see. That would be right about when my daughter was being born. I already had a son living in Marin. Yeah, I had to do something to make some dough. So that was Java Enterprise Development. So I was working for Sun, Stanford, and various other companies on this crazy platform called Tenga. Anybody remember Tenga, the precursor to WebLogic? Which is now part of Oracle. Is that right? So Oracle is like, there goes Sun, there goes WebLogic, and there goes ATG. Anybody remember ATG Dynamo? Yeah. It's Oracle, it's like this black hole. So I did a lot of work, a lot of Enterprise Oracle job, and I did that for quite a while. And then on the Java Posse podcast, if you don't listen to that, you should, because it's goddamn funny. And it's very interesting. A lot of Android stuff is on there as well. But anyway, I heard about Ruby on Rails on the Java Posse podcast. There was a check it out. And then ended up being asked to work on a Rails project. And from there, ended up working on a number of Rails projects. So it's not a complete disconnect that I'm standing up here talking to you about Objective C. I do know a thing or two about Rails. So remember I said in the early 90s, I encountered this goofy Objective C language? It's with the goofy method calling syntax. You've got square brackets around everything. You've got method names and parameter names. Yeah, they have to name. They're a mile long. I mean, what's with this method selector? I mean, who would ever want to use a method selector? Why won't you just call the method on the Object? Come on. And also, remember, this is 20 years ago. So I'm just out of college. I'm in my mid-20s. I know everything. Right? So what is this class method and category and protocol stuff? I don't need to know this, right? I mean, come on, really, seriously. Why would you want to use this? We've got C++, C++ rules, right? But let me point out briefly here that I worked on a C++ project a couple of years ago, which is definitely my last one ever. I have sworn it off completely. Ain't gonna ever happen again. But you know, this is 20 years ago. I don't need this Objective C stuff, right? So comparatively speaking, when I found out about Ruby on Rails, and then I went to, after working on Rails for a while, I went to an advanced Rails studio that was taught by Chad Fowler and Dave Thomas in my park and had the moment of Zen with Greg David about Ruby, which is that everything is a method, column, and object, and it's like, whoa, everything, you know? Coming from a statically-typed world of the 80s and 90s with Java and C++ and all that stuff, it's like, whoa, right? So what were my initial thoughts about Ruby? Well, you know, of course, unicorns and rainbows. Double rainbow. You can't really see it very well, but that is, all the way, that's all the way. That is a proprietary picture that I took. That is, that's looking towards Lenai from the Maui office, right? So it was great. I was working on a project over the last summer and I've been already playing this trick for a couple of weeks to Maui and I just told them that I was working in the Maui office, which I was. I mean, seriously, I was, but that was the view from the Maui office. So, initial Ruby thoughts, unicorns and rainbows. The Maui office had a roof. I took this outside. The actual Maui office, yes, they had a roof. In fact, they had another condominium upstairs. I appreciate that. So, you know, way the two different lists here, right? I've got Objective C initial thoughts and I've got Ruby initial thoughts and consider that there's 15 years of, you know, experience and life experience separating the two. But, I mean, it really was a really moment comparing my initial thoughts about the two. And as I was working for Ruby and also working on mobile at the same time, I realized there's stuff going on in Ruby that I do all the time, but I can do Objective C. And I didn't even clue into it until I started working with Ruby. So, let's talk about the commonisms, not the Karl Marx variety, but what the two have in common, right? So, there are a ton of things that, okay, that's not correct. There are a number of common things between Ruby and Objective C. I'm going to talk about three of them that were important to me, okay? There are differences as well. One of them, you compile things and you don't forget that. But these are the three things that I found were important to me that Ruby helped me to understand in Objective C, okay? So, one of them is the ability to modify classes and methods at runtime. And I did this yesterday in Ruby on a Rails project. Now, I've been working mostly in mobile for the last year, but I've been helping out in my copious retry on, yeah, we all have copious retry, don't we? And we all work in it, don't we? So, yesterday, I was actually using this capability in Ruby too at runtime. Change out of that. That's pretty cool. Try that in C++. If you did try that in C++, tell me how you did it. In C++, you can send a method to an object. I phrased this carefully. I didn't say you can call a method on an object because, duh, you can call a method on an object. We do that all day long. But the concept of separating the method from the object is kind of an interesting twist, a different way of looking at it. Again, from C, well, we didn't have objects, right? But in C++, you couldn't really have a method live without an object. I mean, they were in that state and you had behavior and those were all part of the class and part of the object. So, the concept of just saying, oh, I've got this method. I'll wait till an object comes along and then I will send the method to the object and the object will respond to the method. I guess messaging is the equivalent to what I'm trying to say here is a cool concept. And finally, of course, blocks of code. Blocks of code that aren't contained in a method, basically. Now, blocks of code that you can pass around. In Ruby, blocks of code that you can write at runtime. That's really cool. I did look up metaprogramming for Objective C and got nowhere and realized, well, that's because all your code has to be piped. So, if somebody can figure out how to do metaprogramming in Objective C, tell me about it after I get class here. So, let's get to an example of this. Adding a method at runtime to a class in Ruby, right? So, this is what happens when I have this string, right? And I have Ruby on LZ, I have sugar and I call the permit method on it, right? It says, there's no permit method on the string. So, I can solve this problem simply in Ruby by opening up the class and defining the permit method. Of course, changes all instances of sugar and alcohol. And then when we run that at the bottom, you can see that it works, right? So, what does the same kind of thing look like in Objective C? Well, there's the error and it's a different kind of error than you get in the Ruby equivalent. It's this thing I alluded to earlier called a compiler, right? So, you can't even compile this code because the permit method doesn't exist. So, you have to create it. So, where did it come up? Okay, so, at runtime, and I have elided a bunch of code that doesn't really matter. And I've also run too far ahead, haven't I? Yeah. Yeah. I have method at runtime, right? Okay. Oh, notes came up. That's what confused me. I have notes on this slide. You can't see them. All right, so let's rewind here. We're talking about adding a method at runtime in Objective C. So, what you have to do is you have to, in the interface definition for the class, you create this thing that's called a category and that's what putting the parentheses and some name after the class there, right? You see interface NS string, NS string being the string class in iOS and in Mac OS X and the big step. That's why there's the NS. Okay, raise your hand if you need that. Come on. Yeah. So, I create this category. I add the ferment method that returns a string and then I implement it, right? So, basically the Objective C equivalent of opening up a class and adding a method. And then when I run at the bottom, you get the result that you want to see. Okay. Compile and run at the end of it. So, when have I actually used this? I've used this particularly on NS string to add base 64 encoding. And it's a real natural thing. In fact, I'm pretty sure I stole it off the web somewhere. But the ability to do that in Objective C is great and I never would have thought of that if I hadn't been a rest developer and seen it done there. They do it in Rails, right? Just a little bit. Just a little bit. Active support is pretty much that. Okay, so sending a method over in time is concept of separating the method itself from the object that it's gonna execute it on. I was another, oh, wow, that's kind of cool thing for me. So, again, going back to our fermenting a string. And I didn't get anything. No luck for the changing sugar to alcohol. I'm proud, you guys already had a couple of years. So, you can see towards the bottom there, I'm sending a s.send and then I pass in the ferment symbol. So, I'm sending that message to that object and it's the equivalent of calling the method, right? I'm sure that there are subtle differences there, but essentially that's what's going on for the purposes of my example. How do you do the same thing in Objective C? Well, you have this thing called a selector. This is a thing that I didn't understand 20 years ago. Why would you create a method selector? And you see this in all caps, SEL, that's the type of variable that you can assign a selector to. And then you can call on an object, perform selector, and then you pass in the selector, okay? So, now going back to Michael 20 years ago, well, why would you just call the band method direct? Well, let me tell you why. For example, in iOS and iOS 10, there are certain things, certain methods that you need to always call on the main thread. You may not be in the main thread for one reason or another. So, you can actually call perform selector on main thread. And then, you see here, with the with object, you can pass in, in this case, the text that you want to actually set in the current time view. This is from a boxing timer app that I've used for about four years as an example to continue to learn personally iOS-isms, right? So, here's another one down in the bottom half, creating a timer, right? You're gonna schedule a timer with a time interval of one second. The target is self, in this case, it's a model. And then here's the selector that I'll call. So, two real good instances in iOS where you do need to have that method separated from the object that you're gonna call on. Kinda cool. There's also this class called NSInvocation. I took a look at that, because I've never used it, but I took a look at that because it is apparently the blanket totally flexible and abundantly complex way of doing the separation of target and method and parameters and the term value and the amount of code required to do something as simple as one of these two is pretty impressive, but that's kind of the cure way of calling a method on an object if you really wanna get down with it. So the last bit I have for you here is blocks, right? So, and this is a fairly contrived example, but what I did was I added a yield to the ferment method that I used in example. And that way, if there is a block that's passed into the ferment call, it will yield to that to get the value that we're going to replace sugar with in this string. Right? So, I have two calls to ferment, one without any block and that is what we did before. And then I have one that does some very simple stringing catnation, right? Some simple math on the gear string. So, do you have any gear, gear, gear? So, that's a very simple example of blocks in Ruby and you guys all know that we use blocks like crazy in Ruby and rounds and iterators. You know, when you're going through an array and you call it dot each and you pass in a block, the syntax there is wonderful. So, how does that relate to objective C? So, if something pops up here again, and it distracts you. Okay, so here's the equivalent in objective C. You have to declare, where you have to write a little more obtuse code. Basically, where you can... Yeah. But you can do it, you can do it. It's really not that bad. Just figuring out what that definition of the block is, is the hardest part for me and it always involves a character. So anyway, if you look down near the bottom, you can see that I'm making the ferment call with nil and that's kind of the equivalent of not passing in a block in Ruby. And then I'm passing in a block that returns beer times three. So that's the equivalent of the beer times three in the Ruby, right? Again, I mean, it's a compact example of passing blocks around. But it really makes your life a lot easier, specifically for me in dealing with animations in iOS because you can pass in, for example, when the animation is done, run this block of code, right? And I don't have to create another class or I don't have to create a delegate method to get called afterwards. Now I just pass in this block of code, that's great. So, but you notice anything about this code that's... I mean, is there a times method on the screen? No, but I needed one. So, you know, I did that thing that I was talking about earlier where I added a method of runtime so that it had a times operator and not an operator but a times method and basically do the equivalent of what we can easily do in Ruby. See, I'm not saying that, gee, isn't it great? We can do this stuff in objective C just as easily as we can in Ruby. I'm saying, gee, isn't it neat? We can actually do it. Okay, now, okay, I've gotta get this stuff in place. Okay, that's good, got it, great. All right. So, just a real quick example here of making array elements do stuff. I was talking about this a little bit earlier about how nice it is, the syntax that we have in Ruby to do this stuff. I really appreciate it. They've given us some helper methods for things like an SRA so that we can make objects perform selector. Remember that thing I was talking about, about having the method separate from the actual object? Yeah, that's cool. You can also do the same thing with a lock. Lock the code, pass in some code and have the object passed in, have each element in the array passed into the lock. So, what have I learned? Other than, man, this is a really cool room. We have a buddy's 50th birthday party next door so I know about that, but I didn't know about this room, but it's really cool. That's one of the things that I learned. But anyway, I've learned that I love Ruby. I mean, I just really do. Obviously, I've been doing this a long time. And I remember when Java came along and I thought, this is great. It's taking all the rep pages away from C++. I don't have to worry about memory management anymore. Java, thank you very much. And then I spent seven years, eight years doing enterprise development. It's like, okay, well, we've replaced the sharp edges of C++ with all this XML configuration, right? I don't know, hoping not XML of violence, right? And then Ruby comes along and it's like, oh, thank you, thank you, thank you. And then when do I end up doing Android development, then that's all right, good job. It's not that I hate Java. It's that I hate Java enterprise, right? Nothing wrong with me with Java. But I do, I really love Ruby. I really, really do. I also, if I learn, I learn that I understand Objective C a whole lot better than I did 20 years ago. I don't know, maybe because of the passage of time, maybe because of the fact that I realized that I don't know everything anymore, right? That probably took a while for me to understand. And wouldn't it be awesome if Ruby were sanctioned for IOS development? Woo! Woo! Woo! Woo! Woo! Yeah, Mac Ruby. Cool. It's kind of a... It's going to be IOS. I'm sorry? They're spending to do IOS and it puts Mac Ruby. Cool. Can you circle back and play out Ruby and tell me more about that? Awesome. Okay, so Ruby, you know, I love about it. That it's so expressive and efficient. And then, you know, the moment was in with Dave and metaprogramming, you know, double-edged sword. Certainly, but isn't it cool? I mean, it's pretty damn cool. And Objective C, you know, my problem, my initial experience with Objective C was really tainted by the fact that I came from such a statically-typed world, right? I mean, that's all I was taught at college. I had this crazy computer science degree and we, you know, learned about lots of strictly-typed stuff, you know, dynamic stuff. Only happened in this one class where we wrote one program in which, you know, all different languages. We actually call them programs back then. So I think that Objective C was tainted for me by this heavily strictly-typed history that I had. And by going to Ruby and the freedom that I was allowed there, I really started to understand Objective C and what it's, why it is so cool. I hope I can make that to you today, to some degree. Shameless self-promotion. There seems to be some of that in the previous presentation, so I'll go ahead and do that myself. I told you that I live in Sun River and if you haven't been there, it is a destination resort area with 35 miles of bypass that lots of tourists get on their bikes and they, that's got their kids in the trailer and they head off and they don't know where and what they're at. There are, I think we're up to 11 traffic circles and interestingly, to be up a right-hand corner, there was supposed to be another traffic circle that is missing and that would have been circling. So there's actually no circle eight in Sun River. It goes from seven straight to nine. So the joke is that the tourist is being particularly special as tourists are want to be, as in make me a latte and make a good one. We will send them to circle eight and tell them to take them to the rest of the week. Anyway, go check that out, circle eight.net, Android and iOS and the Shameless self-promotion. Here's where you can find me on the interwebs. I'm Achtahapa on Twitter. That's because I have a 40-year-old BMW of varia. No, it's not in 2002. It's got two more doors, right? And I'm part of the group of people that keeps those cars alive. So that is a Germanization of my stature, Achtahapa. Standalonecode.com, that's me, standalonecode, that's me. And I'm M Harper, sorry, I was kind of worried. So with that, I am going to ask somebody to go get me. And... What do you want? IPA. And my final adition to you is to go write a test, right? Thank you to Matt and Mark and Josh and Mike and Miss Somebody Else, the guy who's getting me here. Thank you for having me, guys, I appreciate it. Thanks, Chris, for coming out all the way from DC. I appreciate that. And I hope you're doing something. Do you have a question for me? I don't know the answer, I'll make it up. It was 80s, like... It was 80s, that's a good question. I'll make it up, 80s were Genesis, thank you. The 80s were, I discovered Genesis. I discovered Genesis concerts, doesn't matter that one. The 80, oh, we pretty much had parity between the US dollar and the British panel. It was great because I was in the fund for three months. That's right. Was it cooler? Was it cooler? Like, temperature-wise. I was living in the Bay Area, and so compared to here, it was much warmer than here. Mike. Do you always have an 11-year reminder to go to work? Actually, I know you're not gonna believe this, but that's my son's reminder for him to go to work at 11, he's a lifeguard at 19, son of a brother. How is he gonna get there if he doesn't get the reminder? I'll share you with him. How do we actually use the Morris? Do I do church TV and iOS development? I do as much as I can. That was one of the things that Rails dropped to me, was TestGrid and the Baldwin, and then I read Uncle Bob's three rules for TestGrid and the Baldwin, and didn't understand them. And then, about a year later, I read them again, and then I understood them, and that was another moment for me, right. On iOS, I find it more difficult to do thorough TestGrid development, like we can do in Rails. It's slow and not well-instrumented in my experience. I haven't gone deep on the sort of in-application testing you can do, not super deep. So, I tend to limit my TestGrid development to more model-based stuff, stuff that doesn't require me to fire up the application, API testing, model testing, and stuff like that. So, it's, you know, half Android is fairly similar to me. Did you find your transition to Ruby weird as well, in terms of standards? Yeah, I find my transition to Ruby weird. Weird is the wrong word, challenging at times, for sure. I think it was like what, you mean, I don't have to define all this crap up front? I don't have to define the type of this variable that I'm assigning to. What's all this magic that's going on in Rails, you know, the metaprogramming, particularly on the back of the card? So, not weird, more uncomfortable to begin with. And then, especially after Dave Thomas, you know, the moment we said to Dave Thomas, it's like, oh, this is awesome. But there was definitely a transition that came here.