This post was pulled from my TLog project, but it felt relevant enough to make it to this blog as well. Some interesting stuff about reading and writing code.
I’m trying the Nitro Cold Brew coffee from Stumptown that they just started carrying at Planet Granite. It is tasty, but I like the regular cold brew better and will be sticking to that in the future. Still, I do love coffee.
I was listening to a podcast the other day, I believe it was Finding Mastery with Ariana Kukors: Swim. And they were talking about gratitude practice. The part that really stuck with me was that practicing happiness is really hard. Being happy is a by-product of the world around and the best way to approach getting that feeling may be through practicing gratitude. I’m going to try and say three things I’m grateful for each day.
- I’m so grateful that we as humans discovered coffee. It has a profound effect on my life and while I only drink about 2 cups a day, I love it.
- I’m grateful that I can afford to take as many pictures as I do now. I love photography and there was point when I was in college when I felt like it was too expensive. Thankfully I can now afford great gear and enjoy using it.
- I’m very grateful for my climbing community. Yes, I don’t see as many of them as much as I used to, but I love having a second home at the climbing gym. It is more adult that my cheer community (not that I don’t appreciate that as well), and much closer to my house.
I spend a lot of my time reading objective-c code for work. Reading the basic syntax is pretty easy, but understanding what is going on in someone else’s code has always been relatively difficult for me. I’m not sure how everyone else does it, but the way I tend to read code is to go through a live example of the code and see how variables are manipulated. I like to track a path from a point I understand to a point I need to discover. The larger the piece of the code the harder it is for me discover the flow and the process.
The best analogy I have to this process outside of code is my attempt to read the Odyssey. I moved around a lot as kid and didn’t get to read greek theology in school. I have tried to pick up post school, but understanding the Odyssey or the Illiad has been very hard for me. I can read the words and understand the basics of what’s happening, but I’m not sure I can see the forest through the trees. When you are in class, you have a teacher and class to discuss the book with. The concepts in the book are discussed and you collectively discover what is going on.
When reading code, the teacher/class is akin to being able to talk to developer who originally wrote the code. Sometimes they are sitting right next to you. Sometimes they are downstairs or close by. Sometimes they are phone call or email away. Sometimes there are cliff notes in the form of a really good tutorial or ReadMe. Most of the time, though, you just have figure it out on your own. If the code is written using some common conventions (like a restful api, or common design pattern), it can be easier. Sometimes the code is all over the place and impossible to discover.
Yesterday I was working on understanding MGSwipeTableCell. It’s a pretty well built piece of code, but still rather confusing to figure out for me. I figured out what I needed to, but only after a couple hours of debugging. I wish I had done a better job reading the original piece of code from the beginning.