< prev 12 Dec 2014 to 1 Dec 2014 next >

Posts from December 2014

  • Week 5 Day 2 - Rails shooter

    Today: solo day

    So, we had the assessment today, which last cycle suggests was one of the hardest ones we'd be seeing, and it went alright. From Sunday where I was almost in tears in frustration at the authentication model, to today, where I was not only able to complete the assessment, getting all segments to pass individually on the third try (initial write, first debug, final run) while understanding what I was doing and not just writing things from memory, was huge. I know that others were faster, but for my own sanity I have to pretend that they were just coding from memory and not thinking about what they were doing. :)

    We moved on to RailsLite, which was … interesting. These problems composed of partials are a nightmare to work through, though, because so much state that would be contained in a single file normally ends up instead fragmented across multiple files, and because I personally am not good at maintaining mass state like that, by the sixth partial I was lost. No part of the model itself was particularly difficult to grasp - we spent most of the day reading WEBrick documentation or Wikipedia articles and then writing one liners that didn't make much sense in isolation…

    I can't say that this project was the best use of our time, but it was nice to gain some more understanding of how a HTTP request is handled in a dynamic manner. Writing a real Rails clone from spec/scratch might have been easier, albeit not a project for a single day. Oh well.

    Tomorrow, we're on to Javascript, which has some weird behaviors that I'm looking forward to learning but not looking forward to fucking up on.

  • Week 5 Day 1 - Making my peace

    Today's partner: Ben

    The project today was sort of forgettable, like the last couple days. It's been good to get so much practice with Rails, and today was fun - we used Capybara to write integration tests, then wrote code to build the appropriate elements and views to pass those tests, learning a lot about how Capybara and integration testing work in general - but it was another one of those days where ultimately I'll forget what, specifically, we did.

    Everything is just forming into a big ball of stuff in my head called "rails knowledge". It's kind of cool in one way, but in another: we're halfway through the curriculum, and a lot of it is a blur.

    Story time. When I was in AP Calculus, I had a hard time keeping up with the class, but the AP test was a solid wall in front of me that was a) well-defined, b) had plenty of information available and c) had important consequences. So, the week leading up to the test, I gathered as much practice material I could, and then in the two nights before the test, I cherry-picked the problems I was having the most trouble with and did them over and over until I could do them easily.

    The repetition drove the ideas into my memory, and to this day I can understand the concepts of calculus due largely to the intentional practice with a clear goal provided by that exam.

    In the past year or so, I've come to understand that my primary advantage compared to others is my memory. When I have sufficient context and sufficient reason, I can remember just about anything quickly. When I don't have reason, context, or practice, I'm just an average person, sort of.

    So with this rails stuff, I spent most of last night—the parts where I wasn't doing readings or tumblr posts or whatever—doing parts of the practice assessment, and came in this morning ready to graft more knowledge onto what I had been getting comfortable with. We were still slower than others today, but the difference is I didn't really care. We worked well together, our tests worked well, we wrote the auth model in under an hour (give or take), and we got a lot of knowledge, both core and ancillary, out of the lesson.

    Sure, I can look at the bonus work and look into "completing" this project perhaps over the weekend, but really what will I gain? If I am able to do the things that these projects ask in a more synthetic context - creating polymorphic associations, writing tests with good coverage, etc - then what am I really missing? It would be like going back to try to re-do the test you failed in the third grade… of course you'll be able to pass it now.

    This program, and TDD in general, really make me consider some things about how we educate in this country. You don't generally test every possible route through your application; instead, you perform unit tests on individual models, then you perform integration tests on inter-related structures. The former model would involve something like n^m tests, whereas the latter demands n+m tests - where n is the number of "objects" and m is the number of "relations".

    When educating, you don't need to test to see if someone knows how to multiply on a boat, how to multiply with a goat, how to multiply nine digit numbers and ten digit numbers and eleven digit numbers… you need to see if they know how to multiply digits, then to perform carry rules, then to do more complex operations… perhaps curricula should involve unit and integration testing, like TDD. It certainly feels like a/A is doing this with us.

    Tomorrow's another solo day, but more importantly it's the day of the assessment. I plan on doing it at least once end-to-end, and maybe focusing in on re-doing a couple hotspots before 9 am, but I'm feeling remarkably comfortable with myself at the moment. Let's see if it lasts.

    Two more days until the weekend, and more studying. :)

  • Week 4 Day 5 - The tyranny of the ☃ (snowman)

    Today's partner: Carl

    Interesting day. We made a lite version of reddit—no styles, just users, "posts", and comments. It was straightforward, as seems to be usual for rails.

    Auth took maybe an hour and a half, total, but still we weren't able to finish everything before time. Everyone I follow on tumblr seems competent, which maybe sways my opinion, but I have to remind myself that I'm not talking to everyone, and the people I followed I am doing so because they seem to be ahead of the curve. Still, it's a bit disheartening.

    I don't feel like I'm missing anything, but I wonder what makes us different. I certainly spend more time learning about the toolchain (shortcuts, snippets, and random questions) than my peers seem to, but every day I feel like I'm slipping a bit. I don't mean to make this the Debbie Downer tumblr, yet at the same time I can't help comparing myself to others.

    Another thing - the last half of any given project seems to be a walk in the part, in comparison at least, but when I see "half" the project instructions lying ahead of me, it's hard to believe that I'm doing well.

    Hopefully my partners are getting a lot out of working with me.

    Meanwhile, we had a fun diversion after 6 pm, trying to figure out who was accessing our (locally available) programs and creating users named ☃ and inserting ☃s everywhere in our databases. Zach, Wes and I tooled around a bit to try to figure out if it's possible to trace who was the cause of the tomfoolery, but it turns out WEBrick doesn't log incoming connection IPs by default. Derp.

  • Week 4 Day 4 - "The worst part about solo days is your partner"

    Today: solo day

    The project today was solo.

    Besides seeing that, still, I need to practice more, there wasn't much that was tricky today. Everyone else in class seemed to be progressing much faster than I did - and given how many people got to the bonus material before the end of the normal class time, I know I can do better. Or should.

    The thrust of today's work: make a rails app that does the standard stuff for user creation and session authentication, and then create bands, albums, and tracks, then permit users to comment on tracks, and so on and so on… nothing earth-shattering. The migrations and models are old hat by now, controllers are pretty straightforward, there's still more to be learned about creating proper views… but it's very evolutionary.

    Again, nothing was tricky: left to my own devices, I almost never need to ask the TAs for help. I can't tell if this is a bad thing. Carolina remarked, early into working at my last job, that I need to learn to ask for help earlier in the process of trying to attack a problem, and maybe she's right, but I never feel in over my head, just slow.

    Nonetheless, by 4 pm I was moving at a steady clip, and was knocking out stuff left and right. Honestly, I was trying to be slightly too abstract before noon (creating partials that didn't need to exist in ways that didn't make sense) but by 4 I was doing a lot of rote fixing of the same stylistic flaws across three or four or six different files. When would have been the right time to refactor? Some of what I was doing needed to be done right then in order to test functionality; other stuff, not so much.

    It's all very engaging, which is a plus, but there's only so much more time I have to commit to this. Ned or Kush said that we should be committing 80-90 hours to a/A, and that works out to about 12 hours a day doing something a/A related. If I get there at 8(:15) and leave around 8 pm on the weekdays, I'm getting well toward 80-90 hours per week, but then I could be doing more on the weekends to round it off. Does that 90 hours count lunches? Does it count time not actually in front of the computer?

    One of the weaknesses of the pair programming model is that if you're thinking about one half of a given project and your partner is thinking about other things, it's possible to not quite totally learn something you'll need to know. After typing BCrypt::Password.create(password) about ten times Friday, I wasn't able to remember that string of tokens today. This might be problematic.

    As I knew before applying, one of my weaknesses is syntax. I seem to have the architectural details overall pretty solid, but I spend five minutes here and five minutes there playing with the syntax of a command, first trying to make it work, then trying to make it better, so as to not have to pay technical debt down the road, and what I do learn I learn very solidly. But I just don't have the speed yet.

  • Week 4 Day 3 - 99 cats for rent on the wall, 99 cats for rent...

    Today's partner: Julian

    Today was all about authentication. Well, in fairness, we spent the first hour or two finishing up yesterday's work so that we could move on to authentication will all our pieces in place. Further, we dismissed early, so we were short about three hours total to work on this. We didn't finish on Friday, but it was time well spent, and I hope to be able to finish what we started this weekend. After all, the assessment this week is on authentication…

    Nevertheless, it was a fruitful day. My partner and I spent a good deal of time sorting out what the phases of the authentication process are, and using a SessionsController we were able to successfully start a session and verify a user's password and all that fun stuff. I know we haven't seen all there is to security, but with CRSF protection and SQL parametrization, and good use of BCrypt, most of the things we need to know about basic security and authentication issues are now part of our toolkit.

    It's nice that so much of what we have to work with to get a "good" website are easy. I keep a mental tally of companies that have lost their passwords and had other security breaches, and so all of this is extremely relevant. If we end up working on anything remotely successful, the odds that we'll have a password breach are basically 100% over a long enough timeframe, and doing what we can to protect our users is just good practice.

    I'm not sure what else to talk about. The curriculum progression is pretty good—I never really feel like we're doing busywork, nor do I feel like I'm half under water, which says a lot both about the curriculum and the selection process. There are only a couple people in the class that I am ever concerned about; it seems like most of us are absorbing everything as it's thrown at us, which apparently isn't always the case at this kind of program.

    I have occasional worries that finding a job will be difficult, because everything we're learning seems… it seems like anyone with sufficient motivation and a little brains could pick all this up. I'm hoping that I'll be able to stand out, and that otherwise good companies have dead weight that they want to replace :) Or something.

    Other things - sleep continues to be a challenge. There's always something to do, either at home or having to do with the program, and I feel like I could always be working harder. I'm not falling behind in any way, but I know I could be better. This is especially true when I notice other groups maintaining a faster clip than I've been able to. sigh

  • Week 4 Day 2 - I don't even see the web anymore, all I see is GET, POST, DELETE

    A propos of nothing in particular, I am known as the shortcuts guy.

    Actually, that's not quite accurate… with HTML being as verbose as it is, today quickly became "snippets day".

    For those of you who are unaware, snippets are short bits of text which, when followed by a <tab>, autocomplete into a common pattern. So today was filled with a bunch of things like opt<tab> turning into

    1
    
    <option value="option">option</option>
    

    or =<tab> turning into

    1
    
    <%=  %>
    

    which are both really annoying to type normally, but super-easy to deal with when you can get them in a couple keystrokes.

    Why does this matter? Today was all about views, which generally entail setting up proper routes and controllers (as mentioned yesterday, and which happened much faster today), and then generating dynamic HTML using .html.erb (Embedded RuBy) files called by the appropriate RESTful controller. So the faster the code comes out of you, the more time you can spend thinking about the crux of problems solving instead of typing. Just writing out the sequences of shift/non-shift characters can give me conniptions… which might be good practice, because I've noticed that I never learned to properly use the rightmost two fingers on my right hand while typing. I should probably only try to learn one thing at a time.

    Anyway, so I was concerned that doing views would be really tedious, but Ruby is so DRY (Don't Repeat Yourself) that it's actually quite fun to write a good view method, even though it can be awkward inserting erb inside proper tags, interlaced with html. And since you're trying to avoid repeating yourself, writing good dynamic HTML can be quite a fun little puzzle to put together…

    So, all in all, views were much more fun than I expected, and the backend—migrations, models and controllers—were much easier the second or third or fourth time around.

  • Week 4 Day 1 - ASSUMING DIRECT CONTROL

    Today's partner: Mark S.

    Today was all about Controllers. Well, and ActiveRecord relations and SQL queries… first things first.

    The assessment went really well, I believe for most people, but especially for me. I did the practice assessments two (and a half) times, and when I came in this morning asked my neighbors what they had done to practice. One had a really good suggestion—look for foreign keys early on, in the schema.rb file, and then implement the belongs_to relations based on those keys. With this hint, a bit of practice, and a much greater understanding of SQL, I didn't really have any issues with this assessment.

    The readings last night were a different story, and I was really worried about how the day would play out. I knew coming in that today was going to be about the C of the MVC paradigm - we've covered models, we'll get to views tomorrow, and we were doing controllers today. But none of the readings we had to do made it clear what, exactly, controllers would consist of. I sort of struggled through, and collapsed into bed.

    Well, this morning, it was much more clear. During the lecture, Jonathan and Constance showed us a lot of the same stuff we saw in the readings, but watching it live, it became clear how it was going to fit together. REST combined HTTP verbs with URIs to produce a variety of different responses… which are handled by the routes handles in routes.rb and the controllers generated by rails.

    There's not a lot to say about the controllers themselves—you define them in a predictable way, they have actions defined in an easily readable way, and you write those actions in pretty predictable ways.

    Ultimately, because rails is actually pretty sane, learning more about controllers teachers you a lot about generating, models, and I presume views… in addition to me focus on learning snippets, shortcuts, and so forth, it feels like we're really picking up speed. Or at least I am. But looking forward at the readings, there are certainly a lot, and it's clear that having a repeat of today—hard work, but valuable—will require sticking to the readings and making sure I'm ready for the next day.

  • Week 3 Day 5 - define_method(:meta_program)

    Today: solo

    As others have remarked, because of the holidays, the weeks and days are just pointers to lesson plans, and not actual days and weeks. I actually got to the end of the day yesterday and asked someone "what day is it?" honestly hoping that they'd say Wednesday. It felt like a Wednesday.

    It wasn't Wednesday.

    (week 4, day 2)

    Today was all about meta-programming, centered around the ActiveRecord Lite pet project. Real ActiveRecord does a lot of the work of writing repetitive code for you, and our toy AR did a lot of the same things, albeit not as gracefully. Meta-programming itself revolves mostly around defining methods at runtime that build out in predictable ways, so you can do all that cool stuff for free.

    It's actually quite nifty, if only you are able to keep track of who will be calling each of the methods you write and where. In essence, Ruby offers faculties that permit you to give methods to a class or an instance (or an instance of a class…); variables can be local, or belong to the instance, class, or class instance… I'm still not totally solid on all the distinctions. My coding style today was essentially "keep changing whether you say self or self.class or self.name or nothing at all until the damn thing passes."

    Aside: A potential project for a later date would be to make a simple file full of classes, instances, and modules, and see how different things behave and what they think they are. To wit: I could make a Module that extends a Class, and see what that module's methods say they are, and then include the same module in the same class and see what the methods do when they're called by instances of the class…

    A huge part of reading and understanding code centers around being able to simulate system state in your head, or at least to scan idioms and interpret them subconsciously. Like reading English, you can only leave so many pieces as null references, hoping to pick up their meaning through context, before the main idea of the block is completely lost.

    Anyway, so I felt like I was lagging all morning, and yet again, once lunch had passed I picked up a lot of steam. (There's gotta be a better way to get through the morning doldrums!) I managed to complete the exercises with five minutes to spare, and it felt really good.

    I was much more patient and thoughtful today than during Checkers. At lunch I thought this post would be starting with a discussion of my demons, but being aware of them and having to face them a solid day at at time seems to be working.

  • Week 3 Day 4 - What the SQL?!

    Today's partner: Eva

    The assignment today was deceptive. It began simply enough—with me completely forgetting everything I learned about ActiveRecord last week. Wait, back up.

    Today's assignment expanded on what we learned about ActiveRecord before Thanksgiving. It took a little bit to warm up, but thankfully Eva had done enough practice to get me on track quickly. It was a lot of boilerplate: has_many( :method_name, class_name: "Blah", ...) (which is a bit annoying, because of course the solutions all use the more succinct forms of relations), which seems somewhat typical of this phase of Rails.

    The project centered, again, around a standard online trope: the survey. Polls, Questions, potential Answers, and Users and their selections from these answers. The core work: outlining the migrations, defining the initial validations and relations, and adding indices all went smoothly, and we were done with the core logic that was demanded of us (mostly custom validations) well before 2. There was a bit of tricky SQL and ActiveRecord Relation syntax (not logic, per se) that we struggled with, but overall it was very smooth.

    … and then came the Bonus work. Four hours of bonus. Holy mother of god, there's some convoluted rules for what can and can't be put in different places in a Relation. (joins can't take parameters… wat.) However, I gained some respect for the power of building queries step-by-step, especially when Eva and I stumbled across the finish line and read through the solutions. One of the validations we struggled with was addressed by defining the SELECT logic and the JOIN logic separately from the heart of the SQL statement, then glued everything together, firing off a single db query at the last possible moment. Pretty neat.

    I'm a bit concerned about the upcoming assessment (this Wednesday, although I need to do at least one practice run tonight) because it's clear that it takes me a minute to spin up when it comes to starting work in Rails. I have time to practice, and as long as I make use of it, I should be fine.

< prev 12 Dec 2014 to 1 Dec 2014 next >