Some Things I’ve learned as a Freelance iOS developer

1.) Be picky with your clients. Clients typically fall into a few categories: easily impressed, too picky, or ignorant of the technology. The best clients to work with are those who have some sort of technology background, and have a FIRM vision in mind. In this way, you can build to the specs they want, and they can give you helpful, and valuable feedback. Clients who are too easily impressed will often give you ambiguous feedback that will never help you best finish the app or project. Clients who are too picky often cause a huge amount of unneeded stress and (in my experience) lead to rushed, un-polished work. Clients who are ignorant of the technology involved completely are VERY difficult to work with. For example, they may expect an Android version of an iOS app you built in a matter of days and for no extra cost since you are a “mobile” developer.

2.) Reuse code. Each project, there should be generic portions of the code that you could reuse between projects. For example, if you wrote a web services class for one project, you could probably use large portions of this web services class in a different project.

3.) Always ask for at least half the cost of the project up front. This gives you some confidence that the client will pay you for your time and work, and that they are serious about getting their project done.

4.) Keep communication consistent, but don’t allow clients to be obsessive. In my experience, daily contact is overkill. Freelancing is not necessarily a full time, everyday job. The client you are working for needs to realize this. They need to give you space to work. However, as a developer you are responsible for keeping the client up to date on what work you have done, and what amount of work is remaining. In previous projects, I have been poor at anticipating how busy I would be in the upcoming weeks and months, and have missed deadlines. So, I strongly suggest that you always expect to have half the time you think you will have in the next week, month, etc and communicate this clearly.

5.) Anticipate the worst. Always expect that the project will go awry. Spell out clearly in a contract initially what you are and  what you are not responsible for. Make sure clients know small things like a potential for a 2 week approval process into the app store.

How to Write your own Minesweeper AI

Lucky's Notes

A while ago, I wrote a minesweeper AI. I intended to publish a writeup, but due to university and life and exams, I never got around to writing it. But having just finished my Fall term, I have some time to write a decent overview of what I did.

Short 30 second video of the AI in action here:

How to Play Minesweeper

If you’re an experienced minesweeper player, you can probably skip this section. Otherwise, I’ll just give a quick overview of some basic strategies that we can use to solve an easy minesweeper game.

We start with a 10×10 Beginner’s grid, and click on a square in the middle:

We can quickly identify some of the mines. When the number 1 has exactly one empty square around it, then we know there’s a mine there.

Let’s go ahead and mark the mines:

Now the next strategy: if a…

View original post 1,572 more words

2012: Looking Back

2012 is almost over. It was an awesome year. Thanks to everyone that made it that way!

1.) The year began by entering a very intense second semester of my freshman year at the University of Michigan. I learned a ton about how to handle a tough schedule and balance my time wisely.

2.) After applying to many various internships, I found out that I had an offer from Path in San Francisco, a company that I had dreamed of working at.

3.) Besides just talking the normal workload, my friend Chris Wendel and I taught an iOS development class under the guidance of Prof. Ringenberg at U of M. We had the opportunity to build and give lectures. We made new friends, learned a ton, and gave a few students new skills to get internships.

4.) I made some great new friends through school. I can’t even name all of the great people I met.

5.) I worked the few month or two of the summer at Detroit Labs, learning again from Henry Balanon, Dan Ward, Nathan Hughes, and Paul Glomski.

6.) I made the trip out to California. I began working at Path, exploring the city, and learning true SF/silicon valley startup culture. It was amazing. I lived with Chris Wendel in the heart of downtown. Living on my own that far away from Michigan was a true adventure, and I am so glad I decided to make the jump this year. Least enjoyable part of this summer: sleeping on an air mattress for 2+ months.

7.) Since I was finally out in California, I was able to spend more time with Stacey Ferreira, cofounder of MySocialCloud. Besides explore the city, and the California coast, I was able to spend a lot of time with her and her brother. Midnight walks around San Francisco were awesome.

8.) I was able to speak at the Teens in Tech Conference in August! Thanks to Daniel Brusilovsky for that amazing opportunity!

9.) I came right back to Ann Arbor for school in September.

10.) I just finished a semester filled with much caffeine, great friends, and much math and code.

11.) I was able to head back out to the Bay for interviews in Palo Alto and the city.

12.) I was fortunate enough to receive offers from Path, Flipboard, Twitter, Detroit Labs, and Apple. I accepted an Apple internship for the summer.


Looking forward to next year, I have a few goals for myself. I want to become a better software engineer. One of the main reasons I chose to go to Apple was simply that I wanted a place where I could learn the most. By expanding my knowledge from simply iOS to Mac development, I will learn a ton more about Object Oriented Design, deeper components of the Objective-C language, and the Cocoa Framework. Regardless of where I choose to go in the future, I feel that Apple will give me a solid background.

Next, I want to learn to even better manage my time, and be more productive. Throughout the course of the past few months I have tried to work in freelance projects. Although the projects do get accomplished, I want to improve the way I schedule my time and mangage school, projects, and everything else going on in my life.

Finally,  I will be turning 20, and I know (mostly) what I want to do with my life. I want to continue to maintain and seek out friendships and relationships that help me accomplish my goals and push me beyond them. I want to make sure I take the time to do what it takes to keep these connections in my life strong.


Making Network Calls in iOS

A very common task of any developer is to write a web services class. In this post I will present a very common pattern for organizing and incorporating network calls into iOS apps.

To give a quick overview, we will be creating a singleton web services class. This basically means we will make a new class that stores all the methods for making network requests, and that the same allocation of this class in memory will be accessible across all views in the app. If you want to learn more about this design pattern, look at my other post.

So, lets create this class. In Xcode, create a new objective c file that subclasses from NSObject.

The header file will look like this:

// WebServices.h
// DC_magazine
// Created by Andrew Rauh on 6/4/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import <Foundation/Foundation.h>

@interface WebServices : NSObject

@property (strong, nonatomic) NSMutableArray *blogPosts;
@property (strong, nonatomic) NSMutableArray *titles;
@property (strong, nonatomic) NSMutableDictionary *selectedPost;

- (void) grabDataAndParse;
- (void) buildTitleArray;
+(id) sharedInstance;

And here is the implementation file. (.m)

// WebServices.m
// DC_magazine
// Created by Andrew Rauh on 6/4/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

#import "WebServices.h"

@implementation WebServices
@synthesize blogPosts, titles,selectedPost, ;

 static id sharedInstance = nil;
 if (sharedInstance == nil) {
 sharedInstance = [[self alloc] init];
 return sharedInstance;

 selectedPost = [[NSMutableDictionary alloc]init];
 NSURLRequest *main = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@""]]];

 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
 dispatch_async(queue, ^{
 NSURLResponse *response = nil;
 NSError *error = nil;

 NSData *data = [NSURLConnection sendSynchronousRequest:main
 NSString *json = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
 id parsedObject = nil;
 NSError *parseError = nil;
 if (json != nil && [json isKindOfClass:[NSString class]] && [json length] > 0) {
 parsedObject = [NSJSONSerialization JSONObjectWithData:[json dataUsingEncoding:NSASCIIStringEncoding]
 if ([parsedObject isKindOfClass:[NSDictionary class]]) {
 NSDictionary *parsedDictionary = (NSDictionary *)parsedObject;

 NSArray *posts = [parsedDictionary objectForKey:@"posts"];
 blogPosts =[NSMutableArray arrayWithArray:posts];
 [self buildTitleArray];
- (void)buildTitleArray
 titles = [[NSMutableArray alloc] init ];

 for (NSDictionary *dict in blogPosts) {
 [titles addObject:[dict objectForKey:@"title"]];
 //NSLog(@"%@", [dict objectForKey:@"title"]);


In this case, I used NSURLConnection with an asynchronous block to make the actual network call. After you make the call, you get NSData back. You then treat this as a generic objective-c object, and see if it is either a dictionary or an array. Once you figure out what data type the object you got back from the server is, cast it to that type of object and start iterating over its elements, and extract the needed data.

The reason this network call must be made asynchronously is pretty simple. On iOS, there is a main thread, where all of the UI code is run. If we put this networking code on that same thread, then all of the UI on the devices would completely freeze until we got the needed data back from the server.

Large Social Networks are Doing Mobile Wrong.

Yesterday I had the chance to talk to a Twitter iOS engineer. Although this was part of my interview process, there was some time at the end of the call to discuss whatever I wished to. So, I went ahead and asked why they trashed a pretty fantastic iPad optimized version of Twitter to resort to a strange, stretched out iPhone version of Twitter for all iOS devices.

He responded with this:

  1. It was a struggle to maintain two separate implementations of the same app. Obviously Twitter wants to be able to offer the same great features in all of its apps, and it was very hard to consistently ship  the same features for the two different apps.
  2. New users who are less tech savvy were complaining about how confusing different apps were for Twitter.
  3. We want the ability to define what Twitter is more. Before we sort of let people use it for whatever they wanted, and now as new users join who are less familiar with tech, they want to know what they are signing up for .

This sounds very, very similar to the facebook mobile engineers who defended the use of html5 webviews in the iOS app until recently.

This way of thinking is just wrong for mobile.

The iPad and iPhone are different devices. The same applies for android tablets and phones. Tablets are not phones. With the extra screen space, there is an amazing amount of creative potential for developers+designers+product people.

Although it is easier for engineers to not worry about two separate code repos for the different apps, the end product takes a MASSIVE hit. The entire reason the iPad exists is to allow for a great way to interact with data with the large multitouch screen. If you really think that taking an app interface designed for a screen a 3rd or 4th of the size and just stretching it to fit is the best way for you to allow your consumers to interact with your service, then you are flat out wrong.

Yes, I realize this is not as efficient or logical as shipping a moderately nice app for all devices, but larger social networks need to realize that sometimes sacrificing business logic will produce a much better experience for end users and perhaps also result in happier engineers who are allowed to have more creative freedom in their products/products.


A few thoughts on school, startups, and life.

This is a post I have been wanting to write for awhile and am now actually putting it into action!

First up, is school worth it? Why not just drop out and move to SF and work?

Well. This is my approach. School can teach you several very, very important lessons. School humbles you. Sometimes the startup culture can make you delusional in terms of how talented you are, your friends are, and how “genius” you really are. On the other hand, school puts you on a playing field with incredibly talented, competitive people. I have never had to work this hard for my classes and grades before. I hate it sometimes, but at the same time it is forcing me to learn to work incredibly hard and intensely focus.

When you get into a class with 500+ other talented, focused CS majors, it is terrifying, and inspiring. These people are all very intelligent, and it is up to you to perform as well and (hopefully) better than them. It is totally up to you. If you slack off, you know that there is going to be a majority of students who dont, and will kick your butt on the next exam. You need to rise to the challenge and realize sometimes things are not just easy and placed in front of you, instead you need to work very hard for them.

Define yourself. Never just be another Engineering, LS&A, or Music student. Stand out. Find your passions and make school work for you. For me, I really want to learn more about CS and the concepts behind it, but at the same time I need to advance my understanding of business, design, and many other disciplines. You shouldn’t necessarily fit the stock template for undergrad computer science engineering, or whatever program you are placed into.

One thing I did not expect coming to college for a technical degree was that I miss my english, literature, history, and other liberal arts classes. Sometimes, something from AP Gov or AP Lit would inspire a train of thought in my head that lead to a cool idea for a side project or app. When you only have technical classes, I personally feel less creative and less enlightened in certain areas. While I do really value getting an amazing amount of technical depth into Computer Science type stuff, I do miss the blend of that science with liberal arts. I think the connection of those two disciplines makes you a better thinker.

So, what do I think of the Startup World?

I love it. But. You can only appreciate the startup culture and world after seeing the real world. The startup culture is not really that realistic at times. Maybe your idea really isn’t that great. Maybe you don’t need 2 million dollars to build an app and pay rent in downtown SF. Maybe you should actually have a business plan before you raise 10 million dollars. I love the freedom to innovate, but if you don’t have the background of critical thinking introduced in school, you can never really take full advantage of the amazing opportunities offered out in the Bay Area. That being said, I plan to do my own startup one day. The “unrealistic” aspects of Silicon Valley are also what allows such cool things to be created.

Thoughts on Life.

Although it may not really seem like that much time, I have learned a ton since starting college. From the small things (like learning that actually cleaning your room, doing laundry, and successfully cooking make you feel better) to much broader things. College teaches you to intensely work and focus. There is something tremendously valuable about learning how to take content and master it.

When you have classes or challenges that seem very difficult, don’t be afraid to attack it. I knew coming into this year one of my EECS classes would be challenging. But, I am determined to do well. This means making it my top priority over everything else.

Again. Define yourself before others define you. Don’t let others tell you what is morally right or wrong, Don’t let others tell you what you should be interested in, or care about. And most importantly, don’t let others define your personality, style, and approach to life. And, if you are not at a point in your life where you feel comfortable defining yourself, then surround yourself with people you consider “better” than yourself in whatever ways you want. You will become like them. Or better.

Thank you, California.

Goodbye California. You were awesome.

Thank you Kleiner Perkins and Path for hosting and teaching me. Nothing can describe how much I have learned from this entire experience.
I met so many awesome people this summer, and was able to hang out with a ton of friends.

Path – You were awesome. I was able to learn about the true value of a building a high quality product. Path provided a window into a culture that sits at the intersection of art (design) and engineering (server + iOS). When these two disciples are mixed correctly and have the right leadership, beautiful things are built. Path is that product. Even though I still like dot syntax for Objective-C…

Kleiner Perkins – The connections you provided for us were simply incredible. All of the various tech talks and events were tons of fun. Thank you so much Andy Chen for this experience. Being able to spend time with tech legends was awesome.

To Randy, Alice, Joao, Aki, and Arash: You guys were a ton of fun. You were all very smart and great to work with. I hope we get a chance to work together soon.

Thanks to everyone at Teens in Tech. I really enjoyed speaking! Hopefully those listening actually enjoyed my rambling.


Finally, it was awesome being able to hang out with so many friends from school + online out here.

Goodbye summer.

Now. Sophomore year…

Just a few thoughts from this summer.

So, I finally made it out here for a summer. This summer I had the awesome chance to work for Path, and be a part of the Kleiner Perkins Engineering Fellowship. I learned more about myself than I ever would have expected to. This summer was one of many firsts for me. It was the first time I had ever traveled alone. It was the first time I was fully responsible for myself financially, emotionally, and physically. I loved it. It was my first time living in the heart of city. (It was the first time for many other things as well such as eating octopus and seaweed salad…)

There is no better way to learn your true beliefs, thoughts, and values than to force yourself into a completely new environment surrounded by strange people you have never met. When you have no outside forces acting upon you or telling you what to do. (i.e. family or parents or friends) you have the freedom to make up your own mind. This is an awesome and incredibly powerful thing. You have the freedom to do nothing all day, or you have the freedom  to do something that is amazing and useful.

I used this summer to learn, grow, and learn more about who I am. This happened through exploring the awesome city of San Francisco and California in general, spending time with tons of friends who visited and live out here, and spending time walking and thinking. I have found a deep motivation to be as successful as the people I had a chance to meet this summer, and as a result my relationships with friends, family, and my girlfriend have matured. I have a more developed perspective on the work I do, and education.  I value learning from people who really, really know what they are doing. At the same time, I have learned to not waste time being annoyed or bothered by people who are out to bring you down, or lie about their true beliefs and abilities.

More than anything else, I have learned you have the complete ability to build the kind of life you want to have. Just because you were born into a horrible background, or were raised in certain way should mean nothing. While it may impact your opinions, you are just as influential on life as those who had a privileged background or powerful parents. Build the life you want, and form the relationships and friendships you want. You can make things work they way you want them to with the right effort and focus.

Keep things in perspective. Coming out here has also taught me this. Certain things that may seem really important one day really aren’t. Others, which may seem useless now, are critical later on. I am still figuring out all of these things, but I can say I learned a ton of them and the difference between the two this summer.

I have learned to value “down time.” Having time to just reflect and think is CRITICAL. Without it, you forget how much value things have. You lose sight of valuable friendships, incredible experiences, and huge choices.

How to easily pass data between Views in iOS

When I first started developing for iOS, one huge problem I encountered was how to easily pass and keep data between view controllers without having to save the data to a database of some sort and/or use nsuserdefaults. One way of doing this easily would be using a shared instance of a class that contains the information you want to save.

Here is a link to my github repo of the code:

Basically, you add a method called shared instance to your class that will “store” the information. In this case a class called DataStorageController will be used to hold the values entered on the first screen and pass them to the third view we see.

The method we use to do this shared instance is this:

+(id) sharedInstance 
    static id sharedInstance = nil;
        if (sharedInstance == nil) {
            sharedInstance = [[self alloc] init];
   return sharedInstance;

//and when you allocate a new instance in another view controller do this

DataStorageController *dataClass = [DataStorageController sharedInstance];