Tuesday, January 24, 2012

Resurrecting an old project

Have you ever been thinking so hard about a problem that you don't even notice when the music you're listening to has stopped playing? This just happened to me about five minutes ago, while I was looking through the code for my old project Chorenivore.

I'm thinking about getting back to work on it for a couple of reasons. Working on a more concrete app that does a few very specific things is both more useful and easier to do than spending my time coding a game, like Dungeon Crawler. I've tried to find a good to-do application, but haven't had any luck. I've tried Tadalist, ToodleDo and Remember the Milk.

And it's a good idea to work on a project to solve a problem I have.

Problem? I don't like the to-do applications I've tried.
Solution? Make one yourself, dummy!

What I want Chorenivore to be is a simple to-do application that allows users to create single and repeating tasks. I also want users to determine when a task should be completed upon creation.

Then I want a list of the days of the week, which allows users to drill down and see what's due that day. I may want some other visual cues in the future (such as showing how many tasks are due on a particular day, or separating single and repeating tasks) but for now I'll be satisfied with tabs that render partials for each day of the week.

The real thing I think is missing from online to-do lists is the satisfaction of crossing an item off a list. I often find myself making lists simply so I CAN check things off of that list. I'm sure I'm not the only one, so I'm thinking about ways to replicate this, or get close to replicating it with a web application.

How often do you guys do something like this? Dig up an old project you've abandoned for one reason or another? I'm guessing this is a pretty regular occurrence for web developers.

On a side note, I fired up a new Rails application the other day and it's funny how BULKY Rails seems after a solid 3 or 4 months using Sinatra.

Sunday, January 22, 2012

CODETOBER, other code-related things I've been up to

As you may (or may not!) be aware, I've been doing some consulting work with the Expected Behavior guys the last couple of months, mostly working on SEO for DocRaptor, but also doing some other marketing work.

This applies to coding because they want a way to more accurately track where their users are coming from, so this week I'm going to look into coding something that will pull various bits of information into a more readable format. Sound cool, right?

I've also got an interview at iGoDigital on Tuesday, for a junior developer position. I interviewed there back in September, but it wasn't a good fit at the time. Now? Maybe a better fit! It's kind of funny. When I first got into Ruby, I wanted to make more money and programming seemed like a good way to do that. Now I'm less concerned about making more money, and I largely want to become a better programmer. Working full-time would definitely help me improve my skills, especially in a team environment. So I'm pretty excited about this opportunity.

I'm still gathering ideas for CODETOBER, since I really need to a) code more and b) blog about coding more. So far my list is pretty sparse, and I'm still open to suggestions if you've got them. What kind of things should I be looking into? What would be worthwhile, or valuable, or fun, or frustrating, or otherwise teach me a life lesson? I'd like to see more developers doing crazy things in February.

Now I think I'll sit down and work on a stupid project. I'm kind of losing interest in Dungeon Crawler (SURPRISE!)

Thursday, January 12, 2012

Announcing CODETOBER

Awesome IndyRB meetup last night. I got a lot of great recommendations for books to check out, and then had a ton of fun drinking beers and talking about projects at the Brockway pub afterwards. It's pretty awesome that we get so many new people coming to the meetups, partly because it's awesome to see such interest in Ruby and partly because it's also awesome that I'm no longer the newest coder around. After the meetup, I may have had some beers and spent some time hassling other developers about why they should be blogging more often. And then I realize I haven't blogged in what? 9 days? Who am I to hassle other people for not blogging?

But I've got an idea to remedy this. I absolutely SHOULD be blogging more often, and I'm going to take a page from my friend Miles' book and try to learn something new every day in February and then blog about it. I want to have an awesome name for this month, so I'm probably just going to call it CODETOBER. Also it's a leap year this year. WEIRD!

I've got a list going for things I want to look into or try to understand a bit. Mostly things I've heard mentioned often enough that I want to look into them, or how to use tools I'm already familiar with more effectively.

This list is pretty short, though. I'm definitely interested in learning how to dry up my code, since I feel that's a big weak point for me. And getting more familiar using Git for source control, learning more terminal shortcuts, Sass, Cucumber, HTML5 (since I'm a sucker for front-end design anyway) and I'm interested in getting more recommendations. What do you think would be beneficial to look into? Useful gems, fun tutorials, etc? I'M COUNTING ON YOU, INTERNET!

In more concrete coding news, I hung out with my friend Eli and he showed me how to dry up my Dungeon Crawler code quite a bit. I've now got one method that generates the rooms as opposed to 10 different methods! Still pretty soggy around the edges, though. And through the middle. It's actually mostly still pretty soggy.

Tuesday, January 3, 2012

Learning How to Abstract Code

In my last post, I was talking about how to deal with coder's block. I've been working on my current project, Dungeon Crawler, for about a month and I'd really hit a wall.

The problem was due to a couple of things. First, I'd gotten a lot of really good advice that I didn't quite understand, and I felt bad that I wasn't getting it, so I was reluctant to ask for more advice. Second, I'd already spent so much time without making any progress that I was getting sick of the project.

But I think I've gotten through my lack of motivation and I've made some progress with this project, but the code is an explicit, redundant mess. So the question at this point becomes is it better for me to make some progress coding in a way that I know is bad, or to not make progress at all?

Obviously it's better to make progress (and I did learn a bit about YAML tonight, so it's not entirely a wash) but it's about time I got better at writing code. I've noticed a problem with the way I write code: I'm far too heavy handed and I repeat myself too much. I need to get better at abstracting my code, so that's my current goal.

Maybe this is easier said than done, but at least I'm losing track of time while coding again, right?

Friday, December 30, 2011

How do you deal with coder's block?

I've kind of fallen into a trap with my Ruby work. I've been working on Dungeon Crawler for so long that I'm getting sick of it. I've had help from several friendly Rubyists (@jqr, @mileszs, @netshade, I am looking at you here) and I simply can't figure out how to make a proper redirect based on a form input.

This is extra irritating because I'm pretty sure I DO get how routing with Sinatra works, but starting a user out on one page with an input form, then redirecting that user to another page based on his input, seems to be escaping me.

I've gotten this to work in a limited capacity, when all of the logic is thrown into the

get '/input' do

method, but using a case/when statement here always uses the same logic. For example, dais_room will be north of torch_room, but vine_room will be north of dais_room, and I was always being redirected to dais_room with input "go north."

I also had a problem of simply being redirected to a white page with black text pulling the description of the room. I believe this was the method @netshade showed me for automatically creating a room without explicitly coding it, but for some reason it was not loading a view file.

Here's a full gist of what I've got, if anyone wants to give me some srs help:

Dungeon Crawler full gist

What do you guys do when you get so frustrated with a project? Do you power through, work on something else, or just take a break? I feel like since the holidays began, I've found a ton of great excuses not to code. It's Christmas Eve! It's Christmas! I just had LASIK surgery done!

But I'm sick of making excuses and I want to get back into working on a project without feeling like a gigantic dummy or just tearing my hair out because I can't figure it out. That makes sense, right?

It's not all bad news, though. @netshade and @annamul gave me The Pragmatic Programmer, a philosophical/theoretical book about coding. I really like the PragProg guys, and this book has been a lot of fun to read so far.

I think I need some way of setting goals for myself each week with coding. As in, "This week get better with using Git for source control," or "This week, get more comfortable with Javascript." Any recommendations for simple goal setting applications, or methods you've used? I use Tadalist for simple day-to-day chores and things, but that's not quite what I want. Maybe Evernote would work? I still haven't checked into that.

Either way, thanks for all your help, everyone! And Happy New Year!

Wednesday, December 21, 2011

Working with the Method method in Ruby

So with the help of my friend Z (also known as Chris to some, mostly just his wife) I've made some progress on Dungeon Crawler. But not much.

Namely, he showed me how to abstract my routing, so rather than having

get "/torch_room" do
  @torch_room = torch_room
  erb :torch_room
end


I have a method that automatically builds a route based on methods that already exist for rooms. Pretty awesome! I think learning to be less specific and abstracting my code is one of the most difficult things I'm learning. One of the guiding tenets of Ruby is DRY (Don't Repeat Yourself) and I really just need to be aware when I'm writing the same basic code more than once that it can probably be abstracted.

Ok, but here's my problem. I still can't figure out a way to collect input from a form, pass that input into an instance variable so that I can check it from other rooms and perform redirects based on the input itself. Does that make sense? I am absolutely trying my hardest to be clear about what I'm trying to do. Z also clued me in on a Method method but I can't figure that out, either.

Here's a gist with what I've done so far, but (FAIR WARNING) it's straight up busted:

Busted Gist

That said, I've noticed a funny thing about this problem. Bear in mind I've been wrestling with this guy off and on since my last post. (I DID do a couple of fun tutorials in between wrestling matches, mostly to keep myself limbered up) I didn't get frustrated in the usual "FUCK IT I GIVE UP" kind of way, but more in a "huh that didn't work. Ok let's try another thing. Hmm nope, that didn't work either," kind of way.

I did try some CRAZY other things, based on what my friend Miles told me about last time I posted about this problem (said crazy things mostly involved working with hashes, trying to convert hashes to strings, etc. Does that work? PROBABLY, I DON'T KNOW!) with minimal success.

I think this is how Daniel-san felt when he realized the entire time he thought he was washing Mr. Miyagi's car, he was actually learning karate.

Tuesday, December 13, 2011

Trouble with Ruby form methods

I'm still working with my Dungeon Crawler Sinatra app. Believe it or not, I have a problem. I'm trying to get a simple form method working to allow a user to move from one room to another by typing in the direction he wants to move and then hitting 'Submit'. So good so far, right?

Here's a link to a gist of the code I've got so far:

Working with form methods

The second file I posted in the gist is code that works, but I'm looking for a cleaner way of manipulating the information collected from the form method. Does that make sense? This is probably easy enough to do, and @jqr gave me some help with it last week, but I can't figure out how to make these form methods behave.

On a side note, do you have a problem with getting distracted with new ideas for projects when you're in the middle of a project? This seems to happen to me all the time, and I've been handling it by saving as much as I can think of in a Google Doc. I wonder how other programmers handle this? Do you just write things down in a notebook? I've been thinking about creating a template to use for these project ideas, just to keep my thoughts a bit more organized. If any of you have a template like this, or suggestions on what would be key features, I'd love to hear them.

I actually think a simple drawing application that allows me to add notes and save to the cloud would be ideal, but I haven't heard of anything like this.