10 Things I Learned from C4[2]

I went to C4[2] last month. For the uninitiated, C4[2] is the third (yes we count from zero) conference of its kind, a conference for independent-minded Mac and now iPhone developers, held annually in Chicago, Illinois. It is run by Jonathan “Wolf” Rentzsch, who is an independent Mac / WebObjects consultant.

It was a great gathering and I look forward to going to C4[3] if I have the opportunity. So I thought I’d share my top 10 things that I learned at the conference:

1. Getting like-minded developers together at one place generates a lot of energy, enthusiasm and knowledge sharing.

I think it’d be great if we could replicate what has been happening in the Ruby community and start to have Regional Objective-C conferences. This has started to happen with the iPhone Dev Camps already, but it’d be great to have combined Mac / iPhone Regional conferences, so devs that can’t afford to travel to Chicago and San Francisco can still get involved and interact with each other in Washington D.C., New York, Seattle, Denver, and wherever else we all are.

2. iPhone development has really come into its own, but its knowledge continues to be restrained by the NDA.

We started off with a presentation by Craig Hockenberry of how iPhone has changed the way humans interact with computers in much the same way the mouse did. We ended with a programming contest called Iron Coder (a play off of Iron Chef) which traditionally has been with Mac OS X APIs but this time was on iPhone with an iPhone API. I finally participated (after helping with past Iron Coders by providing licenses of WebnoteHappy as prizes), collaborating with Joe Pezzillo to produce CoreParanoia and also contributed a tiny bit to Jose Vazquez‘s 2nd place Tipster.

The rest of the presentations were not iPhone focused, but there were mentions of it throughout. And it seemed like having an iPhone was part of the requirements for attendance. I personally got a live demo from Tim Burks of his iPhone app Masyu which is a pretty fun puzzle game.

The problem however was that the NDA on iPhone development stifled a lot of the conversation. This generated a lot of complaints and even a t-shirt that rebelled against it.

3. Security is scary, but not as scary as not succeeding.

There was a wild presentation on security that said: don’t pretend to be a security expert. Stick to using the Keychain or bcrypt for passwords, use openssl or gpg. Don’t use installers or open up listeners on ports. Don’t write directly into the DOM. But all of that doesn’t matter if your business doesn’t succeed if you don’t have a nice looking application and it is unstable or slow. Also, filter user-supplied content and write a fuzzer for the content you accept. Make sure you have a security contact, use a crash reporter, and use auto-update securely. Finally, turn off Java in your web browser to prevent against some of the newer, crazier attacks like GIFAR.

4. Mac users really care about user experience (as if you already didn’t know that.)

To reiterate what we all sort of know but sometimes overlook since we are so deep in our code, Mike Lee presented “Pimp My App.” The basics: Use real artists, don’t skimp on your art budget, watch real users use your app, solve a specific problem, and cut as many features as you can.

He also offered some iPhone specific UI tips: start as fast you can, the start-up screen should not be used as a splash screen but more like the real app, restore the state of your app instead of just restarting, don’t block the UI, and think about the user’s first experience carefully.

5. Contractors / consultants are Indies too.

I’ve made applications and I’ve done consulting. Both qualify you to be an Indie, meaning independent from another company. There was a presentation by Andy Finnell on this and it mostly reiterated what I knew but it was nice to hear it from someone else. Basically: make sure you have good contracts, these will help you get paid properly and avoid constraints your future development. I’d add to this that if you can be choosy, it is good to figure out what kind of clients you want to work for and what kind of projects you want to work on and then only choose those to work on, even if it means taking some time off between projects.

6. Pricing sends a message

Rich Siegel of Bare Bones gave a presentation on lessons learned over his career. One of the key ones is that pricing: is a marketing message and shows how you feel about your product. It also needs to consider how much your overall costs are. It also positions you among competitors. That being said, your product / service definitely needs to be differentiated to justify a premium.

7. Warnings should be fixed

This is probably also a no-brainer but I’ve been at a few companies / projects where warnings are tolerated. Mentioned by both Rich and Mike, warnings can be the cause of run-time errors down the road. Its best to generate the most warnings possible and fix them as they come up. You may find it also advantageous to treat warnings as errors, but either way way, fix them.

8. Mac programmers really care about fonts

Minor but revealing tidbit: the fonts at C4 are carefully chosen. Compared to other conferences I have been to, I think this shows that Mac programmers care about design more than other programmers.

9. Twitter is the preferred method of communication in the Mac / iPhone developer community

When I wanted to see what was going on and what people were thinking, I checked Twitter. At other conferences, sometimes we would have IRC back-channels. Using twitter makes the back-channels more open. Also, we voted for Iron Coder via Twitter.

10. Do the simplest thing possible

Mentioned by Craig, Buzz Andersen, and Mike, doing the simplest thing possible, getting feedback and then iterating on that is a good technique when developing products. I knew this before, but many of us are perfectionists and so we have to keep reminding ourselves of this in order to combat the tendency to either add more features or to keep trying to perfect a certain specific part of our app.

Generating random numbers in Cocoa

I’m writing an application to pick prize winners for the RubyNation conference that’s coming up here in the Washington DC area. As part of that, I have to generate random numbers. So I went looking for how to generate random numbers in Cocoa. I was looking for something reasonably fast, built-in to Mac OS X, had an easy to use API, and had the most randomness. I defined a random number generation algorithm as being more random if it had a larger range of numbers that it could generate.

The basic usage of a random number generator is something like this:

  1. Seed (initialize) the random number generator
  2. Generate a random number
  3. Modulo the random number against your maximum number to get a number from 0 to your maximum number – 1.

Alright, first off I looked for Objective-C libraries. You know, maybe there was an NSRandom or something like that. There isn’t really one, so I went to look for C functions instead.

Digging into my memory banks, I remembered from my early C days that the standard C library call is srand() with a seed to initialize and then rand() to get the random number. So I looked up srand in the Apple Developer Connection (also known as ADC)
and came up with the laughable description:

rand, rand_r, srand, sranddev — bad random number generator

These interfaces are obsoleted by random(3).

Alright, so onto random. I looked up random in the ADC to see its Mac OS X Manual page. Alright, so it can generate numbers from 0 to (2**31) – 1. You can seed it with srandom() – which could be useful because the same seed will generate the same sequence of random numbers – useful for replaying a game sequence. A better seeding is to use srandomdev() which creates a state array which can’t be guessed by attackers and effectively uses the /dev/random device.

OK that seemed pretty good, but I read on and found this intriguing line:

Applications requiring cryptographic quality randomness should use arc4random(3).

Alright, so now I look up arc4random on ADC. arc4random uses the Alleged RC4 cipher, hence the ARC4. It has a range of 0 to (2**32 – 1), which is twice the range of random. It uses the /dev/urandom device. And best of all, in my opinion, it doesn’t require seeding/initializing since it initializes itself.

So the winner in my book for generating random numbers in Cocoa (really any Objective-C or C program on Mac OS X) is arc4random.

NSCoderNight tonight in Northern Virginia

I’ve been going to the past few NSCoderNights here in Northern Virginia. We’ve met up at Panera in Tysons before (look for the Apple logos.) But tonight we’re trying a different venue: Camille’s Sidewalk Cafe near the Courthouse Metro in Clarendon, VA. More details in Jose’s blog entry Trying a new location tonite.

It’s been pretty motivating to meet up with other Cocoa Mac and iPhone developers. I think we’re going to be discussing Cocoa Programming with Mac OS X by Aaron Hillegass soon, working our way through the chapters. I was privileged to have the experience of doing technical review on that book and I’ll have a full review of it on this blog soon. Short review: if you have the 1st or 2nd edition, it will help you get caught up to the newer Cocoa APIs and so its worth getting. If you don’t, then you definitely need this book to help you with your Cocoa programming. Big Nerd Ranch uses it as a text book for their Cocoa Bootcamps!

Cocoa / Washington DC Trivia: Aaron Hillegass grew up in Northern Virginia. We actually attended the same high school, Thomas Jefferson High School for Science and Technology, though at different times.

2007 Training in Review

Last year I took a lot of training. In the past, my employers would usually send me to one training event. Sometimes I would get to go to two if times were good. Other times, there was no training budget.

In 2007, I was self-employed as the sole member of Happy Apps LLC. So being in charge of the training budget (well actually the entire budget), I went to six training events:

  1. Rails Edge in Reston, VA
  2. Advanced Rails in Chicago, IL
  3. WWDC in San Francisco, CA
  4. RailsConf in Portland, OR
  5. Advanced Ruby in Reston, VA
  6. RubyConf in Charlotte, NC

So that’s 2 Ruby conferences, 3 Rails conferences, and one Cocoa conference. I actually was scheduled to go to another Cocoa conference, C4[1] over in Chicago, but had to cancel due to personal reasons.

So which ones were good and which ones were bad? I think they were all quite good. Obviously, if you want to make Mac applications like I do with WebnoteHappy, you’ll want to go WWDC.

In terms of being a good Ruby on Rails developer, I’d have to say that assuming that you already have a good background in object-oriented programming and web development, have worked through a beginning Rails book like Agile Web Development with Rails, then you really should take both the Advanced Ruby course by Pragmatic Studio, followed by the Advanced Rails course. Both taught me quite a lot of things that I hadn’t known before.

Once you’ve got that though, I think its important to keep up with the latest in techniques and also be involved in your programming community. I think The Rails Edge Conference is top notch in keeping up with what’s new in the Rails world. I hope that a date is announced soon though – I don’t see one for 2008 as of today.

RailsConf is also good for keeping up with Rails, but I think is maybe even better for just being involved in the Rails community. There were a lot of opportunities, scheduled and unscheduled, to get together with fellow RoR developers and you could sense that Rails is really changing the way that web development is being done.

RubyConf on the other hand reminded me that Ruby is not just about Rails. There’s certainly been a lot of growth of Ruby use because of Rails, but there is a deep and wide pool of talent that has fallen in love with Ruby. It was interesting to see all the different uses that people have made of Ruby. And it was definitely an honor and a pleasure to meet Matz in person. In the end, it does seem like most people who are doing Ruby full-time are making their money with Rails.

I’m trying to plan out my training in 2008 now. So I’m curious to hear what good conferences or classes other people went to in 2007. Also if there were any bad ones.

The software industry lacks political clout

So I’m still upset at this new Maryland tax on software services. I hope it is not a harbinger of what is to come. Hopefully it is just a bad move that is a short term fix for whatever is ailing Maryland’s budget. But I think it points out something that is broken about the software industry. We lack political clout.

The Washington Post had this to say in its lead editorial today titled O’Malley Increases Influence With Wins on Taxes and Slots:

Interest groups with savvy lobbyists and deep pockets got special breaks; car dealers, for example, were treated to a subsidy worth $80 million. Those who lacked comparable clout, like some segments of the computer services industry, will be hit by a sales tax increase that, inexplicably and illogically, still does not apply broadly to most services in the state.

Now, I’m not saying that we need to have any subsidies, tax breaks, or any other sort of special consideration. But it is completely unfair that the computer services industry was singled out for a new tax. We should at least be able to defend ourselves from getting sand kicked in our collective face.

Perhaps it is because thankfully, we’ve been successful. The Washington Post had this to say in its main article yesterday about the new tax titled Md Lawmakers Approve Package:

The only service agreed to yesterday by House and Senate fiscal leaders was computer services — largely because of the nearly $200 million a year in estimated revenue it could generate.

There is some hope that it will be reversed in 5 years when they review it:

Computer services that would be subject to the tax include consulting and programming help, as well as software installation and hardware maintenance. Legislative analysts said at least nine other states tax computer services. The group of legislators agreed to revisit the issue in five years to determine what effects the tax has had.

But I wonder… will we be in any better shape then as an industry to defend ourselves?

Taxes on consulting?

I woke up this morning and nearly spit out my coffee as I read that the neighboring state of Maryland (I live in Virginia) is going to start charging sales tax on computer consulting – to the tune of 6%. That starts next year, January 1st 2008. This is a huge change and seems somewhat arbitrary since among the list of things considered were landscaping services, tanning salons, saunas, etc.

I’m not sure how the Maryland software consultants are going to cope with this. The easiest theoretically but probably hardest in real life is to just move to Virginia or Pennsylvania or Delaware, which don’t tax consulting services. They could also pass the cost on to their clients – which may be ok in the short term but I think will probably put them at a disadvantage vs other companies in neighboring states. They could eat the cost, but basically that’s a 6% pay cut. Or they could go and do something else, which is unfortunate. I’d say the first and last option are those unintended consequences that you always hear about. Side-effects in programming terms.

So what about everyone else in other states? Do you have to charge your clients sales tax if you’re doing consulting?

DC Mac Programmer Meeting – February 23rd

Calling all Mac programmers in the DC area! We’re going to have the first DC Mac Programmer Meeting of 2006. (We last met in November, which I’ll have a recap of later.) And when I say we, I mean the Programming SIG of the Washington Apple Pi, the area’s largest Apple user group.

We’re meeting on February 23rd, which is Thursday at 7:30pm at the Booz, Allen, and Hamilton (BAH) building at 8283 Greensboro Drive in McLean, VA. The main entrance is near the “u” of “Solutions Drive” in the Google Map below. (Hint: use the Hybrid view to see what I’m talking about.) If you get there late, we’ll leave a note with the security guards where we are.

But even better…a bunch of us are going to grab some dinner at 6:30pm at the Panera off of Route 7 near Tysons Corner. Hopefully we’ll have some nice wireless access. Not sure what to look for… probably a bunch of guys wearing black Apple t-shirts and aluminum PowerBooks.

Here’s a Google map that starts at the Panera and ends at the Booz building.

If anyone needs to come via Metro, I’m going to pick up someone there at the West Falls Church Metro. Actually that person is Colin, who helps develop the open source multi-IM client, Adium.

If you’re coming, please RSVP with me at comment at luisdelarosa.com.

Creating a branch in Subversion from a specific older revision

Branches in Subversion are quite easy and really lightweight. I think the technical term for this is “cheap copy”, which doesn’t quite do it for me. I mean, I’d rather call it an elegant and efficient copy, but I didn’t create my own version control system.

To create a branch of your source base in Subversion, you usually just execute (if you’re using the file-based version and the repository is in /Users/yourName/svn):

svn copy file:///Users/yourName/svn/yourProject/trunk file:///Users/yourName/yourProject/branches/yourProject-1.0

Note that you need to have the branches directory added and committed to your repository. It won’t automatically add this for you.

This does it for working from the head of the trunk. But what if you wanted to branch from an older revision? It turns out to be quite easy:

svn copy -r specificRevisionNumber file:///Users/yourName/svn/yourProject/trunk file:///Users/yourName/yourProject/branches/yourProject-1.0

How to fix certain SVN commit errors

If you’re getting an error message that looks like:

subversion/libsvn_client/commit.c:832: (apr_err=155005)
svn: Commit failed (details follow):

Then try backing up your project directory and re-check it out from Subversion using “svn co “.

If you then get something that looks like:

subversion/libsvn_wc/log.c:337: (apr_err=155009)
svn: In directory ‘YourProject/trunk/someDirectory’
subversion/libsvn_subr/io.c:565: (apr_err=2)
svn: Can’t copy ‘YourProject/trunk/someDirectory/.svn/tmp/text-base/foo.html.svn-base’ to ‘YourProject/trunk/someDirectory/foo.html.tmp’: No such file or directory

Then the problem may be that you have checked in both YourProject/trunk/someDirectory/foo.html and YourProject/trunk/someDirectory/Foo.html. Try to avoid this. This definitely causes problems on OS X and may on other systems.

To verify, execute “svn list /someDirectory/” and look for two versions of the file, but with different cases.

To fix, execute “svn remove /someDirectory/foo.html” or Foo.html, depending on which one you want to get rid of.

Mac Programmer Meeting in Northern Virginia – November 17th

We’re having a meeting of the Programming SIG of the Washington Apple Pi, which is the big local Mac users group in the area.

It should be fun. The group started rewriting a Cocoa app using Core Data and Bindings that we use for raffling off prizes at the user group meetings. It’s called…Raffler. What’d you expect? iRaffle?

Details:

What: A Bunch of Mac Guys Hacking Away on Cocoa and other stuff on PowerBooks

Where: 13161 Fox Hunt Lane, Herndon, VA

When: Thursday, November 17th, at 6:45pm

How to get in: RSVP with me via the email link in the upper left corner of my blog. I’ll tell you about the secret handshake.