SP Apprenticeship: Day 51

This is what my cart looks like now!

This is what my cart looks like now!

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

It was a challenge to get back in the flow of things yesterday after two days at a conference! I did finally manage to get my params in place so that I can change the total on a book when I add it to my cart. I still can’t edit the cart once I get it in there, but Brandon told me that would be more challenging than I thought, and he was right. I also did some styling so now it’s much clearer to read. I had a complete brain fart when it came to naming my headers and I couldn’t find a website that broke it down like that. ‘Cumulative price’ is terrible, I know, but it’s all I could think of. Anyone have any other suggestions? Maybe ‘line item total’? Meh. All my programmer friends have told me at one point or another that naming things is the most difficult part of programming, and it’s really true. Naming models and methods so that it’s clear and makes sense later when you’re refactoring or fixing something — it’s hard!

Today I am meeting a student in the current cohort of TIY for coffee; she wants to talk about my experience since I finished. I find it kind of interesting that Mason keeps sending these people to me, I certainly don’t mind, but I haven’t really hidden my complaints about the way TIY does things. I figured that I would be the last person that anyone sent students to. Although now that I think about it, I haven’t been asked to talk to any prospective students. Heh. Anyway, that’s at noon, then at 1 we’re having a retrospective about All Things Open, and then after that I’m pairing with Brandon. I have three things I want to get done this week:

  • Add a link to my cart in the corner of the homepage so you can access it without adding more books
  • Get the quantity incrementing to work and save
  • Complete at least one feature file in my cucumber tests

I’m going to ask Brandon to help with the incrementing, it really is proving super challenging. Once I get this cart stuff done, I think next week I can focus on adding Stripe and making it work, which will hopefully be easier than it was for David, since the first thing Brandon did was get rid of Turbolinks, and then I’ll be done and ready to start my pairing tour!

I expect to learn that the incrementing problem is probably going to be only a few steps, but they’re going to be non-intuitive. I’m not even entirely sure where to start with the cart, there are like four problems I have to solve there: getting it to show on the home page, positioning it where I want it, getting it to show the current number of items, and getting it to update when I add or remove something new. Should be interesting!

SB Apprenticeship: Day 50

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

So, as you might have guessed by the picture, I spent the last two days at the All Things Open conference in Raleigh. Most of the office ended up going and we sponsored a Front End track, so we were really visible and it was a lot of fun. It’s always a tough choice at conferences — do you go to the talks that sound super interesting, or do you focus on the ones that are actually relevant to your job? I tried to strike a balance, so I went to a talk on Computational Linguistics and natural language learning, and then I went to a talk on using Ember. Most of the talks were really good, but I think this conference has a wee problem with the descriptions of the talks not actually matching the content. There were also several that ended up just being advertisements for the company of the person speaking. Also, in the vein of my general t-shirt disgruntlement, the conference not only didn’t offer any women’s t-shirts, they didn’t even have any small men’s shirts on offer. I spoke to the organizer after the final keynote and emailed him the awesome Geek Feminism wiki article about t-shirts, so hopefully next year I’ll actually be able to show off that I attended.

Today it’s back to the Bookstore grind. I caught a cold from my boyfriend last week and ended up going home early on Friday and living on the couch all weekend, which means that I have, sadly, broken my streak of Github commits. 😦 I’m feeling much better now, though I’ve entered the non-stop coughing phase, so I sound way worse. Anyway, today I want to focus on the quantity field of my form and figure out why it’s not saving when I change the quantity and how to make it update price and total after I do.

SB Apprenticeship: Day 49

Shopping cart: new and improved!

Shopping cart: new and improved!

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

Yesterday was a good day! I got everything on my list done except for working on the feature tests, and I did the majority of it by myself! So now my cart shows multiples of a book on the same line, with a unit and total price and it sums all the books in the cart. You can delete the cart, and go into edit and delete a single item.

Editing the cart

Editing the cart

I got all of this done mostly by following the Agile book, which according to Brandon did some weird things, but mostly got the job done. It was weird, I had it working except the editing part, then Patrick was trying to help me with that part and something broke that screwed up the entire thing. I kept getting a undefined local variable or method `params' error, which was really frustrating and led to me literally pointing at the screen and going “THERE THEY ARE!!!” which of course didn’t work. Brandon and I paired in the afternoon and it took him some time to figure out what was going on, which made me feel better. I’m not sure if it’s a function of being a programmer, or just another sign of how cool this office is, but to my infinite amusement no one even looked twice at me yelling at my screen.

Today I’m going to make the Quantity box work. I want it to populate automatically with the quantity of a book that is in the cart (so, like, if there are two of the same book, I want it to say 2), and I want to be able to change it and have it save. I’m also going to add a link to the cart in the corner of the homepage so you can see what’s going on. If I manage to get all that done then I’ll start working on the feature suite.

Brandon said the incrementing of quantity is going to be harder than I think, so I expect to learn what that whole process is. I guess I won’t finish the bookstore this week, which is kind of a bummer, but next week is a definite go. I have a conference that I’m attending on Monday and Tuesday, but the next three days will be productive and awesome.

SB Apprenticeship: Day 48

I got the shopping cart working!

I got the shopping cart working!

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

Well, after a lot of bashing my head against it, I got the shopping cart to work! And it persists! And I can change the quantity of the books I’m adding! It doesn’t sum up my order, but by the time I got the cart working I was super done for the day. I don’t know why it says “Line item was successfully created” twice up there, I think I have too many notices going on, but when I was trying to get it working last night I would either have two or none. I think maybe the Bootstrap stuff we did is having some effect on it, since the top one is in a blue box. One of the things that I found really frustrating when I was working on this is that there doesn’t seem to exist a simple bulleted list of how to make a shopping cart in Rails. There are lots of tutorials, but they’re generally part of a pre-existing project where the author has had you make models and controllers with an eye to the eventual goal of adding features like a shopping cart. I’m pairing with Brandon today, and I think I might get him to go though it with me so I can feel less frustrated next time. Sadly for me, shopping carts are on the web to stay, so I should figure out a better way of doing them than the hodgepodge of tutorials and suggestions from other people that I currently have.

Today I actually made a list of things I want to accomplish.

  • Make my cart sum my order
  • Add a link to “Jessa’s Bookstore” to make it go back to the index when you click it
  • Figure out why the alert is showing twice
  • Add ability to delete a book from the cart
  • Work on the feature tests for the shopping cart

One of these is easy, and I shall do that first. 🙂

Hopefully I will end the day with a list of how to make a shopping cart (I wonder if that would be worth a blog post? Maybe I should suggest it to Ellen.), as well as a completely working shopping cart. Provided that happens, I think I can work on Stripe tomorrow!

SB Apprenticeship: Day 47

Shopping cart

Shopping cart

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

I got ahead of myself in yesterday’s post: before I start worrying about Stripe, I get to implement a shopping cart! I’ve only actually done this once, when I worked through the Agile Web Development book, so it’s proving a challenge. I was trying to work through the book and just kind of take what it said and apply it to my code, but the models and stuff are completely different, and I’m having a hard time figuring out where to put stuff, and what in the code that the book has I actually need vs the stuff they’ve done in order to have their idea of an impressive app. For instance, do I need to make mine all Ajax-y? I would love to impress Brandon, but mostly I just want to get this done. Ah well.

Today I’m going to continue working on the shopping cart! I’ve been trying to ask fewer questions; Brandon and Joe pulled me into Brian’s office Monday to tell me they were a bit concerned about how I seem to give up easily when I run into a problem. It’s interesting, I know so many devs who seem to take a perverse pride in spending days beating their head against a problem. I can see how I could spend more time beating my head against a problem — if nothing else, the sense of triumph if I solve it is tremendously empowering — but generally speaking I feel like I shouldn’t waste time on something that a colleague could answer in five minutes. I was telling them that part of my problem is that I haven’t quite figured out what I should be asking about and what I should be being frustrated about for a while. I’ll come up against a problem that looks really hard so I’ll ask about it, but then it turns out to actually be something simple. Then when the next problem comes along, I don’t super trust my instinct on these things, so I’ll be like, ‘oh, that last thing I thought was hard turned out to be easy, so I bet this one is easy too.’ I’ll spend two hours trying to solve that one, only to have the person I eventually ask for help be like, ‘Whoa, that’s a tough one.’ If you believe that willpower is a finite resource, I think I use all mine up early on problems that shouldn’t be as taxing as they are. Ah well. I do trust that when I’ve exhausted my knowledge and Google, I can ask questions, I think their point was simply that I should do those other things first.

Anyway. Yesterday I got the ‘add to cart’ button to show up on my page, but it was at the top, not on each book, and now it’s randomly gone. So that’s going to be the first thing I focus on today.

SB Apprenticeship: Day 46

Stripe! Dun dun dunnnnnnnn

Stripe! Dun dun dunnnnnnnn

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

Yesterday I made my goal! I finished the book index page feature! I had a really hard time getting the search to work, there were like 20 different steps and the answer I found on SackOverflow turned out to be wrong, so I went down a rabbit hole for a bit. But I got it working, with the help of a couple people around the office. It’s always something stupid, like the case doesn’t match, or I didn’t add the click action to the test. Sigh.

Today I’m going to start working on the purchase feature. It turns out I’m not actually behind on the bookstore app; I thought I had three more features to complete, but one is a general test suite that I added myself to have it log in outside the structured tests, and another was added by the Devise gem or something, and is just a completed test suite. So all I have left to do is the purchase feature! I guess now I’m learning Stripe. Woo! Poor David had a hard time implementing Stripe, but I have the advantage of going second, so I have little tips that should hopefully make it a lot easier. Like getting rid of our old friend Turbolinks. Heh. Apparently the Stripe documentation is really good, so I’m hopeful that this will go smoothly.

I expect to learn how Stripe works! We did a little with APIs in code school, and I had the ToDo API here, but I think this is the first real API that I’ve added to a project, so I’m a little nervous.

SB Apprenticeship: Day 45

Now it's prettier! And paginated!

Now it’s prettier! And paginated!

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

David’s begun his pairing tour! He’s leaving meeeeeeeeeee! Heh. No, seriously, he finished the bookstore app and is now embarking on a tour to pair with a bunch of people around the office. I’m a bit behind on my bookstore app; which makes me a little sad. We’d been pretty much neck and neck for the first part of the apprenticeship. I’m very curious what a pairing tour entails, though, so I can get the scoop before I start mine. Good luck, David!

Friday Brandon and I paired and worked on some styling for my bookstore. I learned about Bootstrap, a front-end framework that makes styling a whole bunch easier. We didn’t learn it at TIY because Mason said that has been overused in recent years and you can super tell when something has been Bootstrapped, but for these purposes, Brandon said it was fine. No one besides him is going to even see the bookstore app.

Today I am going to hopefully finish the book index page feature and move on to setting up email. I’m going to the gym at noon and have a blog meeting at 2:30, though, so hopefully that doesn’t throw me off track. This is a relatively short feature, so here’s hoping it goes quickly!

I expect to learn how to get the pagination gem working! I thought it was, but that test is listed as pending, so I guess it didn’t? Sigh.

SB Apprenticeship: Day 44

The slackbot tells Rob to do pushups, Rob tells the slackbot to screw itself.

The exercise bot went over better than expected!

Oh man, the exercise bot was a total hit! Seven new people joined the health_fitness channel, and when I got in this morning someone asked me when I was going to start it up before I even got to my desk. So yay! Today during Labs time Brandon is going to help me put it on the office computer so no one has to rely on me being at work. I think it’s also made me a little more motivated to work out in general; I went to the Y yesterday after work and then walked to work this morning. The fall weather is perfect for walking, and I just started following the Welcome to Nightvale podcast, so I have like 70 episodes to listen to on the way, so it’s perfect!

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

Yesterday I learned how to integrate the Factory Girl, Faker and Kaminari gems in order to have fake data for my Cucumber tests to paginate. I’m not quite sure Kaminari is working right, but I’m also not quite sure that I’ve written the code right, so I’ll figure that out today.

Today Brandon and I are going to pair this afternoon. I think the plan is to put the Slackbot exercise bot on the SB computer and then work on the bookstore, but that could change. Kevin’s office is having a beer:30 thing this afternoon that he invited me to, apparently they have way too much alcoholic root beer left over from the recruiting event that they had earlier this week and need people to help them drink it down. See how selfless and giving I am? 🙂

I’m not sure how we’re going to put the exercise bot on the work computer, so I’m looking forward to figuring that out. I think it might involve SSHing into it? But maybe not because I don’t think it’s a server? Maybe VPN? Maybe I’m just throwing out initialisms in the hope of sounding intelligent? (Did it work?) Anyway, I expect to learn how that works today. It feels pretty cool to have a plan to do something during Labs time besides work on apprenticeship stuff. I’m contributing!

SB Apprenticeship: Day 43

Torturing my coworkers...bwa ha ha!

Torturing my coworkers…bwa ha ha!

So this is totally irrelevant to my apprenticeship, but earlier this week I read an article from a mobile design and development studio in LA about how they made a bot for the messaging app Slack that forced them to work out. It has five exercises that are easily done at your desk: pushups, planks, wall sit, chair dips and calf raises, and every 20 minutes or so it randomly chooses three people and an exercise. I thought it was fun, and posted the article in SB’s health_fitness Slack channel, kind of hoping that someone would take the initiative and add the bot, but, while people thought it was interesting, no one stepped up. Last night some friends had a hack night, and when I was debating what to work on, I thought — well, why not? It’d be a fun, somewhat easy project to get it running, and if they didn’t like it I could just turn it off. The instructions, posted on Brandon Shin’s github, are pretty clear, but this was my first foray into Python, so there were some extra steps that I had to go through. Kevin helped me make a shell script to make it easy to run it, and we were off! So far this morning the exercise bot has been into calf raises — it’s picked it three times, but, as a coworker said, true random will do that sometimes.

Everyone in the fitness channel seems enthusiastic about the bot; one person left the channel, saying he might be back when he’s less buried and grouchy. I think everyone has done the exercises so far. I read so much about how terrible sitting is for you, and I basically sit for like 22 hours a day, so I thought taking a minute or so every now and then to do some exercises could only help. In his blog post, Brandon Shin said that they’ve seen a lot of benefits from it:

Our productivity has been through the roof. It gives a great little breather when your focus is getting a little too narrow, a little extra circulation, and keeps you just a little more energized throughout the day.

We currently have 13 people in the channel — I’m hoping this motivates more people to join!

It was a weird process to decide to do it, there was definitely an aspect of both could and should I do it — I’m only an apprentice, I don’t want to annoy people, oh god this is Python, can I even get auth tokens from Slack since I’m not an admin user? Smashing Boxes encourages a kind of entrepreneurial spirit, though, that’s basically the entire point of Labs Day on Friday, and, well, as Adm. Hopper said, “It is better to beg forgiveness, than ask permission.” I’m not sure what I thought would go wrong, like maybe worst case would be I somehow screwed up Slack. That would be bad; we rely on Slack for everything from notifying people about code reviews to gathering groups to go to lunch. But I felt confident that, even if I did royally screw up Slack, the level of talent at SB would probably make it trivial to fix.

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

I did actually do work yesterday, despite the 500 words I just wrote about an exercise slackbot up there. 🙂 I figured out why my book index page was refusing to create books — I was using a gem that wasn’t on that branch since my admin branch hasn’t been merged into master yet. Ta daa! Usually my pull requests are taken care of pretty quickly, so I decided to work on the blog kata while I was waiting. There were a ton of pull requests yesterday, so I ended up finishing it. I had to go back and use a tutorial for a little bit since my database just refused to save posts and I couldn’t figure out why, but I did get it done. Still haven’t worked on the bowling kata, my head just refuses to grasp the scoring system, which makes it kind of impossible to program a thing to keep score.

Today I am going to hopefully merge my admin branch into master and work on the book index page. A friend suggested a gem that apparently makes pagination super easy, so I’m happy about that. It seemed to take David a long time to get that right, so hopefully Kaminari makes that a little less stressful for me.

I expect to learn how to set up my database to index, paginate and sort books! I think I may also get someone who knows Python to help me fiddle with the exercise bot a little; the last exercise it told us to do was a 55 second plank, which is kind of a long time for the first time it’s telling us to do it. I also need to remember to bring my old yoga mat in, we have cold concrete floors that are not good for exercising!

SB Apprenticeship: Day 42

Hack hacky hack hack

Hack hacky hack hack

  • What did you learn yesterday?
  • What are you going to do today?
  • What do you expect to learn?

So I spent several hours on that problem I mentioned yesterday, where I couldn’t figure out a way to make Capybara-Webkit acknowledge that a modal happened, before I asked Derek for help, and he told me to just force it to return true and call it a day. Sigh. This is another of those times when I shouldn’t have waited so long to ask for help. Ah well. I did manage to finish that feature file and started to move on to the next one, but my head started to hurt and so I read some of The Clean Coder instead. I gave up soda this past weekend, and have been having intermittent headaches since. Caffeine’s tough, man.

Today I am going to tackle the book index page feature for the bookstore. It keeps getting hung up when I tell it to create books, and I got frustrated with it yesterday and put it aside, but today’s the day to figure out what’s going on. I think I’ll also read some more of the Clean Coder, I’ve fallen behind on the books we’re supposed to read.

I expect to learn that I’m probably forgetting something simple with the create method in my code. This feature also requires sorting, pagination and searching. I’ve worked some with sorting and searching, but never with paginating, so hopefully that won’t be too hard.