Winter Break and Advent of Code

This winter break I gave myself the project of becoming more proficient in standard Ruby (sans Rails). In order to do this I did a bunch of coding challenges. One of the sets of challenges I tried was an Advent calendar made up of coding puzzles.

I wanted to write up a blog post about what what I learned about Ruby from gaining all 50 advent of code stars. I did a great job of erasing all Rails from my mind this break and concentrating on my programming fundamentals and use of Ruby. This will probably hurt a lot when I return to class on Monday but it also helped to cement things I’ve learned so far and teach me new things about programming. So here are a couple of things I learned from this winter adventure.

Screen Shot 2016-01-02 at 6.14.17 PM.png

Advent of Code is a 25 day challenge leading up to December 25. It’s a fun project put together so that it’s accessible for all skill levels and can be completed in any programming language. I am definitely bookmarking AoC for when I have to learn a new programming language. I tried the first five days in R and Ruby and it helped me relearn a lot of the R I’ve slowly been pushing out of my brain. My GitHub repo of AoC can be found here. This is not the prettiest code in the world and there are definitely exercises I’m more proud of than others, but regardless of code quality it’s something I finished and I learned a lot in the process. Here are a few of the things I learned.

1. Range of CS-Related Topics

What I really liked about the layout of the challenges is that most touched on a range of topics in the development world. One challenge took advantage of parsing JSON files, something web devs would know a lot about. One talked about MD5 hashes, and another about password encryption, which relates to cybersecurity. There was a challenge that related to hardware, one for bitwise operators, and lots of interesting sorting problems. It was a fantastic array of subjects to learn about for someone who has only been programming for a little while. I learned a lot about Regular Expressions as many of the puzzles had to do with large amounts of string input. I also was able to brush up on my math for the puzzles that involved coordinates. Overall, once you have the basics of a language down, doing coding puzzles like this can really help introduce you to CS topics when you did not go to school for that. The one area where my background in economics helped me was on an optimality constraint problem where you calculate happiness of guests based on who they are sitting next to. But besides that, I was pretty lost when solving problems with “jumps” and “registers” and learned a lot in the process.

2. Every Language Has Strengths and Weaknesses

During my three weeks of working on Advent of Code, I spent a lot of time on the AoC sub-Reddit reading about how people saw the problem and looking at code in Python, Java, C#, C++, Ruby, and many many more languages. I had the most fun with people’s solutions that didn’t even use code at all, but instead used pen and paper and manual logic to solve the problem. In this process, I started to realize how lucky I was to have Ruby for some of the more Object Oriented problems (everything in Ruby is an object, EVERYTHING!) and how sad I felt on the Math problems or things like bitwise operators where other languages naturally excel. By about the 10th day I could really tell if a problem could be easily solved in Ruby right away and just see the algorithm in my head if that were the case.

3. Classes, Hashes, Arrays, oh my!

I learned a lot about the various advantages and disadvantages of data structures doing these puzzles. I generally am inclined towards using arrays and hashes, but there were many times I had to scrap my algorithm half-way through realizing that I should create my own class instead. Classes are great ways to organize related data and reuse that information later. My first reaction as a new programmer is always to go for a simple way of storing the data like an array. Working through more complex puzzles made me teach myself to use objects much more often. Instances could sometimes hold information so much more clearly than hashes could. This was the most helpful on the horrible two days at the end of the puzzles where you had to basically build an RPG in order to calculate minimums. I also quickly began to adapt using hashes much more often than arrays. The information in a hash can be unordered and pulled out without an index, but with a reasonable call like a name or identifier, which is super helpful when you have a lot of information and don’t want to remember the order. I kicked myself many times for using arrays early on and then having no idea where my data was by the end of the code. I also internalized a lot about classes and object creation in the longer puzzles.

4. Countless Amazing Ruby Things

The biggest thing I learned during the last two weeks has been all of the amazing Ruby modules, methods, gems, etc. that make doing hard stuff easy. The three biggest modules I learned advanced things about while solving the puzzles were Array, Enumerable, and Regexp. I probably know or have seen every Ruby enumerable at this point. Here are my new favorite Ruby things in no particular order:

  1. #each_cons(n): gives you arrays of n amount in consecutive order so if you called it on [1, 2, 3, 4] and wanted arrays of 2 it would give you back [1, 2], [2, 3], [3, 4]. Isn’t that grand? Great for combinations of linear items.
  2. #combination(n) and #permutation(n): Give an array and the number of elements in each array and get all combinations or permutations of that array. The difference between these two methods was hard to get used to. Basically, if order matters you want a combination and if it doesn’t, go for permutation.
  3. Class: Set:  I used sets a lot instead of array#uniq in order to push only uniq items into a data structure.
  4. Module: Benchmark: Provides methods to measure and report time used to execute the code. When I wasn’t sure if I was just being inefficient or stuck in an infinite loop, I’d use Benchmark.
  5. #each_with_index: Oh, God. What would I do without #each_with_index? This method allows you to do what each does but also keep track of the index you are at in the array.
  6. Class: Digest.hexdigest: Returns the hex-encoded hash value of a given string, helpful for the cyber security questions.
  7. #zip: takes one element from an array and merge the corresponding elements from each array, zipping them together.
  8. Rubular: a website that allows you to play around with Ruby regular expressions.
  9. Handling of bitwise operators (binary numerals at the bit level) showcased well in this article.
  10. #sub, #match, #gsub, #inspect, #take and #name_captures: all ways to handle regular expressions and find string or digit matches inside a particular string. #name_captures even returns a hash! Figuring out how to use all these correctly was a major hurdle and felt great to overcome.

There are many more awesome Ruby things I learned in this process. I also enjoyed comparing Ruby solutions with other languages. I would love to return to these one day and solve them in another language (or two!).

5. Scalability a.k.a. “THERE’S A PART TWO?!”

A great thing about AoC is that every puzzle had a second part. That second part was either easy or hard to solve, usually based on how you set up the first part. With that in mind, it was always helpful to not be hack-y in your solution to the first part. This caused me to spend more time thinking through what the puzzle was asking than brute force hacking.

6. ❤ pry & irb ❤

This post is dedicated to irb and pry. I love you. And you are my best friends in Ruby. Thank you. You will find commented out (and a few stray not-commented-out) binding.pry’s in all of my code. Debugging was key to finishing these puzzles.

Jon Stewart, Comedy, and Craft

A short thought.

So I was on a few planes this week and I had a lot of down time to read and think. I finished Andy Weir’s The Martian. It was okay. Should make for a good movie. Anyway, I got to engage in one of my favorite down-time past-times: listening to a gajillion billion podcasts. Besides NPR, The Read, Another Round, Call Your Girlfriend, Slate, etc. (all the favorites), I decided on a whim to search for “Jon Stewart” in podcasts and dug up some old interview’s he did on Fresh Air and Bill Moyer’s show. I have watched Jon Stewart for as long as I’ve been interested in politics… so for the whole tenure of his time on the Daily Show. I have always felt a strong connection to his righteous anger on issues of corruption in the media and in politics. Sad about his leaving the show, I decided to listen to him speak about comedy and his time early on in the show. In this search, I came across an interview he did with Dave Davies in 2004 that struck a chord for me. Here is an excerpt from their conversation:

DAVIES: And you decided to go to New York and do standup […] And at first just got brutalized, as people do. And I’m wondering – you know, there are lots of people who are funny, that make their friends laugh, make their families laugh […] I mean, you were so funny, you had that brain working that way. What was it you didn’t know?

STEWART: What was I didn’t know about which?

DAVIES: About why didn’t it work? Why is being funny with your friends not the same thing as…

STEWART: Well, because it’s a craft, you know? It isn’t – there’s a big difference between having an analytical mind and being a good scientist. There is a craft to learn. And that was the biggest lesson is that it takes – again, it’s that idea of turning obnoxiousness into wit or comedy. You know, creating something from nothing is different from just being reactive at a bar. And you have to create the atmospheric conditions for comedy. Comedy is oddly enough very fragile and can be thrown off by, you know, a glass breaking or somebody talking or – you, know, there’s a lot of different elements to it that – and construction of a joke – you know, you have to create – one of the things about being funny life is the premise is already there.

This completely encapsulates my motivations and thinking as I delve further into projects in programming (and as I try to defend this divergent path to friends and family as well). There are lots of people who are sharp, who are analytically minded, who are the most creatively critical in a classroom. I was one of those kids. I’m an analytical person. However, being smart or analytical is exactly like being funny around friends in Jon Stewart’s case. There is a big difference between the potential and the profession. I think that in this year after my graduation, I want to build craft. What a word. Craft. 10,000 hours. I want to work hard at something that is intellectually exhausting and come out the other side two, five, ten years down the line, with a craft. As Stewart says, the biggest thing to learn is taking that energy and potential and turning it into something, producing something, and building something, and then channeling that something positively. I see so many similarities between comedy (purely, the most intricate and nuanced facet of language itself) and code similar to how I saw similarities between linguistics and code. And that comes down to craft. Craft is not a manual. It is not something that can be taught straightforwardly. It is an expert intuition, always moving and evolving, it is nuanced in its execution. When this craft is tuned and focused and then let grow through improvisation, it can be amazingly beautiful.

Wow, I got to go code some more.

tumblr me8m1h0m161qcmnsuo1 400 All the Jon Stewart GIFs you'll need as he leaves 'The Daily Show

Design and Creativity

I’m currently taking an intermediate HTML/CSS class with Girl Develop It. The class is being held at Adobe in Seattle. Wow! That office space is beautifully designed (I mean, of course, but still) and taught by the awesome Marcy Sutton who is basically everything I want to be later in my career in programming. I just talked about this for my Ada application video, but five years into my career I would love to find my place in my coding community, give talks, be an educator and mentor, and have a larger effect on the community when it comes to accessibility and inclusivity for others. Marcy is doing all that and is awesome.

I enjoyed the last HTML/CSS class I took with GDI and my websites are starting to move out of the 90s and into the modern era with a little CSS3 help: Screen Shot 2015-07-14 at 7.55.54 PM

And a 3-column design looks so pretty (ignore me and the donut)!!!:

Screen Shot 2015-07-15 at 8.49.54 AM

However, the class has me thinking a lot about “design” and what that means and if I would be good at doing it or even like it. I am not one of those people who think anyone and everyone can design or that art is not a deeply rooted praxis. This comes from being raised by an architect and having several industrial and graphic designers in my family. I have heard a lifetime worth of arguments over hexcodes, shades, good design practice, and the difference between all sorts of triangle shapes — 30 degrees is NOT 31 degrees and that you would insinuate that is an insult. I find design compelling, I do like art, but I’m not sure it’s really my strong suit. I have always liked spatial problems. Or maybe it’s just math — any problem with multiple variables and a restraint. I often imagine time constraints and word counts in terms of finite space.

I just don’t know if tweaking CSS and HTML to hack design on a website is exactly what gets me excited. Tweaking databases and data structures so that we get different and more accurate interpretations of results however… I could do that all day. I don’t mind cleaning data, because I love breaking down something large and complex. I think it’s so important to appreciate design and know how it works though and I understand in the abstract sense that the “front end” is not only design. I am excited to learn more about the whole array of computer programming topics.

I wrote a philosophy paper once in undergrad about Martin Heidegger’s Building Dwelling Thinking, which argued for carefully inclusive design of public spaces. Heidegger begins his book stating

We attain to dwelling, so it seems, only by means of building. The latter, building, has the former, dwelling, as its goal. Still, not every building is a dwelling. Bridges and hangars, stadiums and power stations are buildings but not dwellings; railway stations and highways, dams and market halls are built, but they are not dwelling places.

In my head right now, you could so easily replace “building” with “web app” and “dwelling” with “webpage” where it exists through the browser. We attain to an accessible webpage only by building but definitely not everything we build is accessible.

Design is so important. Just learning a few basics, like what a “hero” (large header at the top of a website) is and how to alter it to look good, what SVG’s are and why they are better than png’s, and all sorts of best practices that will make your content accessible to everyone. At one point Marcy told us, “You don’t need to know how to create tools from scratch, but just being able to alter a SVG file is helpful.” I believed it. Having a birds eye view of design will definitely make me a better programmer no matter what part of the process I find fits me best.

I’m so thankful for organizations like Girl Develop It that go out of their way to offer classes at discounted rates for people who can’t afford General Assembly or Code Fellows. They are helping women like me to be more informed about the field as a whole and introducing us to really cool spaces like Simply Measured and Adobe in Seattle. I would definitely recommend looking into it if you are interested. They are very welcoming and have scholarships to their classes.

Applying to Bootcamps and Committing to Code

Last night I went to an Ada Developers Academy information session. The panelists talked a lot about personal journey and how crafting a narrative is key to success in their application. I think this is just true for all professional goals. So here I detail what got me inside that room last night, and why I am so committed to the type of community Ada is trying to facilitate.

Around six months ago, I was working in Pune with the digital ops team for Pratham and started to become interested in programming for the first time. I looked around (Googled) for different programs and bootcamps in Seattle that might be helpful in this journey. I wanted a bootcamp that was, above of all, intellectually rigorous. I wanted to my cohort to push me. More than that though — I wanted a program that matched my personality and values, that emphasized issues beyond the code. During this search, I found Ada Developers Academy, a year-long program just for women that looked both incredibly intense and put strong emphasis on communication, dialogue, and having the conversation about diversity in tech (not just talking about the conversation).

When I found Ada back in February, I became momentarily obsessed. Unfortunately for me, I found it exactly when the application opened up for the next cohort which started in May, and I was stuck in school until June. Five credits and some certifications stood between me and graduating with an economics degree. And everyone, I seriously considered dropping out of school to pursue programming right there and then. 

Have you ever found something that felt so right it made you nervous and excited at the same time? That’s how I felt when I found Ada. However, it wasn’t Ada that made me excited in and of itself. Ada looks fantastic, yes — but one program or product alone cannot cause an existential crisis or make feel like I need to drop everything and change my life. Ada’s tagline and mission were manifestations of a certain philosophy. You can find this philosophy in many organizations I have come to love in this journey: Girl Develop ItCode Newbies, and Women in Tech to name a few. Reading over Ada’s requirements and application sparked my enthusiasm and not just to apply. It gave me this strong feeling that I could actually do this. The amount of support for the organization told me something as well: people wanted me to do this. I didn’t need a CS degree, I just needed my own willpower and the ability to foster a community and support networks. 

So I didn’t drop out of college, obviously. I let the deadline come and go for the application and the opportunity slipped away. I knew there would be a cohort for me in the following months, but didn’t know how far off the organization would announce that. I wasn’t going to wait around for the application to open up again before I starting seeking out this community. I returned to Seattle to finish my thesis. School had become pretty dull at that point. All the excitement last quarter happened for me outside of school, at meetups and in conversations with mentors about this change. I took a class on feminist theory and wrote my senior thesis using R, which I enjoyed, but left me with only more desire to start coding and to meet other women in STEM.

I picked up some books on code (borrowed a lot from friends) and delved into online materials. I quickly realized something that I’ve heard many times before: coding is really really really hard.

And that made me love it all the more. I started out studying philosophy in school. I was intensely passionate about making arguments and delving into the depths of different writings to support ideas I had built from scratch. After a while though, I craved more opportunities to have a tangible impact and became interested in economics, where I could use math, statistics, and algorithms to support my models and arguments. Constraints and utilization curves had data behind them! I soon realized even economics had its share of faulty assumptions, inaccuracies, and often fundamentally mischaracterized human psychology. I started studying math. I like to tell people that I started out a philosophy major but if I had eight years to go to school, I probably would have become a math major. All this is to say, I began to realize that rigor and the constant search for more efficient (read: lazy) and powerful means to build arguments is at the core of what I wanted in a career. I never want to stop learning. In school there always seemed an end to the learning: the end of the syllabus, the quarter, getting a 4.0 in economics, graduating, etc. and I think a lot of academia is trained that way. In this new world, however, the possibilities are endless. We can pivot and pivot and pivot and no assistant dean is going to tell us “But six months ago you said you were going to teach Ruby and now your teaching Go? What is this?!?” Evolution in learning is not constrained by a syllabus anymore. 

This has all been in my mind for the last four months since I returned from India. I immediately set up coffee dates and happy hours with every developer or tech adjacent person I know. My friend Martina Welke gave me great advice about being a woman in tech. Kristina Lenova introduced me to amazing developers at her company Tune, and showed me what working at a tech company could be like. My friend Ben, a semi-recent graduate from App Academy, told me about his journey and discussed the culture. The countless amazing people I’ve met at Girl Develop It and Seattlerb gave me advice on learning materials. Finally, I reached out blindly to about four Ada students in their class or internship phases and all of them immediately responded “Yes. When?” I was able to have great conversations with them about Ada, and more generally how the mission of Ada compares to the community at large.

All of this brought me to Galvanize downtown last night for an information session. The application for Ada opened about a week ago and there are less than two weeks left in the process. The session was amazing, and the women from the cohorts spoke brilliantly about their experiences. I loved everything Amira, Loraine, and Kari said about community and their cohort. It reminded me so much of the Sullivan program at Seattle U. The panel also discussed creating positive culture and the ability to trust other classmates and work as a team. At one point, Rebecca Mark said she hopes the women and Ada will “be brave and unbounded” in tackling problems in tech and the world. At one point, a prospective student in the audience asked about intersectionality. I was relieved that the executive director’s answer came from a place of understanding. Cynthia spoke of Ada’s “no woman left behind” policy and how they try to build a constructive and open environment. Rebecca perfectly framed why these things are so critical when she said that this is was makes these women not only amazing humans, but “empathetic programmers.” If you cannot communicate your work to other classmates, how are you going to be able to communicate with users of your product? How are you going to be able to see if your product is applicable or accessible to people outside of yourself?

The session ended with a discussion of self-care and healthy habits while in the intense classroom phase, which I personally found comforting. In that moment I was so happy to have found Ada not only because of their program, but because this is exactly the culture I want to create, foster, and learn from in this line of work. So regardless of what happens in the coming months, I am glad to have this community and thankful for what they’re trying to do for women like me in trying to enter this field. I hope that even if I don’t become part of their cohort, I can still be part of the community and support its growth in the future.

You Cannot Stay on the Summit Forever

“You cannot stay on the summit forever; you have to come down again. So why bother in the first place? Just this: What is above knows what is below, but what is below does not know what is above. One climbs, one sees. One descends, one sees no longer, but one has seen. There is an art of conducting oneself in the lower regions by the memory of what one saw higher up. When one can no longer see, one can at least still know.”

– René Daumal

Inspirational quote of the day. A close friend of mine and current roommate is a mountain guide and brought home this beautiful book of pictures of mountains and quotes from climbers. This passage got me thinking about how climbing things is like achieving any new skill. Why even go to the summit? There is no final summit, just a series of ups and downs, so why bother? Coding and programming are part of this: “the art of conducting oneself in the lower regions by the memory of what one saw higher up.” Never stop learning. Never stop evolving.

Community Support && Mentorship Everywhere

I have been writing a lot lately. Not in terms of productive or technical writing but just scribbles here and there about little things, some poetry, some tangential prose. I’m reading sections of The Gloria Anzaldúa Reader lately and Anzaldúa speaks often to the power of writing. Example:

Why am I compelled to write? Because the writing saves me from this complacency I fear. Because I have no choice. Because I must keep the spirit of my revolt and myself alive. Because the world I create in the writing compensates for what the real world does not give me […] I write because life does not appease my appetites and hunger […] To become more intimate with myself and you.

Anzaldúa writes beautifully and compellingly, but it isn’t just from pure talent. It’s from a praxis in the way she held herself in the world and held others to be in the world. But that praxis includes a regimen of writing about personal and societal issues and using the writing as a way to stay accountable to yourself and others.

This week I decided to write thank you notes to all the people who have been so supportive of me this last year, especially to my mentors in my chosen switch from economics and international development to coding, programming, and tech. There are many people involved beyond my support network in Seattle as well. My online communities, specifically CodeNewbies, The Odin Project, and Free Code Camp have been great resources for me to feel welcome and easy into the language and culture of tech.

I have been particularly struck and humbled by the way women in this field build and cultivate community and are so welcoming of others into it. From what I’ve seen in the community so far, part of the reason this is true is because it takes a lot of support to make it as a woman developer. I have been so blessed to find amazing communities in Girl Develop It meetups, talking to women at community events, and all the great online groups for women. Let me just tell you, there are definitely women in tech. They are doing amazing work and often get overshadowed by the entire conversation about diversity. While there is still work to be done, sometimes I think that highlighting the work of those already there is also key to inspiring a new generation of women to study/stay in STEM.

Beyond all the direct support from family, friends, and my new community of women in tech here in Seattle, I’ve been surprised and taken aback by how many people have approached me since I put up this blog to give advice or connect me with someone who also codes. I have been struck by how much I get back by putting myself out there. I won’t lie, this past month since I graduated has been a little nerve-racking. I graduated from college with a degree in economics, I should be doing something besides washing dishes at a Jesuit house and staring at my computer, right? But here’s the thing: I love coding. I love the problem solving and that I actually get to build tools that will do awesome things with data. And I have the privilege and space given to me by a full-ride to college and a supportive and loving community of friends to keep at this and make something out of it. So I have to do that. It’s that thought, and writing, that keeps me coding.

Code on, and have a fantastic 4th of July weekend.

However! While your celebrating “independence” please remember that independence was not granted to everyone 239 years ago and the full rights and privileges of that independence are still not extended to everyone today. Some fun listening for this holiday weekend:

Howard Zinn & Democracy Now on Independence Day 

breathe in, code out

This week has been a jumble. I worked a lot at the place I wash dishes at the beginning of the week, and in between have not stopped staring at different things on my computer. I finished App Academy’s introductory materials and began to take their coding quizzes. I got through all ten “beginner” problems in one sitting, although it took me a while and I sure struggled. I felt so good after completing my reading but seeing

def Method
  #your code goes here!

really freaked me out. I took a breath in, and tried to breath out code. I was proud that I completed all the problems without looking at the answers. I mean I did Google (but only twice!) to find some techniques, but didn’t ever search out solutions. I was feeling a lot of euphoria completing the assignments and having all my tests go green. And then… I looked at the solutions. Compared to the solutions my code was a little wonky. Let’s take an example which sums a range of numbers (but you should already know that looking at the variable names I hope…):

def sum_nums(num)
  range = (0..num).to_a

and this is the solution they provided:

def sum_nums(num)
  result = 0
  i = 0
  while i <= num
    result += i
    i += 1

  return result

Meh… that doesn’t look much like mine, does it? And I assume it’s a much better use of principles as well. I think that right now when I see or hear a problem I could solve with code, my brain fires up the “panic! what do you remember to solve this!” engine and then I tweak and tweak until the specs come up green. This probably means I just need to spend more time with the syntax and logic (esp. loops) until it becomes much more natural for my brain. When I’ve learned languages in the past (Spanish, Latin, Yorùbá, Hindi), I’ve gotten to this point in drilling the basics where I start to dream in those languages. It’s hilarious at first because the dream is really only in partial phrases and incoherent statements. That started to happen with Ruby last night. I had a dream about a method I was trying to write, but for the life of me I couldn’t tell you what it was supposed to do. It was bizarre, but hopefully it means I’m beginning to get the hang of the language. Gah, this is too much fun.

In other code updates, I just finished the first level of Ruby Monk. It’s on to Ruby Koans next for more syntax practice. Funny enough, I actually completed Ruby Koans a while ago when a Ruby dev recommended it to me. I trotted along in it because the interaction on the CLI is pretty straight-forward, but to honest it really didn’t stick. I completed a whole section on RegEx without really ever understanding what I was doing. I’m going to now go through it again with better control of some basics.

In terms of IRL coding, I just finished a Girl Develop It course in Seattle. The course was on HTML/CSS which, while not programming, was fun and an awesome opportunity to meet some community members. In the CSS part of class I kind of realized… I’m not a big fan of design. I mean, I’m a HUGE FAN of looking at awesome design by others, but I just don’t think I’m personally cut out for that. This could change, but tweaking the colors and div sizes/margins/etc. was not the most fun. Data is the most fun. But this is all evolving.

In the mean time I’ve been thinking a lot about this idea of “Write. Code. Speak.” It’s the idea that not only should you be programming or coding, but also writing and speaking about programming, tech, social issues, etc. There already so much out there to learn and keep learning that also attending Meetups every week, writing a blog, keeping up with my online newbie community, and also you know.. making a living in Seattle can be overwhelming. However, this is what I LOVE about this community and world. Unlike academic economics, what I previously thought I may do, developers actually recognize and discuss these issues. I find this especially cool/heartening this morning, with the recent SCOTUS ruling and having a Twitter community to celebrate with.

Happy Friday! I just found out that Ada Developers Academy is opening up applications for their fall class so I’ll just be over here koan-ing and trying not to freak out from joy/fear/excitement.