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!
end

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
  range.inject(:+)
end

and this is the solution they provided:

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

  return result
end

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.

4 thoughts on “breathe in, code out

  1. this is one reason I love coding….you can work out a puzzle or task multiple ways and get the result you want. like obviously some ways are better than others and professionals probably code much more efficiently than me but at least my code is still working….for example if you want to repeat a whole section you should use a for loop, but you could actually use a while loop with an increment counter in some cases, and although it wouldnt be the right way it would till be useful 🙂 🙂

    Like

    • Thanks for your response! I totally agree about having multiple answers to every problem… that’s something I’m quickly learning. I am just trying to find the most efficient solutions to problems as well, which I know will just take tons of time to get right. It’s not going to happen overnight but that’s basically everything I want in a career… to never stop learning.

      Like

  2. “Meh… that doesn’t look much like mine, does it? And I assume it’s a much better use of principles as well.”

    Your solution is actually (IMHO) more ruby-esque, and shows good of ruby idoms and standard library methods. Iterating over something using while is almost never done.

    Their audience for that solution is ruby-beginners – people who may not know a whole lot about ruby. Using fewer high-level ruby concepts, in that case, is actually better for them.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s