I’ve decided to give Spaces another try. Combined with BetterTouchTool, I can now switch spaces with a swipe of my trackpad. I’ve tried Spaces in the past, but really got annoyed when I had problems dragging between workspaces. I think one of the problems is that I had the Finder in a particular space instead of all spaces. We’ll see how long this experiment lasts; sometimes I consider myself an old dog that can’t learn new tricks! I’ve been using my computer in the same way for so long that even if something is going to make my life easier, I resist it!
git: The good and the bad
I’ve now spent a few days working on a new project that has all the source control in git. Knowing that I was going to be assigned to this project at some point, I spent parts of the last few months learning git. Now I actually have to put the knowledge to use. While I have read/write permissions to the main repository, I am choosing to submit pull requests and let another developer accept my changes until I’m more comfortable with git.
I’m getting used to certain aspects of git, have done some branches, committed changes, and submitted pull requests. For the most part everything has been going fine. I am starting to like the concept of creating branches for various changes and being able to park them and work on something else, switch back to what I was working on and then merge everything back in. However, the merging is one part that is kind of confusing to me, still. Apparently there is an auto merge, but I’m not exactly sure how to fix things if that fails.
I committed a change to my local repository today and realized I committed it while working on the wrong branch. So, I was easily able to revert the entire commit and then set a new branch off the commit and then I can work off that. I found that to be pretty cool. I haven’t merged my new branch back in, but that will be the next test. Also, I like how git handles renaming of files; it is smart enough to handle the moves and the git log command with –follow will show the entire history of the file; I had to use that in order to figure out who to blame on some code that is never used, but was never removed.
After I made a bunch of moves, I committed everything and issued my pull request. The developer that handles the pull requests said that I left out 11 files. Strange, the files were on my local file system, my repository was just pulled from the upstream repository and git didn’t say that any files were untracked. I nuked the files locally, re-did the pull and got the files back after the other developer put them back. It seems that some things in git are a bit confusing; it may be quite powerful, but with that comes confusion, at least on my part, on how to use it.
In order to make my life easier, I’ve been using Tower as a GUI for git. I’ve also been working a little with the command line.
Either I’m a bit thickheaded about learning git or it is a tool that does so much that learning it takes an entire course. Hopefully after a few more weeks with it, I’ll be more comfortable. At the same time, I hope the other developers on my project don’t bite off my head when I commit strange branches left and right!
Another rant about developers that should find a new line of work
I’ve been assigned to a new project where one of my tasks is to start refactoring and cleaning up the code to make it more readable and maintainable. I’ve ranted in the past about poorly written code, but some of what I’ve seen is unfathomable. Writing iOS software isn’t that hard; writing good iOS software that someone else will maintain is much harder. Apparently the second half is where developers fall flat on their faces.
For instance, I saw code that checked to see if the device was an iPhone 4 in order to use 2x graphics. It’s understandable that this check was needed for this case, but the code specifically checked for a GSM iPhone 4. This means that the check fails on a Verizon iPhone 4. Instead of doing the proper check for the scale of the screen, it became a bug that no one discovered until I hit it today. I also saw instances where after loading an loading from the network, it was converted into a UIImage and then set in an NSDictionary. Problem was, no check was ever made to ensure that the UIImage was non-nil and then when it was added to the NSDictionary, it blew up. Lovely.
Unless your company is named __MyCompanyName__, you shouldn’t have this in the header of any file. Change it!
Another task that I took on was rearranging the project as files were strewn everywhere. No one else wanted to do this, so I took on this grunt task. It’s definitely not fun, but neither is hunting through hundreds of files placed all over the place. Resources (images, xib, plists) DO NOT belong in the source folder; they belong in Resources. This is especially important for localization to make sure that you have all the right files. In addition, with all your images in one place, you can identify which images don’t have 2x counterparts for the retina display.
I think that this goes back to what I’ve said before; anyone that hires an outside developer (or even uses their own staff) needs to find a trusted and experience developer to at least look at the code.
I’m sure that the more I dig into this, the more disgusted I’ll be, but so far, the work isn’t really difficult, just time consuming. With all the cool parts of writing code, developers do have to take on the icky parts.
Where did common courtesy go?
While I was running today, I noticed a pair of glasses in the middle of the street. I picked them up as I noticed some people had just walked by and thought that they had dropped them. When I approached the two (a nurse taking her patient for a walk), the nurse said that the glasses weren’t hers and they had seen them in the street.
OK, that’s fine, but leaving the glasses in the street to get crushed? I saw that there was a box for underground telephone lines, so I set the glasses on the box hoping that someone will come back and find them. At least by putting them there, the owner has half a chance of recovering non-broken glasses. Why the nurse didn’t pick up the glasses and do the same thing I did, I have no idea.
Sacrificing Readability for Cleverness
I was looking at some code in the Three20 library when I came across this:
BOOL TTIsKeyboardVisible() { // Operates on the assumption that the keyboard is visible if and only if there is a first // responder; i.e. a control responding to key events UIWindow* window = [UIApplication sharedApplication].keyWindow; return !![window findFirstResponder]; }
The last line had me scratching my head as it has a double negation. While this looks like a mistake, it isn’t; this is a developer being clever. Let’s break down the line:
[window findFirstResponder]
This returns a nil value or a non-nil value. If we then negate it the result is YES if the firstResponder is nil and NO if the firstResponder is non-nil. If we negate it again, the rest is NO if the firstResponder is nil and YES if the firstResponder is non-nil. So, the bottom line is:
return [window findFirstResponder] != nil;
Why did the developer use the hard to read !![window findFirstResponder] when [window findFirstResponder] != nil is much more readable?
(We’ll ignore the fact that initial assumption is not always valid; I believe there are cases where the firstResponder isn’t a text field. Using keyboard notifications is the way to tell if a keyboard is visible.)
Writing clever code like this drives me insane as there is no reason to take shortcuts; a few extra characters isn’t the end of the world and the next person that reads the code has to closely examine the syntax to ensure that the !! isn’t an error.
Mac user working in a Windows company
Back when I worked at a large company (before my current job), there wasn’t a huge issue using a Mac except for some tasks like version control as this was a time before the browser wars. Now over 10 years later, I sometimes feel like an outsider using my Mac.
For the most part, I’m isolated from a lot of the infrastructure as I’m remote and am pretty self sufficient. I do, however, use Microsoft Outlook on the Mac as it works nicely with our Exchange server and the Mac’s built in support, despite what Apple says, is pretty poor. For instance, if I change my password, I only have to change it once in Outlook; with Mail, iCal and Address Book, I have to change it a total of 3 times. Also, scheduling is much easier with Outlook as I can look up people’s availability quickly.
Many things make it hard to work in this environment and frustrate me. It starts with the ancient logins that prefix my user name with a domain (you’d think that someone could fix the system such that the domain isn’t used since everyone in the company uses the same domain), to the sites that say “For best results use IE”, to the sites that don’t even work in Safari. Also with the single sign on that many companies employ today, you’d think you could login once and be authenticated across the board until being signed out; unfortunately I think single sign on means that you have the same username across the board, but still have to enter it a dozen times. Internet Explorer may handle single sign on better.
Today my frustration was trying to watch a webcast; I clicked the link that said “Mac users click here”, but it failed to work and running Windows under Fusion didn’t help either. Looking back, the issue may have been connecting via the VPN, but I had watched a webcast in the past. If we were using the HTTP streaming standard, this would not have been an issue due to HTTP working well over a VPN, but someone chose a “standard” that is very Windows centric and only has limited Mac support.
I’m not advocating that the company switch to all Macs or even Mac servers (I wouldn’t wish a Mac server on anyone), but making systems work across not just platforms, but browsers would give people a choice. There are basically 3 choices of browsers on each platform, Safari or Internet Explorer, Chrome, and Firefox. Why not give employees a choice and make it easy to use any one of these? Yeah, yeah I know the answer; supporting one browser is the easiest for IT support as most users aren’t as technically savvy as I.
Luckily, I only have to deal with these Windows centric systems every once in awhile. Every time I do have to use the systems, I’m reminded how far we’ve come with technology in some ways, but how stuck in the past we are in other ways. I guess I should be happy I don’t work for the federal government where I suspect that they still use DOS in various agencies.
The art of user interface
Years ago I thought I had the ability to design a decent user interface. Back then, the concepts were quite easy as the screen sizes were limited (Palm OS) and we were dealing with essentially black and white. As long as I followed the UI guidelines, the interface looked good. These days, I don’t think I could design a user interface to save myself. The flexibility of iOS, high resolution screens, full color displays and multi-touch add so much complexity to user interface design that it takes a professional, in my opinion, to design good user interfaces.
I’m quite lucky that I work with designers and artists do the design work which lets me concentrate on what I do best, writing code and solving problems. The lack of my own design ability makes it quite hard for me to come up with my own titles to publish. If I came up with a good idea, I’d need to find a good designer willing to take payment in the form of a split of revenues; good design isn’t cheap!
Developers need to keep this in mind when releasing applications; a good idea even well implemented is only half of what makes a good app. The other day I looked at an app that had the beginnings of a decent app, but the UI had a lot to be desired, so it quickly got removed from my device.
Does experience count in mobile development?
The other day, I was instant messaging with someone and jokingly questioned why anyone would listen to what I had to say about mobile development. Then I realized that I’ve been doing mobile application development for almost 17 years! Just writing that sounds unreal. I wrote my first mobile application my senior year in college for the Newton. On a tangent, how did a college student get a Newton and the quite expensive developer tools? The Apple Personal Interactive Electronics (PIE) group licensed my NotifyMail application and exchange, I received a Newton MessagePad 110 and the developer tools when developer tools cost way more than the $99 Apple charges to join the iOS developer program.
The application was quite basic; it counted down the number of seconds until I graduated from college. Yes, I was tired of school and ready to graduate! I guess I kind of got hooked on mobile development and that’s where I’ve spent a majority of my career; first Newton, then Palm OS, and now iOS. I’ve played with Windows CE/Mobile and WebOS, but never wrote anything for those devices.
I don’t think I could write Newton or Palm OS code these days, but some of the concepts are still the same, such as limited screen size and limited memory. However, iOS is so much more advanced, it’s unbelievable.
On the flip side, some may say that my experience is also a hinderance as I may be stuck in my ways. This may be true, but I’d like to think that it isn’t the case. Hopefully my long history of mobile development continues to serve me well.
Life, a year later
It’s been almost a year since I left my job running IT for a small company. As I’ve written before, leaving the job was probably not the smartest move as I didn’t have another job lined up. However, it turns out that the move was one of the best moves in my career. Through a series of events, I ended up with my current job where I’m quite happy. Sometimes it surprises me how much work influences life, but considering how many of my waking hours I spend working, it really shouldn’t be a surprise.
I’m not sure what was the actual trigger for leaving my last job, but I’m quite lucky that everything has worked out.
Life is good.
The utility of a URL shortener
I’ve setup Twitter Tools to post links to my blog posts to Twitter and that’s been working well. I did this as one of my friends doesn’t subscribe to my RSS feed, but likes to read my posts. He is a frequent Twitter user, so this solution works well. Since I haven’t been using a URL shortener, some of my posts don’t make it to Twitter as the URL and title make the post over the Twitter limit of 140 characters. The other day, I decided to see about solving this.
There are a number of URL shortening services out there, but I kind of have a problem relying on a third party for the service. Also, one of the most popular one, bitly, is under a Libyan top level domain. I found YOURLS the other day and set it up. It was pretty easy to setup and I picked a subdomain for easy management. The WordPress Plugin for it kept creating extra links and that kind of annoyed me. I found that someone created a Twitter Tools plugin to work with YOURLS. I tested it and it worked perfectly.
So, now all my posts to Twitter are using my own URL shortener. The URL shortener is pretty maintenance free and easy to setup, so as long as I have my blog around, I think I can keep this running.