The Importance of Taking Breaks while Coding

Overcoming a complicated bug or seeing your app finally come together constitutes a well deserved celebration. Now, you don’t have break out the wine and throw a lavish party, but I strongly believe indulging in these small little accomplishments is a healthy practice. When you’ve spent a hundred hours to fix a bug and get the application to function as expected, I encourage taking a small break.

For example, this past weekend I was putting together the styling for my app. I don’t have a creative bone in my body, so I found a theme and started incorporating it. Up to this point, I’ve been neglecting my styling as my main goal is to learn Ruby. I’ve been relying on Bootstrap just as a tool to help make my app a little more bearable. So as I started putting on the CSS files and using the different classes in my views, it was rewarding. I was able to do most of what I wanted to do from a backend perspective, so the fun part of seeing the frontend was exciting. The different layouts and buttons brought my vision to life and was even more encouragement to keep on going.

So what did I do when the main pages and functionality was built? I took a break. After hours of putting everything together and neglecting my family, I closed my Mac and used my free time playing video games, with family, and not thinking about code. Most developers will agree that when you come across a particular bug or add an enhancement, you’re truly not contempt until it’s finished. You’ll spend hours/days/weeks on these tasks, only to have another one right at your door.

I know it’s hard to stop when you’re on a roll, but separate your tasks into small sections. When you complete one, take a break, because I guarantee you that more frustration and long, isolated hours will come.

My Weeklong Issue Fixed in 5 Minutes

Anyone who is self-teaching Rails understands that there are definitely major pain points that can’t be relieved by Google searches or StackOverflow questions. As great a resource as those two are, they simply don’t dive any deeper than junior-level knowledge (in my opinion). Most of the questions on SO are from new learners and most of the blog posts only scratch the surface of the topic they’re covering. The Ruby community is known to be a self-taught one, learning from each other. You won’t find low level classes at any of the colleges or other academic institutions, at least nothing that covers Ruby as intensely as C++ or Java.

All that being said, I thought I had a simple task. All I wanted to do was search multiple columns in one model, by an associated category. I spent a week asking a question on SO and doing all sorts of Google searches. I went through all the gems (Ransack, Searchkick, and Sunspot/Solr). I even tried learning a little more about Elasticsearch, but decided against it because it’s almost another language completely in its own right. For whatever reason, I couldn’t find the solution. Or, if one was presented, it didn’t work.

I spent nearly a week trying to do what was seemingly an easy task. I just wanted to search my model that’s in a specific category! I spent most of my free time, time that I could have spent with family, in frustration. Thankfully, the weekly Rails Meetup was around the corner. Lead by a few savvy Rails folk, I was able to get one of their attention and explained my conundrum. After 5 minutes tinkering around with the syntax, my problem was solved. I was excruciatingly close, but just had to rearrange a few lines of code and add some extra syntax. My week’s long problem just needed a pair of seasoned eyes to take a look at and figure out.

The path of a self-taught developer is a frustrating one. On to the next issue!

My First Stack Overflow Question

After days of trying to figure out how to create a search form that searches a model by category, I finally built the courage to post my issue on Stack Overflow (SO). There are plenty of resources of building “simple search forms” or even “advanced search forms”, with RailsCasts being the number one hit. But, my dilemma is that my root path wasn’t to the model itself. It’s actually pointing to a different controller (in my case, pages#home).

So I played around with all the different tutorials and tried many different solutions. In retrospect, I was actually very close. I was under the assumption that because I’ll be on my “Pages” controller that I needed to put some sort of search syntax there. Instead, I needed to create the search method on my model’s controller and then call it from wherever I wanted (for me, it was pages/home.html.erb).

I won’t get into the details, but it’s amazing that I can ask a question to the general public and someone answers within a few hours. I literally posted my question on SO before going to bed and when I woke up, someone had already answered within 5 hours of my post (thanks @Val!). Now I know firsthand how awesome SO is and why it’s the go-to place for programming questions. I’m just wondering who in the world watches for new questions and answers them in their spare time? I’m guessing SO has some sort of notification for tags that sends out questions to those who subscribe. If not, they should. Maybe someone will create a SO clone, specific for Rails ;)

I digress. In a nutshell, it’s amazing how useful SO is. My only hope is that someday I’ll be able to return the favor when I know enough. Until then, I’ll keep on moving forward with my Yelp clone project and update you all on progress.

Best Way to Learn Ruby on Rails? Are Bootcamps Worth It?

I’ve tried almost all the free resources out there to learn Ruby on Rails and even some paid ones as well. In my honest opinion, free or paid, the quality has been the same. I’ve been greatly disappointed in the various paid resources I’ve tried (won’t name them here). Granted, it’s never been more than $50 per resource, but it leaves me weary as to whether or not I should spend more. We have a local class here made by developers in the area, charging a “discounted” rate of $650 (original $1,500) for 6 sessions of learning RoR. I was contemplating whether or not I should take it, but after speaking to someone who did, they suggested I put my money elsewhere. That’s why I haven’t pulled the trigger yet on Tea Leaf Academy or Bloc. The only promising paid resource I’ve found is Pragmatic Studio’s Rails courses. Even then, I haven’t found many recent reviews aside from what they post on their site. You’d think that if people are willing to spend $600+ on other resources that one costing $179 would have more reviews.

Bootcamps are popping up all over the country and the world. There are hundreds of them promising to make you a decent developer within 3-6 months. I’ve been doing a lot of research as to the effectiveness of these programs and it seems like the pedestal they were once on is crushing beneath their feet. Initially, I think companies were hiring these alum because it was a fresh, new approach to learning a technical skill. But, at least from what I’ve read, they’re now discovering that folks who come out of these bootcamps aren’t nearly skilled enough even for a junior developer role. I met a local person at a Meetup who graduated from DevBootcamp and they were still looking for a job after 2-3 months since being out of the program. Similar stories are cropping up all over the place, and I’m hoping more do. There is a misconception that spending $10,000+ for 3 months of work in a completely new field with one of the steepest learning curves will land you a job. Granted, bootcamps don’t guarantee you a job afterwards, but that’s often the hope. Why do you pay thousands of dollars to go to college? So you can get a decent job afterwards. Why do you pay to go to a developer bootcamp? Same answer: to get a job. If someone wanted to learn to code for fun, they buy a book or join the local Meetup.

My suggestion is this: learn as much Ruby on Rails on your own with the free/cheap resources. Don’t pay more than a few hundred dollars, TOTAL. If you must insist on spending thousands of dollars, find yourself a professional, senior level developer that’s local. I guarantee you that if you offered a senior level developer $10,000 to help you learn RoR, they would take you up on it. What you learn from a one-on-one, in-person lesson are a hundred times more valuable than a class setting with a generic approach. Not only that, but you gain a reference that you can use for your job applications.

I’m taking a slightly different approach now. I’m done with the this-tutorial-fits-all learning. I won’t say here, but I’ll give an update once I’ve had the time to assess whether or not this new approach works, or at the very least, give my experience.

Current Project

I’ve decided to transition to a different project from my Tuition Reimbursement app. Initially, I thought I’d stick close to what I know: building solutions for HR related issues. However, from experience, that isn’t an industry I’d like to stay in, at least from a software perspective. Millions of companies handle the same issue millions of different ways, which is why I think folks like Oracle and SAP can charge as much as they do for their software. Trying to accommodate the countless practices and integrating all the different pieces of software is a huge headache. That being said, I think I’d like to make a pivot and build an app that’s geared more towards the general public versus a company.

So, my new project is a Yelp clone. My hope is that by creating various popular websites that I will gain enough knowledge to build my own app. I have no idea what that is yet, but I think it’d be a good start if I knew how to build Facebook, Yelp, Amazon, etc.

We’ll see where it takes me.

Hitting a Road Block

I’ve been a bit busy these past few weeks but will now have more time to focus on my learning. Where I last left off, I hit a road block. Not necessarily about finding a solution to a particular problem, more from an overall perspective. It seems like the various tutorials and resources online will only get you so far. You’ll be able to create simple models with simple relations, but as far as building a more robust app, they just won’t suffice. When I hit a snag, I browse through StackOverflow and ask a question. If I receive a solution, it doesn’t take long for me to run into another snag. It seems that when you start getting deeper into what you want to do, the learning curve spikes. Most of the online resources will only get you so far. Even going through the deep dive Rails books will seem convoluted because there’s really no context.

I think I’m at a point now where I need to find a mentor. I can get myself to a simple app, but if I want to start building the intricacies, I’m thinking a mentor would help push the rate of learning much faster. Right now, I’m stuck at ask-specific-question-online-wait-for-answer curve. That being said, I’ve hit a bit of a plateau. I can’t move any further on any task without the help a higher level developer.

My goal for the next coming weeks: finding a mentor. That’s actually a lot hard than said. How does the mentor benefit from a mentee? A mentor will more than likely be working on their own projects or having a day job. Their time is valuable, so why would they bother helping someone without any sort of return? The RoR community has a great reputation of helping newbies learn, but outside of the local Meetups, I haven’t been successful at securing a dedicated mentor. So, I will continue my current process of learning, but at the same time searching for someone who would be willing to sit down with me for a couple hours here and there to go through either my project or theirs.

Lynda’s Ruby on Rails 4 Essential Training

Life’s been busy, but I think it’d be good to squeeze a little review in here.

Lynda.com has a plethora of tutorials, from development to design to photography. They’ve really established themselves as a go-to place for beginners who want to learn just about anything. With the amount of Rails tutorials out there, I’m a little surprised that I couldn’t find too many reviews. At the cost of $25/mo, I figured it’d be a small price to pay to get a look into the course.

Kevin Skoglund walks you through creating a very basic CMS. He starts from the grass roots, going over what Ruby/Rails is and discussing what classes, modules, etc. are. If you’ve never touched RoR before, this is a fantastic place to start. He’ll go through all the basic details of RoR: navigating the terminal, playing with irb, getting into the rails console.

Although his explanations of what he’s doing are well thought out, his approach is a little convoluted. I skipped nearly the first half of his videos since I’ve already been learning on my own for a few months now. However, I completely get lost when trying to follow his course. He mixes his example code with the actual project you’re working on. So you have to watch the videos in their entirety or else you’ll lose track of where you’re at. I’m not a fan of this method as it forces the viewers to watch every minute of the videos instead of being able to use it as a reference.

Another dislike I have is that he uses old methods (maybe because it’s an older tutorial) that are no longer relevant. Or, he’ll start coding something knowing that we’re going to change it later. While I get that this (might) help with understanding Rails, it became very frustrating. Why are you telling me that we’re going to do something now knowing that we’re going to have to change it later? To me, it makes more sense if we do it right the first time instead of confusing everyone with the this-is-what-we-did-before-but-now-we-do-it-a-new-way.

For the money ($25/mo), this is a great hand-holding tutorial for absolute beginners. But, if you’ve been playing around with Rails for some time now, or have even gone through a few tutorials already, I’m not sure it’d be worth. I like being able to reference material, and the way this tutorial is structured, it makes it nearly impossible to find what you’re looking for. Granted, I didn’t pay to get the source files, but you shouldn’t have to. This was definitely a good project to go through as it exposes you to back-end development, but the approach is confusing and  you can lose where you’re at.

My final review: at $25/mo, go through it as fast as you can if you’re a complete beginner. But if you’ve gone through the various tutorials (Hartl, JumpstartLab, RailsGuides), I’d skip this series and invest in a book or a different subscription.

Login Page

I’ve been trying to work on a login page for my app for a couple weeks and got my answer at the local Rails MeetUp (a place I highly recommend you go to for your area). Essentially, I wanted just a one page login form that escapes the application.html.erb. So I didn’t want it to include the header/footer/etc. of the general app. Once a user logs in, they’ll then be taken to the app.

Here’s the solution I received (using Devise for authentication and user management):

  • Rails looks through the views first to find a file that matches the controller before looking through the Views folders
  • That being said, I needed to create a folder under the Devise folders called “Session” (Devise has a SessionsController that isn’t created)
  • In that folder, I created a file called “sessions.html.erb”. This is where I put my form and any styling.

You can find the solution on my Github. I’ll update this post later to include a visual of my file layout too.

Relying on Bootstrap

After a few months of learning Rails, I’ve circled back to using Twitter Bootstrap. Initially, I wanted to know every nook and cranny of any app I developed. However, with such a steep learning curve, I’ve decided that I’ll let Bootstrap handle the ambiance. I tried running without first learning to walk. Building from scratch without relying on generators is where I ultimately want to be, however, I need to first learn the caveats and have a much stronger foundation of Rails before diving into the deep end of the pool.

That all being said, Bootstrap is a great way to ensure you’re still building a great looking website with minimal work. It allows you to focus on Ruby and the actual app itself, not how it looks. There are thousands of resources out there (my most recent liking being Bootsnipp). With some tweaking and researching, you can still create a great looking form or list. I’m not much of a designer, so being able to add a class to a div and have things automagically appear is fantastic.

So, I’ve refactored the project I’m using to learn Rails and will have it up on Github. It actually looks more plain than initially, however, I at least know what I did (versus using a pre-made template).

Is it Good to Rely on Gems?

The great thing about Rails is that it stresses DRY methodology. Anywhere you can reduce code, do it. Also, if someone has already done it, don’t reinvent the wheel. I’ve never really heard about an open source, share-your-code system until I stumbled on Rails. To me, it’s kind of a double-edge sword. Yes, gems are great. You get to use someone else’s code that you might have otherwise had to create from scratch. However, if you don’t know the ins and outs of it, you can dig yourself into a deep hole. So the question that I’ve been asking myself: is it smart to rely on gems?

I’m a bit of a need-to-know type of person. Even today, when I copy someone else’s code, I really want to understand the logic behind it. Sure, things might all fall into place and work like a charm, but if you don’t understand what you’ve just done, are you really an effective developer? The concept of gems is great, but I can see how newbies fall into this trap. Devise and Paperclip are staples in any app, but I haven’t a clue of how they work. If you don’t generate the Devise views, how does Rails know how to format the forms? Where does all the Devise magic happen? It doesn’t seem like it’s held in any file (at least none that I could find with Command+T).

As a new Rails developer, I think it’s fine relying on gems. It gets your project moving so you’re not stuck on authentication when you really want to build the next Facebook. I think it’s important to be able to focus on the app itself without having to worry about unrelated (albeit  necessary) modules. However, I think as you become more versed, understanding how and what these gems do is critical. I’m curious to know how Rails shops work. Maybe someone can chime in. Some questions I have for professional Ruby on Rails developers:

  • How much do you rely on  gems?
  • What happens if the organization up-keeping a gem goes under? Do you continue using it as is and tweak it?
  • Do you hold someone in higher regard if they always build from scratch, even if it’s less efficient?

Gems are a fantastic resource. A word of caution though: don’t rely on them. One day you’ll wake up and the gem you’ve been using could disappear or its updates have stopped. Know the code; it’ll save you in the long run.