Author Archives: admin

You Can’t Fix Other People

I started working on programming contracts three years ago. I started my first contract all bright eyed and bushy tailed. I was eager to prove myself and get things done and show myself to be a 10x programming ninja.

That didn’t happen. At least not right away. Things were really disorganized. There were broad ideas about things people knew they wanted to fix, but no real strategy about how to fix them. Depending on what day you were talking to the client, you would get different answers about what something should do or look like. It changed constantly. It was impossible to sit down and complete a task because it was likely the client would change their mind and it would need to be changed or scrapped altogether. On another contract I worked on the entire concept of the app changed three times over the course of five months.

I had a more senior developer I was working under that gave me some really valuable advice. I expressed my frustration at not being able to get anything done and my worry about being fired. I asked why someone would hire a contractor to work on a project if they didn’t know what they wanted to get done. He told me that is exactly why people hire contractors. They hire them when they are at a loss as to what they want to get done. They think the contractor will be some magic bullet who will somehow read their minds to figure out all the things that need to get done for the client so they can break through the mental berries they have preventing them from doing things.

I have talked a bit about my mental health issues. All of my mental health issues stem from this phenomenon. Inactivity is corrosive to my mental health. I have had several jobs/contracts/projects I have been brought onto where people didn’t know what they needed to get done. Sometimes I have dealt with the client directly, other times I have had managers “shielding” me from the client. Once I had an abusive manager who would bully the team into not talking to anyone else at the company because he was lying through his teeth about everything we were doing and he didn’t want to be found out.

It all starts the same way. I come onto a project enthused to get to work. Either from the beginning or after the initial rush to get things done disorganization sets in. People get behind. People stop communicating. People start second guessing themselves and changing their minds. I start to panic. I don’t want to be fired. I want to do my job. I can’t do my job. I am being paid to sit around all day doing nothing. No one is going to keep paying me to sit around all day doing nothing. I need to find something I can do to contribute. But I can’t. I don’t know what people want. I start to shut down. I can’t keep motivating myself. I feel trapped. I start crying for no reason. I can’t go into my office anymore because it triggers flashbacks.

Last year I had the worst nervous collapse I have had in years because of this situation. I had a period of months where I couldn’t do any work at all. I had to paint and remodel my office before I could work in there again.

One thing I have learned from these experiences is that it’s important to take care of myself. I need to make sure I don’t melt down.

I now have a queue of work I can give myself. I am working on a book. I have a few side projects I want to accomplish. If the client doesn’t have anything for me to do, instead of sitting in front of my work computer slowly burning myself out, I do something else. I don’t bill the client for that work, but I make sure that I take care of myself. If the client can’t figure out what they want, they’re going to fire me no matter what I do. I can’t force them to do anything. I hope when I have even more experience I will be better at getting the client to listen to my advice, but right now any attempts I make in that direction cause resentment and anger at me, so I avoid it like the plague.

It’s hard to make yourself work on other things or step away from the computer. It’s like being in school. You feel obligated to sit through the boring grammar lecture because you’re supposed to be there. Your mind wanders and you fight with people on Twitter because you don’t feel like you can get up and take a walk or read a book on something else or do anything else that will preserve your sanity.

Some of these situations remind me somewhat of my relationship with my ex. My ex kept thinking that stuff would fix him. He thought if he got married that having a wife would magically make all of his problems disappear. He used to yell at me for not fixing him. He thought if he was earning a lot of money it would solve all his problems, but he was always angry and resentful that other people were earning more. He thought if he could be his own boss, he would be happy, but he realized how hard he had to work for a lot less than he was getting and soured on that as well.

You can’t fix other people.

If you have enough experience in dealing with people plagued by indecision, you can start to help them organize their thoughts, but only if they let you. You can’t by force of will make someone happy if they don’t know what they need and they can’t tell you. All you can do is take care of yourself so that when you eventually move on (which you will because these jobs are always terrible) you’re able to help the next person you work with who will hopefully have a better understanding of what they want than this person does.

My Spring 2017 Conference Appearances

It’s a new year, which means I am in the process of seeing if I can break my conference record this year. Not sure what that record is, but I think it’s around ten conferences in a year. Last year was pretty busy and it will be tough to beat, but it was also something of a furlough year because I was mostly talking about mental health and software architecture. This year I am going full on Metal for the work I am doing on the Metal Programming Guide.

Everything is coming up Milhouse!

GDC: February 27-March 3

This year I am working at/attending GDC(Game Developers Conference). I get to be a Conference Associate, so while I am not speaking at the conference, I still get to help participate in creating a great conference experience for everyone. I am looking forward to meeting some new people in the graphics programming space. I think it’s important to keep meeting new and different sets of people rather than staying in a bubble of people you already know. I’ve wanted to attend this conference for a while and I am super happy I got a chance to do so this year.

iOSCon 2017: March 30-31

I get to attend my first European conference this year, iOSCon 2017. Some old friends, like Saul Mora, are going to be speaking there, as well as some new friends I haven’t had the chance to meet in person yet, like Manuel Chakravarty.

I am incredibly excited about this conference because I am debuting a new Metal talk here. I have noticed over the last few years that a lot of people are interested in Metal, but they are not quite sure about how to approach it. They’re not able to break it down in the minds into manageable tasks and they wind up quitting in frustration. My talk here will focus on foundational structures and concepts that are necessary to work with Metal in a fun and approachable way.

CocoaConf Chicago: April 21-22

If you’re in the States and can’t afford a hop across the Pond, I will also be presenting my new Metal talk at CocoaConf Chicago. This will be my fifth time attending CocoaConf Chicago and my fourth time speaking! Holy smokes! Time flies when you’re frantically trying to meet deadlines.

CocoaConf Chicago was the first purely iOS conference I ever attended. The speakers and the Kleins gave me a community of people without whom I would not be where I am today. It’s always a great joy and pleasure to see all of my friends there that I only get to see once a year.

Please Say Hello

One thing I always look forward to when I go to conferences is meeting new people. It may not always come off this way, but I feel socially awkward. One reason I made friends with so many speakers in the Cocoa community was because it was easy for me to start a conversation with them because I knew something they were speaking about. When I go and sit at a table full of strangers, I don’t know anything to start a conversation with anyone. I am happy for people to come up and start talking to me and I am telling you to please take that first step, because if you don’t I assume that I am probably annoying you and to avoid embarrassment I keep to myself.

I am planning to have my service dog Delia with me at CocoaConf and GDC. She is an emotional support animal and it is okay for people to pet her. It was technically possible for me to bring her with me to London, but with all of the various travel SNAFUs and the unstable political situations, I don’t feel safe or comfortable bringing her with me. I am terrified that I will forget to do something important and she will be taken away from me and I won’t get her back. So might be a little emotionally fragile in London, but I will follow the old British saying of “Keep Calm and Carry On.”

Looking forward to a great Spring 2017 conference season!

Quality over Quantity

Back in December I was approached about contributing to the Pragmatic Magazine. I was told the theme of the issue was Swift and I was asked if I had any good Swift posts that I would be willing to share.

I had a number of Swift posts that I was very proud of and I sent the links to the editor. Then I had a sinking realization that these posts were all from 2015.

Last year was a difficult year. I made a lot of mistakes and had a number of mental health issues. On paper my year seemed like it was incredibly successful, but I felt at the end of 2016 that I had not grown as I would have liked and I was not in a place I wanted to be.

One of my resolutions toward the end of last year was to have more technical content on my blog. I am in the process of writing a book. I intended to have companion blog posts where I share a number of things that I learned while I was writing the book. I have one post that has been partially written since November. It’s nowhere close to being done.

I keep wondering what’s the matter with me. I would like to produce more technical content. I keep meaning to, but things keep coming up. I know if I don’t make time to produce technical materials for blog posts or conference talks or to post on GitHub that I will be left behind. People always want examples of your work and you can’t keep pointing to work you did three years ago.

This morning I found a link to this article. The author talks about a lot of strategies about how to have a long and successful career in tech. This article helped to crystalize in my mind about why I am not producing more technical content.

Those blog posts that I submitted to the magazine were based on problems that took me months to solve. Each one of those posts and every project that I have written about that I am proud of all started the same way. I took something that was hopelessly unfamiliar and tried to force myself to learn it. These were all projects I did for Brad Larson when we were rewriting our code base in Swift.

One of these projects was wrapping libxml2 in Swift. The sample code was all written in Pascal. There was only one post written by anyone for this topic for the iPhone. That person was Jeff LaMarche. I was going to link to his blog post about it in this blog post, but it’s been taken down. So I had an incredibly undocumented technology that no one was using that it was my job to figure out.

I had about a week of complete and total panic and despair. I felt that I had been hired by mistake and that Brad would find out I was an inexperienced idiot and I would be fired in disgrace and I would never work again. I wondered about how hard it would be to find a nice easy call center job where I could cross stitch while talking on the phone all day answering the same questions over and over again. I thought this was hopeless, but it was my job to figure it out, so I had to try.

I spent a lot of time walking. I couldn’t look at my computer without getting a complete headache. I spent some time building robots. I would look at the docs periodically, but not for too long because doing so would cause a migraine.

After several weeks of doing this, suddenly things started to become clear. Instead of looking at a bunch of gibberish and having no idea about how to approach it, I finally had questions. I wondered what this one thing did. I wondered what the difference was between one object and another. I started to understand how to approach the problem.

I completed my task by learning all of this stuff over the course of about two months and I wrote my post. I was incredibly proud of the work that I did on that project and for finally figuring out how to solve it.

I never would have done that project if I wasn’t working for Brad.

First off, I never would have known what libxml2 even was. I would have just used the built in Cocoa framework and fought with it, but found plenty of sample code that I could copy and paste and go about my merry way. More importantly, if I had been doing this for myself, I would have taken one look at the lack of support, said fuck this, and done something else.

Forcing myself to confront something that seemed impossible and pushed me close to my breaking point mentally and emotionally. I have a faulty, tin-plated emotional system. If I get pushed too far I can’t function or learn. My brain shuts down. I had to confront my panic and my fear and force myself to approach this logically. At the beginning of Dune the main character has to take a Human Test. He is forced to put his hand in a box of pain and not remove it. Having mental health issues is like taking a Human Test. You have to think your way through your emotional issues and find some way of logically dealing with them so you don’t remove your hand and get scratched by the Gom Jabbar.

By being placed in a position where I could not simply give up, I was able to push through the initial phase of not knowing what the fuck I was doing to be able to see that there was an end to the Desert of Despair. I understand now that a lot of things I want to learn that seem difficult or impossible are not. I have been trying to teach myself Metal and 3D graphics math for the last two years. I know that even though the symbols seem incomprehensible and there are not a lot of approachable resources out there, I can bash my head against it enough to figure out a starting point. I can look at those symbols long enough over a long enough period of time that I can grasp some kernel of what I don’t understand that I can figure out.

I feel like our community doesn’t reward people for solving hard problems.

It pisses me off every year when Tim Cook announces some amazing new thing at WWDC and some jack ass in the audience gets some version of “Hello World!” working on it because everyone wants to be first. Everyone tries to cherry pick some easy problem that they can solve and post about so that they can show they’re keeping up with the Lattners. I have seen so much pressure in this community to pretend like you know everything. Companies place a lot of emphasis on what do you “know” not “how do you learn.” I admit that it’s a lot easier to test knowledge as opposed to problem solving and learning. I know that we’ve generally used knowledge of data structures and sorting algorithms as a proxy for how we learn. But memorizing some tips and rules doesn’t prepare you for the complete and total helplessness you feel when you confront something you must figure out that you don’t know how to do. You either rise to the occasion or you flee and become a Scrum Master.

I am realizing that most of the things I find interesting are difficult. I am in the process of learning some things that are complicated and poorly explained. I am hoping that after I push through everything I will have a wealth of material to write about on this blog. But I have to accept that what I want to do is hard. There is going to be a lot of invisible work that I do that isn’t being seen. There will be a lot of time spent thinking and processing and waiting for things to click.

Dan Barber is a prominent farm-to-table chef focused on sustainable food production. He wrote an article a while ago that really stuck with me. The gist of his article is that farmers are stripping their soil by only growing the most high profit crops. The soil gets progressively poorer and the food grown on it grows more and more tasteless because it’s nutritionally vacant. He found a farmer who grew an heirloom variety of wheat for bread flour. He thought the reason the flour was so delicious was because it was some heirloom variety, but it was because the farmer rotated his crops. He grew some less lucrative crops on his land that enriched the soil and only grew this wheat on the soil every three years.

I think one reason we have such a high burnout rate in tech is that we’re approaching development like we do farming. We will keep stripping our mental soil because it’s more lucrative to do so than it is to have furlough periods where we push ourselves to achieve truly difficult things. Start ups want to churn and burn developers because they don’t care about a person’s long term viability as an asset. It’s our responsibility as developers to take control of our careers.

Right now I am taking some time off to write a book. Even if the book is wildly successful I won’t make nearly as much money off of it as I would if I had worked somewhere during that amount of time. But taking this time to learn these things that I have wanted to learn for so long has been an extraordinary experience. The process of taking something that seems impossible and being able to make some traction with it makes me feel like I can conquer the world and anything is possible. Compared to a year ago, where I felt like I had to pretend I knew everything and I worked myself into a nervous breakdown.

Last year was a furlough year. I needed it to recover from some bad professional decisions. This year is a soil enriching year. I have so many projects I want to do and write about, but they’re going to take some time to figure out.

I would like to write more about tech on this blog, but I have to accept that I want to learn some difficult things that take a lot of time to figure out. I am not going to have a new post here every week that I am proud of. But if I can get four difficult technical posts on here this year, that’s not so bad.

Land of Misfit Frameworks

Right now I am in the process of writing a book on Metal. Metal came out the same year as Swift. One thing that has caused a lot of frustration among people like myself who are interested in Metal is the fact that there is not a lot of material out there on the framework. It’s gotten much better. Ray Wenderlich has released a video series on Metal. Apple dedicated a whopping five videos to Metal in 2016. If you’ve been checking the docs between when Metal came out and now, they have increased dramatically in both quantity and quality. Metal has come a long way over the last year.

There are frameworks that Apple released in the last few years that make Metal dramatically more useful. It integrates well with SceneKit, which makes it far easier to work with 3D graphics. In 2015, Apple introduced the Model I/O framework to make it easier to import 3D models from programs like Blender and Maya. Before that, you had to parse all these files by hand like a savage.

I had a sample project I wanted to do today that I didn’t realize I needed to import a model for. Most of the things that I need to do with Metal are made infinitely easier by Model I/O and SceneKit. But I don’t see people clamoring for more books on SceneKit or tutorials on Model I/O. There is almost no information out there about it outside of the Apple documentation. There is one piece of sample code and only one video from 2015.

I am not picking at Apple for not having more documentation. They have a lot on their plate and they’re doing the best they can. I am simply confused as to why I don’t see more people complaining about the lack of information about Model I/O. I don’t know if the lack of adoption of Model I/O is clamping the adoption of Metal or if it goes the other way.

I feel like there is a lack of understanding about what is out there and what the most optimal way is to get things done as efficiently as possible.

I know that SceneKit never got the amount of attention that it may have deserved. Everyone I talk to that would use SceneKit don’t want to because it’s not available on Android. I feel like most people I interact with use Unity because it was the best thing available five years ago and it’s just the thing they’re most comfortable with.

Apple has a lot of misfit frameworks. Gameplay Kit. Model I/O. SceneKit. These all work together and support one another. I want to see more stuff out in the world about these frameworks.

I am hoping that I can incorporate learning these frameworks into my exploration of Metal. I think that knowing these tools and using them in my projects will make my experience with Metal far richer and more productive than it would have been otherwise. I know this runs the risk of being a rabbit hole I fall down that prevents me from focusing and getting projects done. However, I think if I don’t raise my awareness of these frameworks, I will be missing the forrest for the trees. I will wind up wasting a bunch of time reinventing the wheel or creating useless things that don’t accomplish what they are capable of.

I am trying to remember that these are large topics. These take time to learn and adopt. Rome wasn’t built in a day. It’s important to remember this is a large topic and to not get frustrated when I realize things are large.

Rules for Engagement on Twitter

Hi.

Today I blocked several people for the first time ever on Twitter. These are people I have known for a long period of time and one of whom I have met in person and know to not be a sociopath. Here is why.

I have Post Traumatic Stress Disorder. When I was in college a stranger held me hostage in my dorm room and raped and tortured me for two and a half hours. For those of you fortunate enough to not have PTSD, one of the delightful aspects of having it is dealing with flashbacks. Flashbacks happen when you are in a situation that is reminiscent in some way of the circumstances that caused your trauma. It’s your brain’s way of protecting you. It senses that you are in a similar situation to one where bad things happened to you, so it tries to force you to flee from that situation to protect yourself.

I recently certified Delia as an Emotional Support Animal because one thing that triggers flashbacks is being trapped in an enclosed metal tube with a bunch of men I don’t know. I can fly without her, but the efforts it takes for me to calm myself down for several hours drains every ounce of energy I have. I get to my destination exhausted and it can take me up to a month to recover.

Another thing that triggers flashbacks is dealing with aggressive males who do not listen to me and continue to engage me when I want to be left alone.

There have been multiple times this year on Twitter where I have made a comment or asked a question and have been bombarded with well meaning but obnoxious advice from men. It ranges from speaking to me like I am a toddler and couldn’t possibly have considered the most obvious solution that they are giving me or trying to force me to use their preferred mode of whatever in spite of my pleas saying that I already considered it and it won’t work for reasons I don’t want to articulate in 20 tweets.

When this happens, I start to feel overwhelmed. I feel personally attacked and unsafe. It causes me tremendous amounts of emotional distress. I start to have flashbacks and experience all the emotions I experienced when I was being raped. I have had at least a half dozen times this past year where I have gotten so distressed from these interactions that I have had to make emergency appointments with my therapist and spend money I don’t have trying to recover to the point that I am able to work. I have been in constant fear of not being able to work and earn money and destroying my career this year because these well meaning but clueless men have insisted upon trying to be “helpful.”

I have tried multiple times over the last year to explain to people that what they are doing is causing me real harm and damage. Every time I have attempted to engage in a dialog in explaining where I am coming from, I get a bunch of defensiveness and people telling me that they’re engineers. They want to solve the problem. They’re not intending to cause me psychological damage and therefore I don’t have the right to be upset by their behavior.

I don’t give a shit what you intend. It’s the result of your actions that matters.

If you are driving around and you get distracted by your phone and run someone over who is paralyzed for life, it doesn’t matter that you didn’t intend to run them over. They’re still damaged. You don’t get to hide behind your intensions when what you are doing is causing me actual harm.

I am tired of being responsible for having to do the emotional legwork that men are unwilling to do. I have told them many times how to avoid causing me harm and I am being told it’s my problem and they won’t change because their desire to avoid hearing that they’re doing something harmful is greater than my need to be able to earn a living.

I don’t want to be a massive bitch and make people feel like they can’t talk to me without getting bitched out, so I am establishing my rules so that I can protect myself psychologically while still being able to engage with people on Twitter:

First Strike: I Ask You to Back Off

I understand that on Twitter things can escalate very quickly and tempers can flare. At this point something will have happened and I will start to feel overwhelmed but I can still avoid a total shutdown, but only if you stop engaging with me.

I will tell you that I am feeling overwhelmed and ask you to back off.

At this point, if you back off, we’re good. You can feel good about being an engineer and know that you have made a situation better. If you still want to make this point to me later, please wait a day. Ask me for my email and send me an email or give me a chance to engage in a better forum of communication.

Second Strike: I Send You a Link to this Blog Post

It’s possible you’re reading this because I sent you a link to this blog post. I am trying to explain to you why I can’t continue to engage with you. I am not trying to blame you or tell you that you’re an asshole. I am assuming that you mean well and I am trying to find some way to let you know that was you are doing is causing me harm with the hope that you will respect my need to be left alone. Again, if you read this post and you back off and leave me alone, no harm, no foul.

Third Strike: I Will Block You

If you have gotten to this point and you are still continuing to engage with me, then I will block you. I am doing this out of emotional self defense. You have shown that you are not willing to respect my need to feel safe. You are leaving me no other option than to block you to protect myself.

If you’re someone that I know personally and have invested in a relationship with, I will try to remember to unblock you later. I will emphatically ask you to please stop doing things that cause me psychological trauma.

I do not want to block people, but I also do not want to spend a hundred dollars seeing a therapist to be able to keep working. My need to be able to work supersedes your desire to feel helpful. If you want to be helpful, please back off if I tell you that you are forcing me to shut down. If you respect that, we’re cool.

Thank you.

Special Announcement: The Metal Programming Guide

Hello all. For the last few weeks I have been hinting that I have a new project that I had not yet announced yet. I wanted to make this announcement at MacTech, which I did yesterday, so I am now publicly announcing this.

I am working on a new book: The Metal Programming Guide. If you are familiar with the OpenGL series of books like the OpenGL Red Book and the OpenGL Blue Book, this is going to be The Red Book for Metal. The publisher for this project will be Pearson/Addison Wesley, so this is not a self-publishing effort on my part. I will have technical editors and people breathing down my neck if I miss deadlines!

Back in 2014, when Metal was announced, it excited me tremendously. I did a series of conference talks on it throughout that year, but a little thing called Swift kind of got in the way of my learning path for Metal.

This year has been something of a disaster for me on a personal level and I didn’t get to accomplish what I had hoped to this year. Being given an opportunity to finally get to master Metal and write a book about it has given me hope for the future. I have always felt like Metal was something I was meant to do, but I wasn’t really ready to tackle it until now.

Right now I am trying to balance doing some short term contract work with attempting to work on the book. I hope to not run out of money before I finish the book, but I also want to avoid doing full time work that would prevent me from making progress on the book. We are very early in the process right now, but I am giving it everything I have to try and get this done in a reasonable amount of time.

I am hoping to be able to make weekly posts on here and my podcast about various aspects of Metal programming that I am not able to include in the book due to lack of time/space/things being out of scope.

Even though I have been a co-author on a number of programming books already, it has always been my dream to do an immersive book on a topic such as Metal. I am excited to learn this amazing framework and share that knowledge with everyone else.

I’m announcing it here on this blog because I have absolute confidence that this project will be successful. I’ve been waiting to do this for a long time. I do not plan to drop the ball on this. Bring it on!

The Cost of Complacency

This is another cross post from my podcast Janie Rants. I will record this script later today and post it to that site as well.

Yesterday I, along with half of our nation, watched in growing horror as we saw the election results come in. Last year we laughed at the Republicans as they saw their establishment candidates knocked out one by one by an orange con man. We shook our heads in disbelief that any woman would vote for a man who was on tape talking about grabbing women by the pussy. He went on rants at 3:00 in the morning calling an ex-beauty queen a pig and an eating machine. Surely no one would trust this man with codes that could start a nuclear war?

I want to rewind everyone back a few weeks to October 27, 2016.

This feels like a lifetime ago, but this was when Apple announced their update to the new Retina MacBook Pro.

People like me have been waiting anxiously for an update to this line of computers. I have wanted to buy a new laptop for a while but I wanted to really max out the processor and the ram.

What did we get?

We got the same RAM. Close to the same processor. And a touch bar. Oh, and all of our ports are now gone and we have to spend an extra hundred bucks or two to buy all the dongles we need to plug our new iPhone 7s into our laptops.

A lot of people were really angry about this. Most people dismissed them because every time Apple announces something, everyone is angry. Everyone is angry that their pet thing didn’t get featured with an upgrade.

Most people who complained about the new Macbook Pro were chastised by the community. We’re told that Apple has a reason for doing what they’re doing and a lot of us didn’t like certain changes made to iOS but that after we got used to them we realized they had a purpose and Apple knew what it was doing, so we should have faith that there is a reason behind all of this too. Even if there isn’t a reason behind everything, what are you going to do about it? Apple is still the best choice even if it’s not as much better as it used to be.

I feel like those people who are telling us to stop complaining are like the establishment politicians from both the Republican and Democratic parties.

People in the Apple community are upset. We remember ten years ago when we saw all these amazing innovations coming from Apple. I recently received a vintage blueberry iBook from someone to decorate my living room. When I saw the computer for the first time, I laughed out loud with delight. The design of the computer was like nothing I have seen in such a long time. It was different and unique. It made me smile.

Nothing Apple has produced over the last five years has made me smile.

I got an aluminum Mac Book in 2004 that was nice. It looked modern. It was well built. It had a neat track pad. It was light enough that I could carry it places. It felt like a modern machine.

When I look at every computer that has come out since that one, they’re all variations on the same tune. Same with the iPhone.

Every year the devices get thinner and more fragile. There are more bugs in the tools and the frameworks. There is less time to create innovative applications because by the time you learn the new ropes, the system changes. The changes people actually want to see never get done. But there is an assumption that people will just keep buying Apple products because we’re locked into an ecosystem and we’re obligated to do so.

I feel like this is similar to the attitude we saw from the Democratic party in regards to Hillary Clinton.

I want to say I like Hillary Clinton. I think she would have been a solid president and I am incredibly sad that she lost. I think that thirty years of gas lighting and fake scandals and constant investigations turning up nothing have tarnish her reputation and it saddens me that an orange troll can be on tape talking about grabby women by the pussy and be taken more seriously than a religious woman who has dedicated her life to public service.

That being said, this election was about change. The election in 2008 was about change too. The Great Recession hit and destroyed our economy. The Democrats rode to the White House on the shoulders of Barack Obama, the great hope of our generation. He promised to close Guantanamo Bay and to stop sending our soldiers to die in the Middle East. He promised to clean up the corruption that resulted in the Great Recession.

He didn’t do any of these things.

He passed the Affordable Care Act, which is a landmark piece of legislation. One of the only reasons I can be an independent consultant is because of the Affordable Care Act.

But no one went to jail over the corruption that caused the Great Recession. Gitmo is still up and running.

We can rightfully make the argument that Obama was hamstrung by Congress for the last six years, but the biggest reason that we wound up with the Tea Party just two years after Obama’s historic election is because people felt betrayed that he didn’t do what they thought he would do. He didn’t clean up corruption. He didn’t throw the bankers in jail. He created a giveaway to the insurance industry to allow them to have a blank check for health care. We rejected Hillary in 2008 because Obama promised us hope and change and we got more of the same.

The health insurance marketplace opened on November 1st. My health insurance went up nearly a hundred dollars a month. I saw classmates who work on family farms show that the cost of insuring their wife and child in the most bare bones package available was a thousand dollars a month with a twelve thousand dollar deductible. That’s completely bogus.

Obama continued to get advice from the same corporate people that crashed the economy in the first place. He didn’t enact the bold action people elected him for because he trusted the advice he got from the people with the same college education and background that he had. I used to think Hillary would have been different, but now I am not so sure.

There is an economics experiment called the Ultimatum Game. In this game, there are two players. One player is given ten dollars and is told that they can split it any way they want to, but the other player can either approve it or deny it. If the player approves, the money is split accordingly and each player takes their money and leaves. If the player denies it, then no one gets anything.

A common way most people split the money is to take nine dollars and offer one to the other player. If you think about this rationally, the second player should approve of this deal because it gives them a dollar they would not otherwise have. But we’re people and we don’t think rationally. We don’t think it’s fair for the first player to get nine dollars when we only get one just because they got to choose the split. They have more to lose than we do if we reject the offer and we feel better about denying the other person their nine dollars than we do about losing our one dollar.

For the last several decades the American political system has been an ultimatum game. The establishment politicians have used social issues like abortion and civil rights to try and bludgeon us into agreeing to their deal. We’re supposed to vote for Hillary to avoid a future dictated by people like Paul Ryan wanting to enact his Ayn Randian vision of America where he will destroy our safety nets and let everyone die in a state of unmitigated poverty.

People who are shocked by this are not familiar with the ultimatum game. They thought everyone would nicely go along with the status quo because the status quo is better for them than the probable hell the next four years are going to be. But they’re going to be a lot worse for us than they are for them. It’s going to be worst of all for our Muslim brothers and sisters out there.

I consistently see people earning ten dollars an hour fighting against a fifteen dollar an hour minimum wage because they don’t think people working at McDonalds deserve fifteen dollars an hour when they’re only earning ten. They don’t care that they would increase their own wage by fifty percent by supporting a fifteen dollar and hour minimum wage, they just want to make sure that no one underneath them manages to get ahead of them. They want everyone to be brought down rather than being brought up.

A lot of anger and ill will right now at the Democratic party is reminiscent of a lot of the arguments I have been making about the tech industry. The party wanted Hillary because Hillary was a good culture fit. She would support their interests. They all met at the Christmas party and sent their kids to the same schools. They wanted someone they were comfortable and familiar with.

And that is exactly what everyone is angry about.

They don’t want to take their dollar while the banks get nine. They don’t like being told that they should be happy with their dollar because if Donald Trump is president then they won’t get any dollars.

Right now in the tech industry we have a massive glut of wealth that is going to a small group of people who are all in their early twenties who all went to Stanford or MIT who are all pitching the exact same shitty product that already exists in ten different forms somewhere else. Nothing innovative is happening because it’s a giant echo chamber where the same people are starting companies doing the same things and selling them off to the same other larger companies. No new ideas or people or perspectives can get in because they’re uncomfortable and we’re on the verge of a collapse because of it.

You can’t keep producing the same product over and over again that people aren’t interested in buying. You can skate by for some period of time on that apathy, but eventually a disruptive force will come and shake things up.

IBM didn’t take the PC market seriously. They didn’t think a small company like Apple could completely change the way we live our lives. Now Apple is falling into the same complacency trap that sucked up IBM and Xerox. They think everyone is locked into their ecosystem and that no one wants to buy Android phones because they’re inferior, so they aren’t listening to what we’re saying we actually want because they think we have no choice but to accept what they’re producing.

Let’s imagine that another company creates a fantastic competitor to the iPhone. It could be Google. It could be some upstart we’ve never heard of. Their products are innovative and exciting. You’re not trapped in a proprietary ecosystem where you must own an underpowered Mac to write applications for this new device. You can buy cheaper and better devices that are genuinely exciting and not just more of the same.

Or pretend that there is a customer rebellion and everyone refuses to buy iPhones. Some change is made and the customer base leaves out of spite.

It might not happen tomorrow, but it will happen. People don’t like being backed into a corner and told they have no choice. It happened to other companies and it is happening to Apple. Apple can listen to the rumblings of discontent coming from its user base and make a decision to embrace the things that made it great, but I don’t think they will. It’s easier to be complacent and keep doing the things your comfortable with that have always worked before, especially when you’re surrounded by people who all think the same way you do.

One of Steve Jobs’s favorite songs was “The Times, They Are A’Changing“ by Bob Dylan. I suggest that in the wake of this election we all take a deep look at our society and we stop blaming people who have been telling us for decades that they’re angry but were ignored because we assumed they would all just go away and die. The signs were there, but we didn’t want to see them. We didn’t want to fix things that were broken because they worked good enough, and now we’re facing a reckoning.

Come gather ’round people
Wherever you roam
And admit that the waters
Around you have grown
And accept it that soon
You’ll be drenched to the bone.
If your time to you
Is worth savin’
Then you better start swimmin’
Or you’ll sink like a stone
For the times they are a-changin’.

Primitive Drawing and Assembly in Metal

One of the main reasons I got interested in iOS was because I wanted to learn graphics and audio programming.

I got really interested in OpenGL, but after a year of trying to learn it I wasn’t making any progress.

Anyone who has tried to learn OpenGL have gone through the same frustrating experience I have. You find a tutorial on Ray Wenderlich and you write a bunch of code and at the end you have a spinning multicolored cube. That’s really cool!!

But then you realize that you have absolutely no idea how to do anything else.

For a really long time, I thought that I had to enter all of my vertices by hand because every tutorial I saw had you write your vertices by hand. My brain was scrambled by the idea of trying to create a large, complex 3D model by hand coding the vertices. It’s hard enough coding things with auto complete, what if you miss a value?! Do you have to keep building it and keeping track of the vertices and try to figure out which one needs to be moved when there are a thousand of them?!

Eventually I was told that you import a pattern file into your application, but until the release of Model/IO in iOS 9, you had to write your own parser from scratch to import a file from Blender or Maya.

So I faced an incredible amount of frustration trying to figure out how you get vertices into an application and how they work together to create something. I kept being told that those projects of the spinning cube introduce you to all the things you need to know in order to make OpenGL work, but it was something that was not intuitive.

I am seeing people go through similar frustration while trying to learn Metal. I am hoping to do a series of blog posts over the next few months about aspects of Metal and 3D graphics programming that I don’t feel I have seen explained very well in other places. This stuff is complicated and difficult to explain, so no judgement on anyone who produces technical materials on Metal or OpenGL.

Star Project

I decided to do a project that was slightly more complicated than a triangle or a cube but not as complicated as a 3D pug model. I want to figure out how to explain this stuff in a way that the reader can extrapolate and scale the complexity while still understanding how the fundamental concepts work.

I decided to try and draw a two-dimensional star. It’s slightly more complicated than a triangle but it’s still simple enough for a person to sit down and conceptualize.

Yes, I screwed up the vertex labels at the bottom.

Yes, I screwed up the vertex labels at the bottom.

I really hoped that I could find a simple CAD program to generate a pattern file for my 2D star, but after multiple frustrating conversations with various people, I decided to bite the bullet and just plot out the vertices by hand.

The Metal rendering space is slightly different than what one expects coming from something like Core Graphics. I am used to the idea that the phone has a normalized coordinate space where the height is one unit and the width is one unit.

Metal still utilizes a normalize coordinate space, but it’s two units high and two units wide, so the center of the screen is coordinate (0,0,0). So the upper left corner of the screen is at coordinate (-1, 1, 0). The lower right corner is (1, -1, 0). It’s not complicated to understand, but it’s slightly counterintuitive for someone coming from the idea that everything is a value between 0 and 1.

I created my coordinate space using graph paper. I made each square on the paper worth 0.2 units and made the space ten squares by ten squares.

I understand that because the phone screen is not perfectly square that the star is not going to look like this when it’s finally rendered. One of the things I want to do later is figure out how to constrain the drawing area to be square so that the star renders properly, but that’s a task for a later time.

Writing out vertices by hand like a savage.

Writing out vertices by hand like a savage.

In Metal and OpenGL, shapes are composed of triangles. All the big scary 3D models that make up a Pixar movie are composed of meshes of triangles. Everything can be broken down into triangles.

So let’s think about a star. It’s obvious that the points are composed of triangles, but what about the middle? The middle is a pentagon. This pentagon can be composed of five triangles by drawing out from the center to each of the vertices between the points.

So if you think about how to describe the star to the renderer, you are going to describe ten triangles using eleven vertices. There are five vertices at the points, the five between the points, and finally one in the middle.

Metal Primitives

When you package and pass your vertices to the vertex buffer, you need to describe to the vertex buffer what type of shape it’s drawing. I know I just went off on how everything can be broken down into triangles, but there are a few flavors of shapes you can draw with Metal.

Metal has a enum of Metal Primitive Types. There are five different primitives available to you:

  • Point: Rasterizes a point at each vertex. You have to define a point size in the vertex shader.
  • Line: Rasterizes a line between a pair of vertices. These lines are separate and not connected If there are an odd number, then the last vertex is ignored
  • Line Strip: Rasterizes a line between a bunch of adjacent vertices, resulting in a connected line.
  • Triangle: For every separate set of three vertices, rasterize a triangle. If the number of vertices is not a multiple of three, either one or two vertices is ignored.
  • Triangle Strip: For every three adjacent vertices, rasterize a triangle.

So the easiest way to think about how to describe the star to the vertex shader is to hand enter ten sets of three vertices that describe a triangle.

let vertexData:[Float] =
    [
        // Internal Triangles
        0.0, 0.0, 0.0, 1.0,
        -0.2, 0.2, 0.0, 1.0,
        0.2, 0.2, 0.0, 1.0,
        
        0.0, 0.0, 0.0, 1.0,
        0.2, 0.2, 0.0, 1.0,
        0.3, 0.0, 0.0, 1.0,
        
        0.0, 0.0, 0.0, 1.0,
        0.3, 0.0, 0.0, 1.0,
        0.0, -0.2, 0.0, 1.0,
        
        0.0, 0.0, 0.0, 1.0,
        0.0, -0.2, 0.0, 1.0,
        -0.3, 0.0, 0.0, 1.0,
        
        0.0, 0.0, 0.0, 1.0,
        -0.3, 0.0, 0.0, 1.0,
        -0.2, 0.2, 0.0, 1.0,
        
        // External Triangles
        0.0, 0.6, 0.0, 1.0,
        -0.2, 0.2, 0.0, 1.0,
        0.2, 0.2, 0.0, 1.0,
        
        0.6, 0.2, 0.0, 1.0,
        0.2, 0.2, 0.0, 1.0,
        0.3, 0.0, 0.0, 1.0,
        
        0.6, -0.4, 0.0, 1.0,
        0.0, -0.2, 0.0, 1.0,
        0.3, 0.0, 0.0, 1.0,
        
        -0.6, -0.4, 0.0, 1.0,
        0.0, -0.2, 0.0, 1.0,
        -0.3, 0.0, 0.0, 1.0,
        
        -0.6, 0.2, 0.0, 1.0,
        -0.2, 0.2, 0.0, 1.0,
        -0.3, 0.0, 0.0, 1.0
]

I want my star to be kind of flashy. I would like to set a pseudo-radial gradient on the star where the tips are red, but the middle is white. So I need to set up another array of floats describing the color data as it correlates to the positional data.

let vertexColorData:[Float] =
    [
        // Internal Triangles
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        // External Triangles
        1.0, 0.0, 0.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 0.0, 0.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 0.0, 0.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 0.0, 0.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        
        1.0, 0.0, 0.0, 1.0,
        1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0
]

Over in the view controller, you need to create a buffer to hold the position data and one for the color data for your vertices:

var vertexBuffer: MTLBuffer! = nil
var vertexColorBuffer: MTLBuffer! = nil

Now you need to connect those buffers to the arrays of vertex data. The buffers don’t know how much data they need to store, so you have to calculate how large these vertex arrays are so the buffers know how much space they need to allocate for the vertex data.

let dataSize = vertexData.count * MemoryLayout.size
vertexBuffer = device.makeBuffer(bytes: vertexData, length: dataSize, options: [])
vertexBuffer.label = "vertices"

vertexColorBuffer = device.makeBuffer(bytes: vertexColorData, length: dataSize, options: [])
vertexColorBuffer.label = "colors"

img_5660Since the vertex position and color arrays are the same size, you can reuse the data size variable for both buffers.

At the end of the process, this data is scheduled by the render encoder to be sent to the vertex shader and be processed by the GPU.

renderEncoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
renderEncoder.setVertexBuffer(vertexColorBuffer, offset:0 , at: 1)
renderEncoder.drawPrimitives(type: .triangle,
                                   vertexStart: 0,
                                   vertexCount: vertexData.count)

Build and run the app on a phone and you get a nice star! Huzzah!

Wrap Up

I created a GitHub repo for this project here. Honestly, most of this project was basically me just using what comes in the template but changing the vertex data.

Looking this over, it seems kind of inefficient. The middle set of triangles feel like they could be a triangle strip. I would like to add a nice outline to the star to make it look nice and neat. I also would like the star to not be morphed by the screen.

I am planning to update this project periodically to make it more efficient and customizable.

At the very least, I hope this adds some understanding to how Metal breaks down larger shapes into triangles and how it’s able to go through and build the shapes back up again.

Refactoring the Blog 2016

This is why you don’t make long term plans, kids. They never work out.

So a few weeks ago I started a blog series on a game that I am making. Then I got derailed by the brief fling with algorithms. I had hoped to get my focus back on completing this game. I haven’t published an app out on the store yet and I really wanted to write a program on my own all the way through to being shipped.

Sadly, this is going to stay on the back burner for a while longer.

I have a new project I am working on that I will announce soon that will be absorbing most of my time and attention.

I don’t like to abandon the blog (and now the podcast) when I have a project I am working on. The last year has been rather sparse during times I have been consumed with projects and I don’t want to do that.

I am going to try to integrate the new project into both the podcast and the blog. The whole point of both of them is to talk about all the new stuff I am learning, so I am hoping to continue to do that with the new project.

I feel bad because I really wanted to hold myself accountable to getting a project completed. I would like to continue to do that and come back to this later.

My understanding is that a lot of people besides me have pet projects and the ruins of previous hobbies fossilizing in their basements.

I need to spend a little bit of time figuring out how to approach integrating my new project into my long term projects.

So, goodbye Godori. I will get back to you eventually. I hope.

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.