Ask and you shall receive Swift edition

I had mentioned previously that I wanted to learn Swift over thanksgiving. I ended up taking the Objective C course instead at code school as I didn’t see an option for Swift and I find code school a fun way to get an intro to something. Lo and behold this week I got an email from them and they now have a free Swift Course. Today is my last day of work for the year so I am planning on playing around with this course and messing around with a basic app over the Christmas break. So Code School thank you for the early Christmas present. I will follow up with my thoughts on the language and on iOS development after playing around with it.

Twitter Cards

I noticed that a bunch of people when they post to Twitter have much cooler looking posts than what the Jetpack plugin seemed to be doing for me on my blog. Over Thanksgiving I was looking into this a bit and discovered Twitter Cards. I am probably the last person on the internet finding out about them, but I hadn’t really paid that much attention to it previously. I decided maybe I should create a plugin to add them to the blog. But this being WordPress I did a search first and it looks like there is already a great one out there. This post is just me testing it out and seeing how it works. I often see people say that a great way to develop a little side income is to create a WordPress plugin and sell it. I actually wonder how people do that because it seems like every time I need some sort of plugin to add functionality to the blog I can find an amazing free plugin that does it for me. Anyway hopefully this test post works and I get a Twitter Card for it.

Objective C

Over Thanksgiving vacation I was thinking I should maybe play around with Swift and maybe try to create a basic iPhone app just to see what the programming model was like. I headed over to Code School to see if they had a free course I could play around with. Unfortunately they didn’t, but I did see the Objective C course over there. My thinking was given that most iOS apps were written in that, why not do that course.

Apparently I have been doing Java for too long, cause I really thought man this language just feels old and has as Venkat would say there is a lot of ceremony in it. It just feels like there is a lot of things that don’t need to be there. For example you declare strings @"String". Why do I need an @ sign in front of a string, it is just a hard to type character on the keyboard which isn’t exactly going to speed up your typing. Also everything being prefixed NS like NSString. I suspect they are still keeping the old C Strings around as well, so now you are specifying with the @ that it is an Objective C string type. I also had forgotten how annoying it was having to deal with declaring * for your strings and arrays. There is a lot of be said for everything in Java being a reference (save for the primitives). Now I need to be thinking do I need a pointer for this object or not. I guess I saw another note that the * is actually denoting that it is an objective C object vs a C object. (At least according to code school). If that is the case then it is sort of overloading the pointer from C which doesn’t make things clearer.

Also creating a new object is pretty annoying you have to both allocate it and init it. Seriously no new you have to “send 2 messages” every time you create something new as shown here: NSDictionary *emptyDictionary = [[NSDictionary alloc] init];. So like I said lot of ceremony. And for Booleans they use YES and NO instead of true and false. Not a big deal but seems an odd choice, though still better than C’s 0 and non zero values. And having to do both headers and implementing files seems weak as well. Sometimes in Java we do interfaces, but I like not having to do them for every single class, you just use them when it makes sense from an inheritance standpoint.

What did I like about it? Well I did like how you can just declare a dictionary with the elements in it, instead of having to construct it and add elements to it. Java’s maps need this type of thing. An example in Objective C is: NSDictionary *appRatings = @{@"AngryFowl": @3, @"Lettertouch": @5};. The for in statement is nice similar to Java’s for :. I also like their closures where you can just pass a lambda function around with ^(NSString *word, NSUInteger index, BOOL *stop). That is something they definitely beat Java to and I think the syntax is nice for it with the ^ and function declaration seems as good as Java 8’s ->.

The other thing that I am unsure about is the sending a message thing. I found myself wondering are you actually sending a message like in an event oriented model or are you just calling a method of function? The syntax felt a little odd compared to most languages if you are actually calling a function [objectName messageName]; If that is a method call it is some serious ugly ceremony, but if it is some sort of message passing then maybe that would justify the odd syntax. When you end up with a bunch of nested calls you have some seriously ugly code. Code school has this quote:

Note: “Sending a message” is sometimes referred to as “calling a method”. You’ll find Objective-C programmers using both of these phrases to mean basically the same thing.

Maybe it doesn’t matter, but I actually do want to know what is going on under the hood just out of curiosity.

Anyway in the end I am glad I took the course. As always Code School does a great job presenting the topic. It was interesting to get a feel for the language, but it definitely feels old. It is easy to see why Apple is moving away from it and towards Swift a much more modern language. So I guess I still want to sit down and play with swift and write a basic iPhone app to get a feel for it. Based on playing with Objective C over thanksgiving it sort of feels like a waste of time to invest any effort playing with the language, it feels old and nothing I want to spend a lot of time fooling with. Might as well use the latest and greatest if you are going to play around with it.

Blogoversary – the 1 year anniversary of my blog

I hit the one year mark of my blog while I was on thanksgiving break. I had intended to post on the day of the event, but I was busy with family in Minnesota and never got around to it. Back when I started this my intention was to try to write something about once a week. While I haven’t been completely successful with that when life intervenes and keeps me busy, I do see that I have exactly 52 posts so I at least averaged it over the year. All in all I would say this has been a successful venture for me. I learned a lot playing with some SEO things and seeing how things would show up in search engines from here. I was also able to learn a ton about SSL configuration of the site. On that note I have considered actually dropping TLS 1.0 support. While that would drop a bunch of old browsers I think consensus is that is the next protocol to fall since SSL 3 has pretty much been declared as insecure. Probably if I was a busy people would say not to do that since you want to be accessible to the maximum number of users, but since I maybe have 3 readers who are all technology people they would see no impact and it would allow me to crank the security down to the next level.

For the second year of my blog I expect things to be the same, I am hoping to get another 52 posts knocked out and hopefully have at least 2 – 3 posts go out a month. In any event I am a little surprised I stuck with it as I wasn’t sure if I would bore of it and drop it, but I have enjoyed playing around with it, so here is to year 2.