Category Archives: Programming

These posts are talking about learning to program.

Legitimate Complexity and The Art of Teaching

I have been working on a book on Metal for the last several months, since October. I am entering one final push and trying to complete the rough draft of this book by the end of June. That gives me about a week to write each chapter, which is really stressing me out and upsetting me tremendously.

The thing that is stressing me out is that I feel like learning Metal is like zooming into a fractal. Every time I think that I have a good grasp on the material, I realize there is a much more complicated layer of complexity underneath what I just learned. The complexity grows exponentially.

Metal is multi-disciplinary. It’s not just the framework. It’s all the things around the framework that you need to understand in order to actually create something useful. There are a lot of math concepts and a lot of 3D graphics concepts that most books on OpenGL don’t focus on because no one wants to write a 2000 page book that contains everything you need to know that absolutely no one will read.

I am frantically trying to edit myself enough to present a coherent chunk of information in each chapter without getting overwhelmed with all the things I don’t have time to explain or learn.

I’ve been an iOS developer for the last five years. I learned a lot of programming from Ray Wenderlich tutorials. Those tutorials are fantastic, but I feel like they give a false impression that anything anyone wants to do can be broken down into a 3,000 word step-by-step tutorial.

Right now I am trying to work through their 2D Games by Tutorials book. This book is a monster. It’s nearly 700 pages long. I have only ever gotten through the first 150 before I got overwhelmed and given up. I managed to get further than I had before, but it’s still incredibly dense. If you asked me what they could have gotten rid of to make it less overwhelming, I would be hard pressed to tell you.

A lot of things we do, especially when we’re starting out, are small and easily encapsulated. This lulls us into a false sense that everything we do will be simple and easily encapsulated. We develop sound byte memories where if something can’t be spoon fed to us in ten pages or less, then we get muddled and confused. This severely limits our ability to work on anything more complicated.

I am absolutely not picking on Ray’s site. It’s an amazing resource and the reason the tutorials are set up the way they are is because of this issue of us only being able to handle a certain amount of complexity. His site is working with how we process information rather than being a source of bad habits. I have nothing but admiration and respect for the writers on that team and I do not want this to come off as me bashing them or saying people who learn from that site are not real developers. I am simply talking about how for the last few years I have lulled myself into believing that everything can be broken down into easily digestible chunks when not everything can.

At this point I am trying to figure out how to expand my brain’s bandwidth so that I can tackle more complexity than I am used to. It’s incredibly difficult to do so. Not only am I trying to figure out something incredibly complex, I am also trying to process and package it into a digestible chunk by another person.

I have been reading a lot of graphics books and gotten frustrated at how abstract they are. I get frustrated that certain things are assumed and that nothing seems to be explained. I am now beginning to understand that once you reach a certain level of complexity there is a limit to how well you can convey that information.

This is an issue we are currently dealing with in our political sphere. Take the tax system for example. The tax system is an incredibly complex system that most people don’t really understand. When we go to vote for our representatives, it sounds good to say “Reform the tax system to make sure everyone pays their fair share,” but how to actually implement that is complicated. Something that is simple and sounds fair usually winds up being worse that the current system that is too complicated to explain in a 30-second sound byte on the evening news.

In programming we talk about precision and elegance. Those are concepts that do well in incredibly controlled and contrived situations. When you have to deal with things in the real world, stuff gets messy. There are edge cases. Things don’t behave predictably.

For a “simple” example, look at dates and times. There are 365 days in a year, 24 hours in a day, sixty minutes in an hour, and sixty seconds in a minute. Except when there aren’t. Every four years our year has 366 days. Then you get into leap seconds. Then you have Einstein’s Theory of Relativity where clocks that are shot into space are slightly off from their counterparts back on Earth. Things get wibbly wobbly awful damn fast and this should be a straightforward example.

I get that the world is so hopelessly complex that if we tried to understand the full scope of just how little is standing between us and total anarchy our heads would explode. We simplify complex systems as a means of being able to just cope with every day.

Right now I am frustrated because I am just beginning to grasp something that is hopelessly complex, but I don’t know how to package it in a way that is accessible to a group of people. I want to write a Rosetta Stone where someone can read through my book and totally understand a complex system, but that really isn’t possible. It would take a hundred pages to walk a reader through creating every piece they need to get a minimum useful thing up and running.

I am doing the best I can to present the information to someone in a way that will help them figure things out. I am trying not to be hard on myself for not being able to do an impossible thing. I know with several years of practice and working with this, that I can master it. I have to accept that there is no magic book that will intuitively teach you everything you need to know in order to do something legitimately complicated. I can just try to do my best to present what information I think your brain can handle and hope that you can find the next step to figure out the rest for yourself.

Why I am Discontinuing my Algorithms Series

I have spent the last week doing some soul searching and I have decided I am going to discontinue the planned algorithms and data structures series I was going to do on this blog.

My calculation was if I attempted to solve one problem in Cracking the Code interview each day it would take me about six months to get through the whole book. That was before I encountered several road blocks with attempting to implement a custom data structure that was not really intended for this use and required me to greatly extend its functionality.

I made the mistake of reading the beginning of Cracking the Code Interview and to my horror, found a lot of the same things I was saying in my post about the algorithms of discrimination, except they were being touted as features and not bugs.

The author indicated that companies know you probably won’t use algorithms on a day to day basis, but that they’re being used as a proxy to see if you got a computer science degree. They’re assuming if you got a computer science degree you’re a good programmer.

I am a hacker. I love to build things. I love to wander off into unexplored areas of our field to figure out how something works because I enjoy doing it. I love to craft code and make things work. I am fascinated by how to actually grow a complex code base in a way that is sustainable. I am interested in figuring out how to break up a seemingly insurmountable task into pieces that can be accomplished. I am interested in figuring out how to make my code better and I am willing to write absolutely terrible code initially that I know I will go back and fix to get to that point. I am interested in how my user interacts with my code and making sure it’s seamless and intuitive.

I know that not all companies are the same, but my experience of interviewing at companies that use algorithms screening is quite bad. I feel like I am being treated like a criminal whose guilt is assumed and I have to prove my innocence but I don’t get a chance to call a lawyer.

I have never had an interview at a company doing an algorithm screen where anyone has bothered to read my resume. Most of them ask me how they’re supposed to know if I know how to code or not without this screen. Well, I have written books that are published and available. I write about code on this blog. I speak about code at conferences. I post code on GitHub.

A lot of these companies are also ones where they expect relocation. Relocating is a massive deal for me. I have a stable and cheap living situation at the moment. I have parents to watch my second pug while I take the first pug with me to conferences. I have issues with depression and other mental health that are exacerbated by being in urban areas.

If a company is going to demand that I uproot my life, greatly increase my cost of living, and give up the stability of working from the place I feel most comfortable, I want them to not treat me like a criminal. At the very least read my resume. Don’t put me in a situation where I don’t get to speak to an actual human being until I jump through some hoop to prove that I got a computer science degree.

I heard a lot of people telling me that I am shitty developer because I am refusing to spend a few months learning data structures and sorting algorithms.

I disagree.

I feel learning this stuff without context is yak shaving. It’s future engineering. It’s learning something before you need to know it. It’s important to know it is out there, but it is not vital to learn it before you need it. If you spend all your time learning things before you need them, then you won’t build anything.

I learned so much about my code after I started implementing it. I wrote what I thought were solid data structures until I tried to work with them in my code. I found I had underlying assumptions about it that were wrong and I had to go back and add functions and properties to correct for my assumptions.

We like to think that the world can be simplified with algorithms in text books, but they rarely account for the complexity of the real world. You wind up adding bits and pieces to deal with edge cases and your artfully crafted algorithm turns into a house with pieces tacked on. Why not go into it knowing that you’re doing something complex and ugly rather than simple and elegant but imaginary?

There is the argument that I won’t understand how programs work if I don’t learn data structures and algorithms. Again, I disagree.

There are so many things we could use as a proxy for actual engineering knowledge. Why not ask candidates to write things out in assembly language? Why not ask them about computer architecture? Why not ask them how they would break out a large project into smaller pieces? Why not ask them about how they would test their code?

How many people have used a disassembled on their code to look at what the machine is actually doing? I just found out this is something I can do and it’s magical to me. It’s far more interesting to me than memorizing the difference between a bubble sort and a quick sort when I will always just use the sort() function on collection types in Swift anyway.

For whatever reason, this is the thing that we use as a proxy for being a good developer and I am not doing it.

I am interviewing companies and ones that behave like this are ones I don’t want to work for. If this is a small component of a larger hiring process, I am willing to engage in it, but not as a barrier to entry to even get to talk to a human being.

So instead of trying to please large companies and shave all my edges off and submit to conformity, I am going to build things. I am aware that there are algorithms and solutions out there that could make my code cleaner and work better. Once I get something working I will go back and refactor it to resolve many of the issues that I know are there. My understanding was that refactoring was part of being a great developer too. If you disagree with that, then I really hope I am not stuck maintaining your legacy code.

I have faith that if I keep learning and working on cool projects and contributing to the programming community that there is a place for me somewhere. It may not be one of those big companies on the West Coast, but I think the world is big enough to accommodate a lot of different kinds of people.

Super Mario Brothers

I have written on here before that I did not get to play video games as a kid. The closest I got to a Nintendo was watching my daycare owner’s kids playing Super Mario Brothers on the NES from the couch because I never got to join them.

When I watched them play, they knew where all the hidden shortcuts were. They knew to jump in certain places to hit invisible boxes and to travel over the side of a wall to get to a pipe that allows them to skip a bunch of levels.

I wondered as a kid how they found all these short cuts. I realized at a certain point that someone else showed them. Someone created a guide that talked about where all the easter eggs were and people either found them through reading that guide or watching someone else play.

There are speed records where someone can get all the way through the game from beginning to end in just over five minutes. It became a thing to try to get through the game as fast as possible.

As a kid I didn’t really understand that. I thought the point of the game was to play the game. I was told by people rolling their eyes that the point of the game was to beat the game.

I wrote a post yesterday talking about my being upset about the algorithm questions that are asked at programming interviews.

I have gotten a lot of push back on this.

I have been accused of being incompetent and not being a real programmer. I am confronted by people who are angry with me for not just accepting that if I read an algorithms and data structures book that I will be a better programmer.

I feel I am being misunderstood.

I feel like a a lot of people telling me this are like the people who I watched playing Super Mario Brothers as a kid. I think that they have been told there is some bible of short cuts that get you through the game faster. They don’t look around on their own or explore the game. They’ve been given a set of instructions that gets them through the game faster and they can’t comprehend why someone would not take a short cut that they know is there.

The impression I am getting from people is that they are blindly accepting that these are strict rules that we are supposed to follow and if we don’t follow them then we’re ignorant and wrong.

I think about all of the levels that the game designers created that no one ever looks at because everyone is in such a hurry to get to the end and beat the game.

I don’t care about beating the game.

I care about playing the game.

I don’t want to accept that there is only one way to be a programmer. I like to find things out for myself. I want to explore more than one way to do things. I don’t want someone telling me my code is wrong because it’s not the way they would do it because they only know one “right” way. I think there are a lot of right ways.

I did not mean to imply there was no point in learning algorithms. I am sure they have their place. I’m sure the right algorithm in the right place would completely change the way I think about my code. It’s just that over the last two years I have seen so many people implement lots of terrible code that they think is “best” because they read in a book somewhere that things have to be a certain way.

I had someone try to create a protocol around a class that would never be subclassed because it’s what he thought Apple wanted him to do because he didn’t think critically about how to use polymorphism properly. I have had people suggest I simplify my code by doubling the code base and add three or four data structures to get around using an if statement.

Singletons are evil. React is evil. JavaScript is evil. Use MVVMMVVMMVMVC. Emacs over Vim!

There was a lot of push back against Swift when it first came out because it was different. People lashed out at it because it was not what they were expecting or familiar with.

I feel like sometimes we over-engineer things instead of looking for simple solutions. We think we have to place a thing in another thing and guard against the possibility that someone in the future will do. We have to force a tool to act like another tool in order to conform to some protocol rather than using it how it’s supposed to be used. We want everything to be one size fits all because it makes life easier to think that way.

Right now I am trying to see if a simple solution will work for me before I implement a more complex one. I don’t want to just blindly apply something because a stranger on the Internet tells me to.

Just reading an algorithms book doesn’t make you a good programmer. Understanding a problem and when to implement the right algorithm makes you a programmer.

I want to figure that out for myself rather than having a bunch of people talk down to me about how I can beat the game in five minutes. I am actively refactoring my code to implement better solutions, but I don’t want that to be my first step. I want to screw up and do stupid shit so I can learn from it and figure out how to do it better. Sometimes when you think you know all the answers you don’t look for new ones and if you’re not learning anything new then what’s the point?

I’m sorry for people misunderstanding my desire to figure things out for myself as being willfully ignorant or contemptuous for good software development. You learn more from your own mistakes than you do from other people’s. The last time I checked, thinking for yourself was still allowed. I don’t care if you hate me, or think I am wrong or ignorant or stupid. I am entitled to my own reality and you are too.

The Algorithms of Discrimination

This is a cross post between this blog and my podcast. I realized that this blog has more reach than the podcast does because it’s new, so I am posting the script from that podcast here.


This is a special episode of Janie Rants.

I have been asked a lot of questions about a series of tweets I posted on Twitter last night. In these tweets, I said that this was the first time I felt like I was unwelcome in the iOS programming community.

Like many things on the internet, this is a long and complicated story and it was not really conducive to the short format and tempers of Twitter, so I will try to do my best to explain myself here.

At the moment I am between jobs and I am trying to figure out how to proceed. I am trying to see if I can make it as a contractor but I have also been looking into obtaining regular work as well.

I posted a blog post a few weeks ago about an experience I had interviewing at a rather large and well known company that had a white board interview where I was being asked to implement a linked list in Java.

I expressed that I felt this was a useless task.

I got a lot of pushback from people on Twitter about this. A lot of older programmers chastised me that you can’t be a great programmer if you don’t understand data structures and algorithms. I tried to make the point that if you are an iOS developer that most of your job is to have knowledge of the iOS frameworks and that the language is secondary. Someone who had never owned a Mac or opened Xcode could theoretically get a job as an iOS developer.

I continued to get pushback about the absolute importance of algorithms and how someone implemented a linked list once in their career. I asked whether it was more important to be able to answer a question about something you might do once in ten years or about something you would use every single day. I don’t think I got a response to that.

I did a phone screen where I was once again told that the tech aspect of the screen involved doing an algorithm test. I expressed frustration on Facebook about once again being asked to do an algorithm test for an iOS position.

One person on there told me if I spent all the time I used complaining about algorithms to actually learning them I would know them by now. He also criticized me for not being willing to implement well known algorithms and structures that are simply not part of the Swift Standard Library. This hurt my feelings because this was a person I considered a friend.

Another person made the comment that really prompted my series of tweets last night. He said that he asked algorithm questions because he wanted to make sure he worked with the “right” people who has the “right” skills and could talk “his” language.

I know that to most of you listening out there, you probably hear that and don’t give it a second thought. Let me decode this for you.

Algorithm questions are not a way to make sure you’re hiring someone who is capable of coding. Algorithm questions are a way to discriminate against certain kinds of people.

I know, you think I am paranoid. You think this is some kind of conspiracy theory or that I am somehow claiming sexism because I am a bad programmer or I am too lazy to learn these things. Please hear me out.

My first experience learning programming was from Code Cademy online. I accepted a terrible job that my ex-husband would not let me quit where our team lead did not know what we were supposed to be doing, so he told everyone to pretend to work and to look busy.

To keep the suicidal thoughts at bay, I went on Code Cademy to learn programming. I had taken some programming classes, but had only coded things once and subsequently never practiced it enough to understand it.

I discovered that if I wrote code forty hours a week that I could learn programming. I could type code as easily as I type an email and the logic finally made sense. This was a revelation to me. I had given up on programming because I thought it was too hard and I could never learn it. I found that if I put in enough time and effort I could learn how to code.

I got myself fired from that job and went on unemployment. In the state of Wisconsin, if you’re on unemployment you can stay on it as long as you’re going to school to learn a trade. I re-enrolled at the local tech college and started taking iOS classes to learn iPhone programming.

A lot of people learn programming from sites like Ray Wenderlich or from the Big Nerd Ranch books. Lots of people spend thousands of dollars going to code bootcamps.

President Obama has talked about how he wants all kids to know how to code. Apple has added Swift Playgrounds to the iPad to teach kids to code. We’re inundated with messages everywhere that learning programming will lead to a better life. We’ll get better jobs and earn more money and be able to start companies.

None of these paths to programming include algorithms or data structures.

I spent two years trying to scrape up enough iOS experience to be able to get an entry level job. It was brutal learning Objective-C. It was brutal learning about the Model View Controller design pattern. Asynchronous closures. Memory management.

iOS is not a simple framework to learn. There are a lot of moving parts and there is a tremendous barrier to entry to get to a point where you have accumulated enough experience of working with the frameworks and the devices and the compilers to be able to be somewhat proficient with iOS.

So why the fuck do we quiz people of fucking algorithms?

We do that to keep people like me out.

If you have a six week coding boot camp, you’re going to teach people the bare minimum that they need to make something useful. You’re not going to spend weeks talking about data structures and algorithms.

The only people who know about data structures and algorithms are people who got computer science degrees or have been around for so long that they learned it on their own.

This discriminatory practice is written off as a meritocracy. Anyone can learn this stuff if they’re ambitious and smart, so it’s the standard against which all people are held.

Let me tell you about another standard we don’t think about: The SATs.

We think of the SATs as being fair. Everyone receives the same test. Everyone has the same time limit. Everyone has the same equipment. It’s fair, right.


If you come from an upper middle class family, you probably had some help with the SATs. I went to a private Catholic high school that specialized in college prep. My parents bought me books that helped me figure out how to get better scores on the SATs. I had practice tests I could take with instructions about what the right answer was and why. It explained to me how to see a trick question and gave me strategies for getting around them.

Both of my parents had college degrees and were in education. It was expected that I would go to college. I didn’t have to have a job because my parents paid for my college, so all I had to do when I was in high school was study. When I didn’t like the score I got on the first test, I took it again. I could take the test as many times as I wanted and each time I took it my score got better because I got practice.

I can stand by my scores and talk about how I earned them through hard work and how the system is a meritocracy because I did marginally better than a few other people with the same privilege I had. But that’s not a complete story.

Take a student living in a poor community in Mississippi. This student might go to a school where they teach creationism instead of evolution. This student has no expectation of ever going to college. This student doesn’t know that there are resources out there to help them do better on the test. They don’t know about the trick questions. Their school doesn’t offer algebra because no one would take it anyway.

Does the test honestly reflect this person’s potential?

This theoretical person could be a genius. But they don’t have the cultural context to know what they are supposed to do in order to move from the sphere they are now to the better one brought by money and education.

I know so many of my classmates from my school who have trouble finding jobs. There are so many road blocks that are set up to keep the wrong people out. You have to have a GitHub repository and a Stack Overflow account with a certain amount of points. You have to contribute to open source. You have to present at meet ups.

We create so many barriers to entry for people who are culturally unfamiliar with what the community expects and we set these up to keep people out. We like to feel like we’ve earned our place in the community and we don’t want to deal with helping more people enter that we have to compete with.

Knowing algorithms and data structures means that you were privileged enough to get a computer science degree. It means you had enough free time that you learned this stuff on your own if you’re self taught. This assumes you have the money to take time off to learn something that will help you get better jobs.

If you’re struggling to make ends meet because you’re a single parent who can’t get past the velvet ropes to the land of coding opportunity, you do not have time to learn these things. You are told you’re not welcome and you give up.

None of this would bother me so much were it not for how completely useless this exercise is. Yes, knowing data structures and algorithms makes you a better programmer at some point, but if you’re interviewing someone for a job doing iOS development, there are so many other things that are iOS specific that no one ever asks about because for the most part these places don’t know them. You’re getting interviewed by people who don’t know anything about what we do who for some reason are in charge of determining whether you understand things or not. It’s bullshit.

The people who have the privilege to get through this red tape just kind of shrug and accept it’s a necessary evil. Some of them even embrace it and will fight with you tooth and nail about why it’s important for someone to know something they haven’t used in five years.

Yes, I could go and learn algorithms and data structures. I am holding my nose and accepting that this is probably something I must do in order to get better jobs, but that doesn’t mean that I should endorse them because I have the privilege of being able to take a few months off of work to learn something that’s nearly completely useless.

By filtering out anyone who comes from a non-traditional background, we’re ensuring a monoculture in programming. We want diversity, but only if the people we bring in think the same way we do. That’s not true diversity.

We need people who never went to college. We need people who learned by hacking and being tenacious and getting something working. We need people who come from diverse backgrounds who can bring new perspectives to what we do so that we can use technology to make people’s lives better and not just find more invasive ways to gather user data for targeted marketing.

Over the last year I have not felt that this community values those voices anymore. I went into iOS over web and Java because I felt that this community was welcoming to anyone with a curious mind and drive to do better and based on the responses I am getting from people I don’t feel that way anymore. I want there to be opportunity out there for people who are like I was four years ago. In order for that to happen, we need to change how we do our hiring practices or we’re all going to be poorer for it.

Thank you.

Game Development Journal 3: Learning to Embrace Higher Level Abstractions

For the last few months I have been working on a project that required me to write a simple game and apply Gameplay Kit AI to the project. I chose a simple tic tac toe game because it’s simple. It’s tic tac toe. Three year olds play this game. It should be easy to implement, right?


I have been bashing my head against this stupid game for months because I was trying to figure out how to do it in Sprite Kit. (To be fair, I have also been rather burned out and little things have been incredibly difficult for me to deal with. Please do not judge me.)

Sprite Kit is good for a lot of things. It’s good if you are doing a platformer game like Super Mario Brothers or if you’re creating an endless runner. Sprite Kit is not as good at doing things like tic tac toe or card/board games. I was looking through my books and tutorials to try to figure out how to tell the app that a square area of the screen represented a specific square of a tic tac toe board. Most materials are glorified rewritten documentation or they focus on the easiest examples they can possibly figure out, which includes spawning enemies and having sprites removed from the screen when they collide with onel

This was driving me batty. I knew there had to be a way to do this, but I felt like I was fighting the framework because the framework wasn’t designed to do what I needed it to do.

This problem was completely roadblocking me. I couldn’t think about how to write the programming logic until I figured this out. I knew I should worry about the UI after I got the logic finished, but this thing was completely blocking my ability to conceptualize how to approach this problem. I was incredibly upset because I knew there should be an easy way to do this but I couldn’t find it in any Sprite Kit examples I was seeing.

My mental block finally crumbled a few days ago when I realized I should not be using Sprite Kit for this project. I should use UIKit. Instead of trying to figure out how to programmatically tell the app that a square area on the screen represents a square on a tic tac toe board, I should just create nine buttons.

In Paul Hudson’s Hacking with Swift book, he recreates the Four in a Row Gameplay Kit example with Swift. I looked at the Apple example and found it incomprehensible, so I was incredibly happy to find he walked through how to implement and design that example more clearly.

One thing he did in that example was he did his entire user interface in UIKit with stack views. One thing he showed that I didn’t know you could do was to create a tag for each button in the stack view and connect all of the buttons to the same outlet and action.

I have my name on books. I speak at conferences. I have worked for some fairly prestigious places. For the last year or so I have let my pride get in the way of me doing things I need to do to be a better developer.

I do not have a lot of experience. I was at Indie DevStock this weekend and I heard most of the other indie developers I look up to had 15-20 years of programming experience. I have three. I think I am a pretty good programmer for only having three years of experience, but I know that I could be a lot better than I am right now.

I have tried to find a normal job so that I can pay my dues and learn from people with more experience than I do, but with one exception, that has not happened. I encounter other people who are like me. We feel like we need to pretend like we know what we’re doing rather than acknowledge that we need to work on our fundamentals and that working on fundamentals honestly takes a lot of time. If you’re working at a company that expects you to work sixty hours a week and you have to spend all your time pretending like you know everything, you don’t have enough mental or emotional energy to go and learn stuff that you may have known at some point in the past but you don’t remember now.

Also, honestly, we feel intense amounts of pressure to convince everyone that we’re a programming ninja. No one can just be a good, solid developer. Everyone has to be a 10x engineer. Everyone has to be a ninja. We’re all competing with one another to prove that we’re hot shit and that attitude is actively stunting the growth of members of our engineering community.

When I first started out, no one knew who I was or anything about me. I knew I could not get a decent job if people didn’t know who I was. I went to a lot of effort to network and make connections. I wanted to attend a lot of conferences, but couldn’t afford to go. So I needed to find a job so that I could make enough money to attend conferences to find a job. That didn’t work. There was a work around, which was to be a speaker.

I didn’t want to be the dumb-ass pitching beginner talks to conferences on stuff I figured everyone already knew anyway. I decided to go big and started talking about GPU programming with Metal and GPUImage. I had some grasp of how these things worked, but I couldn’t think of anything I could do with them. I just wanted to know them.

I tried to learn these things without any real context for where they should be used. This is not a good way to learn something. It’s mentally exhausting and draining. You feel stupid and your mental state deteriorates. You feel like a failure but you can’t give up because you want to prove that you deserve to be around everyone else.

I recently had a conversation with Warren Moore where I told him I wanted to learn Metal better but I couldn’t think of a project to do in Metal that I couldn’t do in Scene Kit. He told me that was the point. They weren’t intending for everyone to jump into OpenGL or Metal. Scene Kit was designed to do almost everything you need to do and only once you exhaust what Scene Kit can do should you drop down to Metal.

I felt like this was the most obvious thing in the world and I have no idea why it took me two years and a few nervous breakdowns to finally figure that out.

I have been so obsessed with trying to convince everyone that I deserve to be here that I have been focusing on the wrong things. I make things more complicated than they have to be. I don’t look for the simplest solution. I jump into the most complicated thing I can so that I can find an excuse to learn something that may not be the right tool for what I want to do. I do that at the expense of getting comfortable and familiar with the easy solutions that allow me to get things done more quickly.

I have been on a path that leads me to places I don’t want to go. I want to be a great programmer. Knowing how to render a triangle to a screen in Metal does not make me a great programmer. It makes me a clever programmer. Writing clean code that anyone can read and understand at the highest abstraction level makes me a great programmer. Knowing the higher level abstractions well enough to know what they can and can’t do and when to drop to a lower abstraction makes me a great programmer.

Right now I am not a great programmer. I am a good programmer. I can do 90% of what most jobs need me to do, but I want to work towards being someone who is respected in the community for being able to solve problems.

I don’t want to keep seeking out really low levels of abstraction and create convoluted reasons regarding why I am using them when I could do things much easier in another way. That’s just stupid and I am not doing it any more. That path leads to mental ruin and despair.

Game Development Journal 2: Getting Stuck in Boxes

This post isn’t specifically about the project I outlined in the first post, but it is a persistent problem I keep running into, even though I know the problem is there.

I am working on a tutorial for Ray Wenderlich and I have been running into issues with it.

My issue is that I have program-specific logic. I am creating a very simple game, but one thing I didn’t think about was the fact that you have to explain every little thing to the application. There are so many connections your brain makes automagically that a computer doesn’t know. You have to figure out how to tell the app how to think. This is the underlying issue in machine learning, but on a much larger and complex scale.

One reason I wanted to do a game application over a more useful type of application is because of application specific programming logic.

One thing I find frustrating, that is actually a feature of iOS, is how many frameworks there are. Sometimes I feel like when I am writing an app that you are choosing a framework, reading the documentation, and then just setting a few properties on that framework to make your app do something. So like, if you are doing something in SpriteKit, you’re choosing the image for the sprite, then you choose where it’s boundaries are, and you set a bunch of properties on the SKSpriteNode.

I have found that I get into a mindset where I feel like the only tools I have in my toolbox are ones that are pre-baked by someone else. If there is’t a framework for it or a property for it, it doesn’t occur to me that it can be done. The app is basically a giant state machine where your Swift/Objective-C code is just some glue holding together a bunch of pre-baked parts.

Whenever I am presented with a problem that requires a lot of program specific logic, my brain freezes up. It gets used to the idea that I just go pull a piece of code out of a box and it does what I want it to do. When I have to actually engage my brain in figuring out what my application has to do it’s like exercising a muscle I forgot existed. It’s incredibly weird.

I know that all of programming is supposed to be about figuring out what you want the application to do, but most of us don’t think that way. There are so many fucking blog posts by people trying to come with convoluted reasons to create hieroglyphic looking Swift closures that you need a Rosetta Stone to interpret. Most blog posts and tutorials are around talking about the components of a framework and not what you can do with it. Every game development book I see talks about how to use the tools of something like SpriteKit or Unity, but not how to think through how you would solve a problem.

The thing that prompted my last blog post was my expressing frustration that programming books talk about tools but not how to use tools to solve problems. I got a bunch of sanctimonious assholes telling me that if I read a book on algorithms it would somehow magically solve all my problems and telling me that if I read a half dozen different books that somehow I could cobble together all of the stuff I need to do what I want.

I think there is a better way.

I feel very frustrated that we, as a community, don’t talk more about how to think through how to solve a problem. Yes, there are multiple ways of solving a problem. So why not talk about it? Talk about how you tried a few different ways and you ultimately chose one specific way because it was the shortest or the most maintainable or the most reusable, etc…

We don’t do this because it’s hard.

It’s a lot easier to write a blog post saying you did something simple with SpriteKit that looks super impressive but doesn’t give anyone a visceral understanding of what they can do with it.

One reason I am running into problems learning Metal is because I don’t know what I am supposed to do with it. Almost anything I need to do in Metal can be done with something like SceneKit. I keep trying to learn the framework with no context as to why it’s important and what problems it solves. I get people hassling me by telling me it’s up to me to figure out why it’s important and that’s bullshit.

Programming isn’t an objective thing where every single app is a special snowflake. They all require us to think through why we’re doing what we are doing. I have fallen into a pit the last year where I have just automated that process in my brain where if I encounter a situation that doesn’t fit into a neat box my brain can’t deal with it. That’s fine for most of what most employers need, but I don’t want to be like this anymore.

I miss thinking about how to solve problems. I miss working on a portion of a project where I actually get to touch things and see how they connect rather than being told to pay no attention to the man behind the curtain because the code base is so fucking massive and poorly documented that no one knows how it works.

I am trying to shake away my mental cobwebs and remember that programming doesn’t have to be an automated process or something where you get into a pissing match with other people to make the most convoluted code you possibly can without breaking the compiler.

One of the goals with this series of blog posts is to explain a problem I am trying to solve and walk people through my thought processes in the hope that we, as a community, put more effort into talking about how we approach problems rather than seeing who can be the first person to get something running on the Apple Car, whenever it comes out.

How Not to Hire an iOS Developer

So my current contract ends on Friday. I have spent the last year bumping around figuring out what I don’t want to do and I now have to figure out what I do want to do.

As of this moment I would really like to make a real go of setting off on my own as a contractor and eventually producing my own products, but I know enough people who have not succeeded in doing this to be wary about my chances of success. Recently my father got drunk and trapped me in a car for an hour telling me to stop trying to be special and to attempt to find a real job with a 401k and health insurance.

So, in the interest of figuring out what I want to do with my life, I applied for a corporate job. I figured that it was stable and they pay regularly, so it might not be as bad as I had been lead to believe.

I had a phone screen with someone from a company today and I would like to share my experience with this.

The first part of the interview was awkward, but manageable. The guy asked me about some other projects I worked on. He asked me about a time that I didn’t agree with a manager and how that turned out. I probably should have come up with a different example than one where I got into a blowup fight and was fired, but it’s too late to fix that now.

At no point in this process was I asked anything specific about iOS. He did not ask me about my books or any of the other credentials I have on my resume. I realized that he did not look at it. Awesome.

Then we got to the part of the screen that I didn’t realize we were going to do: The Whiteboard Interview.

I have never done a whiteboard interview in my life. Never. I think they are bullshit and I decided a while ago that I would never participate in one. If you’re reading this and thinking of hiring me, I am not doing a white board interview. Be forewarned!

I had deep reservations about doing this. I know I know how to code, but code isn’t something you just regurgitate on command. It requires context and problems that need solutions. I decided before the interview even began that I did not want this job because it required me to move, but I thought I should at least attempt to get through the interview. I was beginning to deeply regret this decision.

We used a software application to do the white boarding. There was a drop down list of languages. I went to select Swift, but there was no Swift. Strangely, there was no Objective-C either.

Huh. You’re interviewing me for a job without being able to let me write in either of the languages you need me to be an expert in. Interesting.

I looked through the list and tried to find the next one I was most familiar with. After some deliberating, I chose C over Python.

“Don’t choose C.”

The interviewer did not want me to choose C. I asked why not.

“I’m an Android guy and I would really prefer that you pick Java because that’s the only language I know.”

You’re interviewing me for an iOS position and you only know Java. You won’t let me write in the language I am comfortable with because you don’t know how it works. Splendid.

He told me to write a linked list. I told him I didn’t know what a linked list was. I said I never got a computer science degree and that I was a hacker who learned programming by writing applications rather than learning algorithms and data structures you only use to pass code interviews at corporate entities that you forget and never use again.

At this point the interviewer was like, “Oh, so you’re not a programmer. You’re more of a management type.”

I have written books. I have presented technical talks at conferences. I have held down a programming job, more or less, for the last two years. I spent the first half of this interview explaining hardware software integration and architecture to this guy, who still at this point decided to tell me I am not a programmer.

At this point I had had it. I ended the interview as best I could. I told him I was not interested in the job and I got off the phone and had a good laugh.

I am writing about this on my blog because apparently these places don’t read my blog anyway, so it really doesn’t matter.

If you’re going to hire an iOS developer, let them write in their own language. Also, the power of iOS isn’t in the language, it’s in the frameworks. Don’t make someone write a fucking linked list in Java to see if they know how to write an iOS application. Ask them what frameworks they’ve used and how they find information and have them talk you through how something works.

This call annoyed me, but it also made me feel a lot better. As bad as I feel about not being as good a programmer as some of the other people in my circle, at least I am not a Java guy interviewing iOS people for a large company that clearly doesn’t know what it’s doing. I’m sure they’ll find someone who memorized “Cracking the Code Interview” to fake their way through the interview and panic on the job when they realize they don’t know what they’re doing. Hopefully they’ll buy my book.IDontKnowWhatImDoing

Learning From the Masters

Recently I joined Sector67, a hacker space in Madison. I have written on here about all of the various things I am interested in doing (robotics, electronics, etc…).

Every time I talk about wanting to learn a new skill, I keep hearing people tell me not to do tutorials but to choose a project and use it as a learning experience. I have written on here before about this, but there was some aspect of this argument that has always bothered me. I didn’t grasp it until I heard it from the organizer of the hacker space.

He told me that buying electronics kits were a waste of time because at the end of the kit you only knew how to construct the kit and nothing more.

That is the crux of the argument.

I feel that people have a fundamental misunderstanding about the learning process. People are under the impression that we are all computers, we can only do what we’re programmed to do. He and others are under the impression that doing a kit or a tutorial teaches you only what the purpose of the tutorial is and you get nothing beyond that.

I don’t feel that is true for me. It may or may not be true for others, but I don’t feel that is the case for me.

One thing that art students do is to recreate the works of the masters. It gives them a perspective of what was in the artist’s mind when they created great works of art. It may feel like you’re not being creative or implementing anything on your own, but getting a perspective on what has already been done and being exposed to various styles helps temper your own talents and perspectives. After you build up a base of skills and experiences you have much better tools to implement your own artistic vision.

You don’t start out making a great piece of art. You don’t start out writing an amazing app. You don’t start out building a nuclear reactor.

I get that a lot of people don’t do well with a formalized learning process. I certainly didn’t. They have memories of sitting through boring lectures about data structures without having any context about how that leads to writing efficient applications. I don’t think that is a fault of the formalized learning process, I think that is a fault of how that particular formalized learning process was applied.

I was speaking yesterday to a kid who wants to be a gaming tester who said that school bores him and he can only learn when he is actively engaged. We all learn better when actively engaged.

I don’t think there needs be a separation of formalized learning process and hacking. I think the two should work together.

I think the MAKE series of books and Ray Wenderlich’s tutorial series are great examples of formalized learning structures that are also interactive and incorporate the hacker mentality of doing useful things and seeing how they work.

When I do tutorials for iOS programming, it fleshes out my understanding of how the applications work. I see and absorb programming style. I also got a lot out of actually taking programming classes. My teacher Eric Knapp went over with us how to detect code smell. He had us write applications that repeated code and were structured badly and showed us how to write good, maintainable applications. I have met people with ten years of experience who don’t understand how to do this because they never had any formalized learning structure.

Having a lot of experience doesn’t necessarily correlate to being good at what you do. Thinking critically about how to approach a problem is necessary as well. Sometimes you can get a jump start on this by learning from other people’s mistakes. It’s important to make your own mistakes as well, but there is a place for building contrived projects that teach you how things work. You learn several building blocks and you infer that if A is true and B is true then C is true as well.

Every programmer starts out writing “Hello world!” You don’t jump from writing “Hello world” to writing a neural network. You have a lot of intermediary steps. You have to spend a lot of time figuring out what problems have already been solved so we can build upon the experience of others rather than reinventing the wheel over and over again.

How Random is arc4random_uniform?

I remember when I was in college and iTunes became a thing. One of the aspects of iTunes that I liked was their feature where you could randomize a playlist.

After using it for a while, I noticed it didn’t seem to quite work. I would make a playlist with ten songs by one artist and two songs by another and every time I would randomize the playlist the two songs by one artist would always play one after another.

A lot of people complained about it. There were articles on the Internet about how random does not mean that the algorithm will always separate those two songs. If you shuffle a deck of cards there will periodically be sets of cards that settle into order. In later versions of iTunes there were options to make thing more or less random, which didn’t make a whole lot of sense to me.

To this day, I am still bothered by what seems to not be truly random modes of behavior. I play a few German-style board game apps on my iPhone and I notice that the dice rolls never seem to feel natural. In Settlers of Catan you roll two dice. Statistically, the dice should amount to seven as the most common dice combination, followed by six and eight. Whenever I play this game, I will have three or four rolls in a row where the dice total is three, which is statistically improbable. If this happened just once, it would be weird because stuff like that can happen in real life, but it happens every game.

I don't want him touching me!

I don’t want him touching me!

Random isn’t random. Humans are bad at making truly random patterns. In the pilot episode of Numb3rs, Charlie demonstrates this by having everyone create a “random” distribution of themselves in the room, which isn’t truly random because everyone is trying to maintain a certain distance from one another. (That scene is about 18 minutes into the episode, if you don’t want to watch the whole thing.) If it were a truly random distribution there would be clumps of people. Cornell has a page summarizing this if you’d rather read than watch.

Humans also mistake things that look random for not actually being random. Synchronicity is the practice of looking for patterns in randomness because it’s the believe that some things are so coincidental that they could not possibly be con incidents but the presence of a higher power. This is the basis for divination methods such as the Tarot and the iChing. There are books about this phenomenon.

So if humans are bad at creating random sequences and see meaning in random patterns, then computers should be awesome at it, right? Well…

RC4 and ARC4

There are a lot of reasons that a computer programmer would need randomly generated values. Most games depend on having a lot of randomly generated values. You can’t play Solitaire without a “shuffled” deck. Having enemies randomly spawn, rolling dice, and a lot of other things depend on random values to work.

Even more importantly, randomly generated values are vital for cryptography and security. It is this purpose that spawned our most used random generation algorithms.

Arc4Random is the most common command used to generate random numbers. A simple way to generate a random dice roll in Swift is:

let diceRoll = Int(arc4random_uniform(6) + 1)

So what is arc4Random and where did it come from?

In 1987 a man named Ron Rivest created the Rivest Cypher 4 (RC4) algorithm. He did this while working for RSA and thus they owned the algorithm.

RC4 is a stream cipher, allowing for varying lengths of bits to be encrypted. It remained secret and secure until 1994, when it was reverse engineered and the cypher was cracked. RC4 was a registered trademark owned by RSA, so this new, public algorithm was named ARC4.

Since this cypher has been cracked, it’s a really bad idea to use this to encrypt your programs. But it still works for creating randomly generated content, so it is now commonly used in things like game programing when you need randomly generated content.

How Computers “Generate” Randomness

There are two flavors of random number generation in computing: Pseudo-Random Number Generators (PRNG) and True Random Number Generators (TRNG).

RC4 is a PRNG, which means that arc4random is also a PRNG.

PRNGs work by generating a table of values from a seed. These values are supposed to mimic what you would get if you had true randomness. If you took an intern and had them roll a die a hundred times and record the result they got (for experience, of course) and made it into a table, you would have a PRNG.

So if you start out with the same seed, you’ll get the same results over and over again. In order to get different results, you need to use another seed.

For most of what you need to do with random number generation, this is good enough. If you just want to have a game on your iPhone where you need to randomly generate bad guys, this is just fine. It’s not fine if you’re trying to encrypt credit card or personal health information.

Random Number Playground

I wanted to test out how random arc4Random is because I feel like there are number that get repeated all the time constantly and it’s not really an even distribution.

I create a playground that you can access here. I am planning to add additional functionality to this over time, but it’s pretty bare bones at the moment.

I decided to run this die roll function twenty times. With six values, there should be about three rolls per number. Didn’t quite get that:

  • Number of 1: 7
  • Number of 2: 2
  • Number of 3: 1
  • Number of 4: 4
  • Number of 5: 2
  • Number of 6: 4

Yikes! This seems to buy into my Settlers of Catan theory that the game is set to screw me over by generating an excessive number of ones.

However, as anyone who does polling and clinical trials can tell you, twenty is not a large enough number to be statistically accurate.

So what happens if you run this a lot? Like a lot a lot? What if you ran this 2000 times? I got these results:

  • Number of 1: 348
  • Number of 2: 304
  • Number of 3: 327
  • Number of 4: 329
  • Number of 5: 347
  • Number of 6: 345

As you can see, if this gets run a lot, then the numbers even out significantly. The number of ones, fives, and sixes only deviates by three.


There is a difference between snapshots of things at certain points in time and long term patterns of behavior. If you look at something like the stock market, stock prices can deviate wildly over the course of an hour, but if you look at long term trends, then they tend to even out.

It’s rather frustrating to play a game expecting the dice rolls to behave statistically. However, if everything in life behaved exactly as you expected it to, it wouldn’t really be random, would it?

Additional Links

Beware of Publishers Bearing “Free” Gifts

I buy a lot of programming books. Like, a lot a lot. If you’re a publisher and producing any books on OpenGl, VR, robotics, etc… I am probably giving you money.

One place that I buy a lot of programming books is Packt Publishing. They were one of the first publishers to have books out on the Unreal 4 engine. They have a lot of graphics and game programming books and their prices are fairly reasonable.

Back in May they had a deal on a set of five books on game development. Two were books I was planning to buy anyway for the price of the other five, so I bought the set of books. I noticed at the end of my invoice that they gave me a 10-day free trial of their online library of books.

One of these things is not like the other...

One of these things is not like the other…

I am already a Safari Books Online subscriber and have access to the Packt library, so I just ignored this add on to my purchase.

(Yes, I do go out and buy books I am paying to have access to through Safari. I know I could save a lot of money by not buying a bunch of programming books I probably won’t read, especially when I am paying to have access to them. Don’t judge me.)

A week later I got an email from Packt telling me my trial was almost over and they hoped I was enjoying their books. I was kind of miffed. I never initialized the trial. I have gotten free trial offers for Safari that I have never been able to use because I wasn’t a new member, but they always had a code that you needed to use in order to start the trial. I didn’t know that the trial would start automatically.

I had somewhat forgotten about this until I got an email yesterday telling me that Packt had charged me $12.99. I went to check on what the charge was for and guess what? It was for a monthly subscription to their online library.

So, they signed me up for a service I didn’t want, gave it to me without my permission, and because I was unaware that they were doing this they started charging me for something I never authorized.

I was incredibly annoyed. I feel this is a really sleazy way to do business. I cancelled the subscription immediately and wrote an email to complain. Here is the response I got:

They basically tell me that if I don’t want their subscription I have to cancel it. I grok that. Already done it.

There is no acknowledgement that what they did was underhanded or sneaky. Their response basically treats me like I am an idiot who didn’t know what I was doing.

I know that most services like Amazon and Apple Music and whatever offer you a free trial period after which your credit card gets charged. They hope that you forget that you signed up for a free trial period and they can charge you because you forgot to cancel when the trial was over. That’s kind of sneaky, but it’s still something where you are choosing to opt in. You are saying “I want this and I agree to pay money for this if I forget to cancel my subscription.” I have avoided free trials of things for this very reason.

It is not okay to “sell” someone something they didn’t choose and then charge them for something they didn’t opt into.

There is a bit of shady behavior on this site. They recently released a $50 OpenGL book that is so out of date that it does not mention shaders, which have been around since 2004. People have complained and gotten a “We’re sorry, we’ll pass your criticism on to the author.” This book is still available and does nothing to warn the reader about how out of date it is. Good publishers like the Pragmatic Programmers remove out of date books all the time.

Their royalty structure also leaves much to be desired. The 16% royalty is not necessarily bad, but considering how many times a year they sell every book on their site for $5, I find it incomprehensible that anyone working on a book ever outearns their advance.

It’s really too bad. They have a lot of books on rather obscure and esoteric topics that most people don’t cover. They have one of the few books on the OpenGL Shading Language on the market. As far as I know they are the only publisher producing any books on LLVM. I would like to think there are better ways of producing a broad range of interesting content without screwing over both the authors and the customers.