Archive for the ‘Fear’ Category

Building a New Site With Rails Part 1

Monday, June 7th, 2010

Fear on the BrainYou may have noticed that my ‘blog 6 days a week’ has lately been kinda lax lately, but I finally, finally, started work on Ruby-idioms.com.  Nothing out there public yet, but I’ve finally found the time and energy, and quite frankly, got through that old friend of mine, fear of getting stuff done instead of watching TV and reading RSS feeds, and actually got some code down on… uhm… an editor.

I figure that it’d be a good idea to start blogging the experience of building a site from scratch with Rails by a newbie (not that there aren’t a hundred of those already).  Read My Code was done in 24 hours, I figure a week or so, or heck, a day or two per feature, ought to be enough.

I started by breaking things into some steps:

  1. Create the Idiom scaffold, model validation, etc
  2. User authentication and login
  3. User integration (edit your own Idioms)
  4. Site layout, look and feel
  5. Commenting
  6. Tagging
  7. More site layout stuff (I’m thinking this might be the hardest part for me, as I am a programmer and not a designer for a very good reason :)

That’s of course a bit over simplified, and I’m probably missing out something huge, but that’s the current attack plan.  All things are flexible of course.  My grand plan is to code one day, blog the results and anything interesting or challenging that I find. I’ll make sure I push things up to the GitHub project page as well.

Best Laid Plans

Friday, May 28th, 2010

So minimal posting this week cause I’ve been hit with the cold/flu/sinus-torture-from-hell :( I did get some design done on the two projects I’ve had rattling around in my head for the last few weeks and months.  Only problem was, when I really thought about it, they are both kinda silly and pointless.

  • My idea for a memory capture (ie: put in memories of your past) is, I realized, essentially a blog with a better way of adding by date (fuzzy dates).  Really, just a blog.  Do I want to end up re-writing wordpress or movable type again, poorly?
  • The ruby-idioms site that I spoke about a while ago appears to have been written already over at http://readmycode.org.  While I applaud the author for getting the site out in 24 hours, he also basically created what I wanted to.  Grrr…..

Now, that’s not to say that I don’t have passion for the projects, and definitely doesn’t mean I won’t still do them (nothing says you can’t create something if it exists already).  Shows the dangers of not committing and waiting, instead of getting stuff done NOW.

Guess it’s just a bummer to get to the realization that my fantastic ideas maybe aren’t that wonderful…. Bleah.

Anyway, keep on coding out there, got some ideas here for some hopefully interesting posts coming up next week as I get better and closer to upright!

Doing it Now

Monday, May 24th, 2010

It might sound like a bit of cliché from one of those high energy seminars where you’re encouraged to Take Control Of Your Life! and Actualize Now! or Create Your Own Reality!, more and more I’m finding that one of the best ways to get things done, programming wise, is just to [expletive] do it.

One of the big challenges I have myself is that I get mired down in details.  For example, I have this idea to do a Ruby Idioms site, and the setup seems pretty simple.  User login model, an Idiom model, thrown in something like acts_as_taggable-on or whatever’s hot right now, a bit of layout, some begging for real design from some helpful designer(s), a short beta with some real users to flesh out the bugs and fill in the database, and then release, iterate, release, iterate, done.

For a Rails project this isn’t overly complex, hell, an intermediate coder could probably hack that out (up to the design part) in an afternoon.

And yet a week after coming up with, and getting all excited by, the idea of doing it, I’ve only gotten as far as registering the domain.  What the hell is wrong with me!?  Heck, I started this post half a week ago and still haven’t posted it, or gotten around to doing anything more.

So why?

There are a few different reasons why people procrastinate.  I’d put them in a random order chosen out of my brain:

  • You’d have to finish if you start
  • Easier to sit on the couch and watch the new Blue Ray Alice in Wonderland
  • Too many other things to learn first

The last point is the big one for me, and for a few people I know too.  When I say “to learn” I don’t mean that in the “oh I have these awesome new technologies to get through” sort of way, but more in the “well, I can’t write a rails app until I learn rails, but I have to learn ruby first, and there’s all these libraries, and I hear that 1.9 is coming out soon, so maybe I’ll wait for that to be released, and I hear Rails 3.0 is almost out, so it makes no sense to learn Rails 2 now if the next version is only a couple of weeks or months down the road…”

I believe the seminars call this (among other things) the “whoah busy” syndrome.  With a scary task ahead of you, it’s really easy to end up bogging yourself down in the minutia of it all cause if you have to mow the lawn/do the dishes/clean the house/do the litter box/cook dinner/get lunch for tomorrow ready then it’s really easy to put off starting that new project…

That’s my issue anyway, I’m sure it’s not unique, but I don’t want to put any of my own issues on people out there.  I think if you look deep down in your own psyche you’ll figure out what it is that’s stopping you.

Ok, so in the time of reading this and a few seconds contemplation, you now have figured out what issues you have stopping you from getting your stuff done, so what now?

The most obvious is to just do it.  Seriously, close the browser, shut down your RSS reader and open up Vim/TextMate/EMACS/whatever and start coding.

Still reading? Stop, close the browser and get out and do whatever it is you need to do.  Think about that feeling you get when a project is done and how good it feels to tick something off your todo list (legitimately of course, not like this guy).  You’re a lot closer to that ticking off feeling after you start, not before right?

My best example of this from my own past was working with @milesforrest at an early FV.rb meeting and it was just the two of us, and we started into the typical geeking out, surfing reddit, etc.  I put my foot down and said “lets make something”.  We set up the site’s website onto heroku, put it up on github and worked on stuff.  It actually sucked… there’s nothing to show you the difference between having read a bunch of Rails books and blogs and actually coding it.  I did a lot of cursing that day, as all the stuff that should be just super easy turned out to be really friggin’ hard, or at least hard from a “I have no clue how to do this” point of view.

We persevered though, and worked on it and by the end of the night had  a lot better understanding of some of the Rails insides that now (months after this initial ordeal) are second nature and super simple to do.

Moral of the story?  Each journey begins with just one step, and each new web project begins with typing in “rails <projectname>”….

Incoming, Another Week Of Coding

Sunday, May 9th, 2010

Of course, I’m lying a bit when I say “another”, because for the last few my rails coding has been…. “minimal” at best.  Seems no matter where I am I just can’t get my brain back into a coding mode.  I’ve done a few minor updates for my perl clients, but when I’m done I just head off away from wherever I am to the couch, to TV, or a video game, or whatever.  Gotta break out of that this week, get some coding on either refsite or my little Twitter XML projects done.

Goal Setting and Getting Things Done

Tuesday, April 13th, 2010

Here’s a bit of a diversion from the Ruby and Rails talk.  Back in the day I took a couple of the LGAT courses that covered life skills, goal setting, etc.  Other than taking a ton of money out of my bank account, they did teach me some fairly good skills and more importantly ways of thinking about things that I thought I’d share here.  Note that just reading may not be as effective as taking a course and getting the feel of them in the exercises.

  • Taking Responsibility
  • “I hate my job”.  “I don’t have enough time”.  “That’s too early/late”.  “I’m too tired to…”  These are all excuses we use all the time.  The concept of taking responsibility is pretty simple.  Instead of making excuses, realize that if you hate your job, that’s because you are choosing to stay at it.  If you don’t have enough time that might be because you choose to watch Lost and America’s Top Model in the evenings, and if it’s “too early” that’s because you are choosing to not get up that early.We all have rationalizations… we can’t quit our job because the economy is in the shitter, and we really like Lost, and we went out with our friends last night so we want more than 3 hours of sleep.  Blah blah blah.  There’s all sorts of rationalizations, but sometimes it just comes down to if you it was that bad, or if you wanted it enough, you’d do it.  Until then, you have to take responsibility for your circumstances (or at least some of them).
  • Goal Setting
  • Setting “SMART” goals was a major part of these courses.  This means that you need to set goals that are Specific, Measurable, Agreed On, Realistic and Time based.  IE:Your goal has to be Specific, like “I will lose 10 pounds” not “I will lose weight.”  Or “My next job will pay me more than $75,000 a year” not “I will get a raise in my next job”.  Being vauge means your results will be vauge.  Having something specific will give your brain something to lock into.Tied into this is Measurable.  If you can’t measure it, or know where you are in relation to success or failure, it’s harder to achieve.  So making a goal based on something you can measure is needed.  If your goal is to get to Vancouver, you need to know where you are to know how far you have to go yet.  So unmeasurable goals are the touchy feely ones that you can’t tell if you get them or not.If you can’t Agree upon the goals, or if there is any ambiguity about them with the people you’re making the agreements with, they’ll be harder to achieve, or be enforced.

    If you’re not realistic and your goal isn’t Realistic, you’ll just be frustrated.  “Make a billion dollars”, “run a 2 minute mile” or “become a playboy centerfold” is probably not attainable, and you’ll end up frustrated.  Sometimes that means that smaller and more bite sized goals means you get more success and feel better about yourself.

    If there’s not a Time limit on the goals, you won’t be able to know when you are done.  I’m sure I could make a billion dollars given enough time, but saying “I will lose 10 pounds in the next month” instead of “I will lose 10 pounds”, because at the end of the month if you don’t weigh 10 pounds less, you’ll know that you didn’t achieve your goal.  Giving yourself a time limit also gives you a kick in the ass if you see that finish line approaching.

I think that’s probably enough for now.  I know it’s a bit outside of the normal TiR fare, but this sort of thing has been rolling around in my head recently a lot all in related to my own struggles to get stuff done and getting over the fear (not exactly the right word to be honest, more like “super delay and procrastination ability”) of new things like Rails.

If you can use any of this, great.  Set yourself a goal to get something done code wise, even a small one, just to get the feel of it.  Maybe “smart” goals aren’t your style, find something else that doe work.

Hopefully that info will help some of you out there.  Check out LifeHack.org for lots more stuff like this.  It’ll be back to the code stuff tomorrow, promise :)

Pushing Through The Wall

Tuesday, April 6th, 2010

This entry was almost titled “In Which it All Comes Apart” because lately I’ve felt like all my previous forward motion with my Rails project has come to a crashing halt.  It seemed like the only time that I got work done was at the FV.rb meetups, but in the evenings I just didn’t have any drive to do anything, and on the weekend when I did, I’d think about the current couple of tasks on my plate and get… scared is about the only real word for it, and just go back to watching TV, websurfing, or whatever other thing that wasn’t programming Ruby and Rails.  Not a good way to go.

Last night I finally broke through this a bit.  Amidst my mother-in-law drilling and cutting (she’s helping my wife put up cabinets) and my brother-in-law on the couch oohing and awwing over heavy equipment ads on craigslist, I managed to get things done.  I figure a bit of post-mortem might help me for the next time it happens.

The two things that I had on my plate were not, in fact, the only things needing to be done, but they were the two things that are fairly isolated and sort of simple.

The first was adding ‘areas’ to my referee site.  Each club has many fields, each field has many games.  I wanted to expand this so that each club has many areas, and each area has many fields, and so on.  Basically this allows you to break up the “Langley” club into say, north south east and west, and assign users to various areas and make things a bit more manageable.  IE: Assignor Bob manages the north zone, while Manager Sue takes care of South and East.

Failing TestsCode wise it’s pretty simple, add a new model, add the “has_many” and “belongs_to” relationships, and create the management pages.  Simple stuff, so what’s the problem?

I think it might have come into the testing part again.  Because I’d have to rearrange some of my queries to ensure that users get the right games from the right fields from the (now) right areas from (breath) the right club, having no testing set up means that I’d have to go to all the pages that access that code, redo the queries, re-test, etc.  Ugh.

The second task that was a real stumbling block was the user and role management.  I had set up user authentication a while back, and if you log in as one of two user types you’d end up being sent to the “correct” page, and the two different controllers (/bids and /assignments) are protected through a before_filter as well, but I hadn’t gotten around to “Management” stuff (editing games, fields, etc) yet.

The big mental block that I had in this area was that I had 3 fairly clearly defined roles, 4 if you include the “unauthenticated” users.  I had

  • Referee (can bid on games)
  • Assignor (approves/edits referee bids)
  • Club Admin (club management stuff)

All the stuff in the User model is geared towards these, a club_id is defined and required, email is required, etc.

The role that wasn’t so easily defined was the “master” admin.  This is the main user that would manage the whole site, set up clubs, and basically have access to everything.  I faced the challenge of either creating a new type of authentication and model (ignoring the DRY principle), putting a bunch of exceptions in (ie: requires validation of club_id unless this user has a role type of ‘masteradmin’) and making things ugly.

I managed to push through the first one, or at least start to.  I’ve managed to get to the scaffolding part anyway.  Also in my lunch hours I’ve started going at the failing tests too.  That’s a whole other blog post though, probably involving me going back to the simplest cases that are in the Rails Tutorial book and figuring out how to deal with speccing out password protected pages :)