Thursday, September 18, 2014

There's a first time for...

...editing and problem-solving within someone else's code. My first time with this was a few days ago!

On a quick visit to my brother and his family, my sister-in-law - I'll call her the client here - asked, "Hey, are you pretty good with HTML?" (Spoiler alert: HTML wasn't really the issue, but yes, yes, I am.)

She needed help with her job's website, which was built and maintained through CMS Made Simple. There was some content she needed to update, and when she tried it herself, she got an error and wasn't sure how to fix it. So that morning, while I wasn't playing with my niece, I was working out this puzzle.


The puzzle

Client's request: Add 1 line of content to 3 different pages of a website
Error: After adding content and trying to submit the changes (which did not include changes to the Name field of this file), an error comes up saying that the Name field is not in the correct format.

So, this seemed like a pretty simple problem. The requirements for the Name field were that they not have spaces or invalid characters; the files, as they had been operating, were named something like "Contact Landing - A," "Contact Landing - B," and "Contact Landing - C." I changed the names* to be in the correct format like so: "ContactLandingA." So that should work, right?

But then, upon saving the changes and refreshing the page, the section within the file disappeared all together. After spending some time trying different things, I decided to take a break and come back to it. And that's when it came to me - of course, since I changed the name of the file, I needed to update the file name wherever it was being referenced.

The next puzzle was to find where it was being referenced. The file I changed was nested within a global content section, and after some investigation, I discovered that it was referenced within a file in the templates directory. The format for referencing the file was one I hadn't seen before and didn't fully understand. I'm not even completely sure what language it was in - maybe PHP? There were curly braces, an "=" and a "$" and some files names, all arranged in a way I didn't quite understand. But I tried some things out, replacing a file name where I thought it made sense - and it worked!!

*Actually, I only changed the name of file A, but left file B as it was so that I would have a comparison - as far as I could tell, there was no version control system here, and I didn't want to break anything. I'm glad I did this - it was helpful as I went along to compare what the code was like before the change, and what the code with the error was. 


The prize

My reward for figuring all this out was, of course, my sister-in-law's thanks, but the best part was how accomplished I felt once I had solved the puzzle!! I have been learning to code for about 3 months now and I'm getting the hang of doing the codecademy.com tutorials, and I've been a little worried about what it would be like to stare down pages of someone- (or ones) else's code and figure out what was going on. With this small, but still sweet, success, I am more confident about jumping into mysterious code. 

Thanks for reading! Tell me about your first experiences working with someone else's code in the comments!

Wednesday, September 10, 2014

#=> "Social workers CAN code!!"


The story of how a social worker starts programming


At the start of Summer 2014, I decided to build my professional skillset and learn some programming. My partner of 9 years has been a programmer for about 5 of those, and so many people in our social circle also happen to be programmers. Currently, I’m at a professional crossroads, and I am choosing programming as the path that will allow me to simultaneously be creative in my work, connect with other creative and passionate people, and make positive contributions to the people and organizations I encounter - and maybe even the whole world! That said, social work is more than a job I had for several years - it is part of my identity and I think I will be able to apply some of my favorite things about social work to programming. Social work is about using a systems approach to support the person (or group or community, etc.) in front of you in achieving the goals they have set out for themselves. From being a "sponge" listener (before starting to program myself) in many dinner conversations with my partner and our friends, I already knew systems theory applies to computer programming. Of course - websites, web applications, databases, etc. - are all systems. Existing within and interacting with other systems. I love it already!
So I will be using this blog to document my learning, and from time to time I'll reflect on how my new learning as a programmer is fitting in (or not) with what I know as a social worker. After this first post, the blog will be mostly technical, with an appropriate amount of narrative reflection (I'm still a social worker!!).

A timeline of my coding journey so far:


  • Summer 2014: I found codecademy.com after being blessed in disguise (the grant that was funding my nonprofit social worky job ended). I began working on the HTML and CSS, and I was way more excited this time around. But when I decided to mix it up and learn some JavaScript in the middle of the HTML and CSS tutorials, I started to see how fun coding could be!
  • August 2014: Liking programming more and more, going to some meetups (queens_JS, NYC HTML5, NYC on Rails), and greeting my partner when he came home from work by saying, "Hi! How's your day? I have [x] [y] [z] questions about what I learned today." I already knew he was a great partner, and now I found out he was also a very patient, informative, and attentive tutor, as well!
  • End of August - early September 2014: Applied to Flatiron School!!!
  • September 2014: Wait in agony. Do the Flatiron prework. Mind blown by the command line - this has taken a lot of practice to get used to. Pretty confused by git, but I think it's coming together.
...and at this point, I'm diving into Ruby. I've been getting into the control-flow, practicing loops and iterators, and building hashes. And that brings us to THIS VERY MOMENT (literally, I'm switching windows between blog-writing and Ruby codecademy-ing).

I've just been introduced to one-line if and unless statements, and am now meeting ternary conditional statements. It is helpful how codecademy builds up by spelling things out with longer, wordier versions of code, and then says, "hey, by the way, there's actually a simpler way to do this."

I am off to keep learning Ruby, but I leave you with this, the very first ternary conditional statement that I just wrote:

soc_wrkrs_can_code = true
puts soc_wrkrs_can_code ? "Social workers CAN code!!": "You need to check your boolean. "