Getting along with Objective-C

Back to writing a blog post after umm..exactly a year. I guess I receded into a prolonged hibernation period during which there was no motivation to write about anything. 

Couple of exciting things have happened on the professional front over the new year.

1. A new job!

2. My first full scale iOS project

It goes without telling that 2 has been better exciting of the two. After about 8 weeks of writing hardcore Objective-C for the iOS platform, I am inevitably getting along with this programming language that felt so alien to me at first. My first tryst with this language was way back in 2011. It’s way behind my first love – Ruby though. But, its not all that bad given that I have immersed myself in it for a reasonable period of time now.

Though Objective-C along with iOS feels overly bulky to me as a programming platform, I have still learnt to appreciate some of the niceties of this platform like Categories, Protocols,  Delegate handling etc. I think these features are probably well more rounded than other comparable languages around. 

Hope my love for this language blooms over time allowing me to build cooler and funner iOS apps.

There are lot of things on our plate!

In my experience as an IT consultant working for several different organizations over the years, I have noticed there are tons of nagging bottlenecks that plague all these organizations. I want to dwell upon once such problem. Lets get to the point straight away.

The IT support team.

OK. Who is IT support? or *Admin* as their more traditionally referred to. These are the guys who run the support for infrastructure in the organization, create your email accounts, provision your hardware etc. I can’t single out an organization that I worked for where this wasn’t a problem. These guys can take anywhere from days to weeks to give you a laptop. A simple VPN tunnel access request will turn-around in no less than a week. You talk to them to find out why it’s taking so long. The answer you get is a blunt *We are working on it, there are lot of things on our plate*. Nothing seems to bother these jolly good folks. Any amount of external pressure doesn’t seem to deter them. This problem is reduced to a Water-Cooler chit-chat in most organization and is somehow never taken seriously. Nobody ever seems to know what’s plagueing these guys?! Is it possibly because they are genuinely understaffed and are overwhelmed with support requests? Or is it some inherent callousness that runs in their blood? Well, I don’t know!

The Apple/Microsoft Contradiction

I know. This would make an excellent episode title for The Big Bang Theory. Long long ago, Microsoft (here on referred to as *MS*) wanted to be the leader of mobile devices before Apple stole the thunder away with the iOS. MS came up with interfaces like the ones you see below for the mobile software it launched.

    

MS basically attempted to reuse or adopt it’s hugely successful desktop software (Windows!… for folks who don’t know what I m talking about) for mobile devices. We all know what happened after that. MS of course realized it’s blunder after a r-e-a-l-l-y long time when the iPhones and the Androids had already taken over the market with their highly usable and intuitive interfaces. It took steps in the right direction in the form of the Windows Phone and the weirdly titled Mango.

Now. What did Apple do? They built this revolutionary mobile platform called the iOS without reinventing any wheels. The iOS redefined mobile computing for the consumers. It also spurred Google to build Android. iOS and Android devices define the mobile marketplace today. Stimulated by the global acceptance for its mobile platform, Apple is now working towards bringing features from the mobile platform to OSX, its desktop software. The Mac App store, Launchpad, the touch/swipe gestures, scrolling etc are some of the features in the new Lion operating system that seem to have evolved directly from iOS.

The first is the case of failed adoption strategy and the second has produced effective results so far. I m sure the OSX family will imbibe more of the iOS intuitiveness as it evolves further.

Code Reuse in Objective C

One of the trivial ways to enable code reuse in traditional programming platforms like C++, C# or VB is building dynamic libraries that are compiled binaries that can be shared with different consumers who can embed these libraries into their application’s code and derive use out of them. These dynamic libraries (or DLLs) are linked with their host’s code at run-time.

The ability to use/link dynamic libraries is missing in Apple’s Objective C platform for whatever reason. The alternative that the platform gives us (that I put to use recently) is building static libraries. Interestingly, this is probably the only way to enable code sharing/reuse in Objective C. This thing was pretty new to me having been used to the dynamic way for a long time.  Xcode makes building static libraries a piece of cake. It is even possible to develop a library that would contain UI components (like Cocoa-touch views/controllers etc) and have an application make use of these components via the shared static library.

This article goes over the process of developing a simple static library in Objective C using Xcode.

Ping-Pong programming paradigm

Overheard this interesting little pair programming paradigm somewhere on the inter-webs.

A writes a new test and sees that it fails.
B implements the code needed to pass the test.
B writes the next test and sees that it fails.
A implements the code needed to pass the test.

Optimize your software development process!

Having spent close to a decade building and engineering software for various clients, a crucial thing I have learn’t is the need to optimize the process being used in the development of software.

I m a big advocate of Agile. I think any modern software project has a better probability of success adopting agile development methods. But this post is not to talk about the awesomeness of Agile and what it brings to the table. The projects I have worked on have been a mix of different development models – Pure Agile, Half-assed Agile, Waterfall etc.  As much as the process, the nature of application and optimization of the process is extremely critical to the success of the project!

Process Smells

What most software engineering firms don’t do well with whatever software development process they have – identifying what’s going wrong and how. I think the honchos/managers running the project need to look for ‘Process Smells‘ (yes. coined with inspiration from Code smells :)). There needs to be a very keen eye for symptoms of process failure/loopholes that would eventually lead to bigger problems. Identify such Process smells early and find ways to eliminate them.

Embrace Change

Following a rigid development pattern that insulates itself from change is harmful. This is common in large to mid-size software enterprises that don’t want to disturb something that’s getting the job done for them albeit with mediocrity. Bring in an element of agileness and dynamism to your methods (again, whatever methods you might follow). This enables optimization of your process and will lead to a positive impact on your project’s goals.

I m no project management guru but I have served in the industry long enough to understand the perils of not constantly optimizing a software development process. On a lighter note, let me leave you with one of my Dilbert favorites.

Dilbert

Active Support Concerns

I recently came across this inherent feature Rails provides to modularize or break down huge ActiveRecord models into reusable chunks or concerns. This way, these concerns are now pluggable into several different models where there would be a need for them. Not sure how many folks out there are aware of this nice little thing. I did’nt for sure until couple of days ago.

module Pluggable
extend ActiveSupport::Concern

included do
extend ClassMethods
include InstanceMethods
end

module ClassMethods

end

module InstanceMethods

end
end

class Plug
include Pluggable
end

Leave the campground cleaner than you found it!

Leave the campground cleaner than you found it!  – Bob Martin, RailsConf ’10

This boy scout thumbrule is so pertinent to software development and clean code.  If every one of the developers on a software development team religiously followed this thumbrule, how clean would the code look? It sounds impractical unless the team here is a bunch of rockstars and clean code fanatics. But it is nevertheless important to educate any team on the importance of this thumbrule and why it is essential to delivering a quality software product.If each member on the team can alteast make a honest effort to adhere to this thumbrule, half the battle is won. The seeds for being better software developers are thus sown.

Mobile pains in India

In a country where a human being has easier access to a cellphone than to a clean toilet, I found it extremely suprising that none of the cellphone service providers have a standardized/instantaneous process for activation of your cellphone service.

I had to wait nearly 2 days for activation for my service. Everytime I contacted customer service, the answer I got was they were working on it. The ETA that I was given was somewhere along the lines of 5 mins – 15 mins. Duh!

Why can’t these companies instantly activate a cellphone line? Hard to understand!