Keep up the hustle

Recently I had a conversation with a friend whom I worked with years ago. We worked in the same company on the same team. We parted ways after our company was broken up due to a talent acquisition from one of our customers. During our time at the company I began spending many hours a day working on open source projects and applying myself in areas to stretch my talent and understanding of software development. My hustle started… Since that time years ago I have continued to hustle and work feverishly on projects that had no immediate return (financial or otherwise) on the time invested. I also started consulting during the nights and weekends. I even used my vacation time to consult for my clients. During our lunch conversation I was asked, how we had ended up at such different endpoints through our careers. I answered without too much thought, but have recently been thinking more on the conversation. I have kept up the hustle for many years. Trying to calculate the hours invested makes my head hurt!

I love what I do. I still think its incredible that I get paid for what I do! When my wife is watching tv or reading a book to relax, I am glued to my computer reading about some technology or working on one of my many projects. Its fun for me and I enjoy the output of my work. It is an amazing thing that you can start with the blank canvas of a newly generated project and in the end have a functioning product. I find that building software is much more of synonym to painting than to the traditional house building synonym. Honestly, I also find it is therapeutic to my OCD. I find it comforting to exert my need for organization and compartmentalization in software.

The whole point of this post is just to say “Keep up the hustle”. If you are not happy with your current situation and you are not hustling … you should start! Understand that you may not see immediate returns for your investment… but with time… it will pay out. If you are hustling and have not yet seen the returns, then you might need to increase the hustle or maybe you are hustling in the wrong area. Be passionate about what you want to be when you grow up and hustle more than anyone else to get there. Make friends along the way and enjoy the journey. The destination is great but the journey is where the memories are made!

As a side note: If you are unclear about what having a hustle is.. I can’t help here.. that’s another post for another time!


simple before and after filters for backbone.js

Added a new project out on github to add the ability for declaring before and after filters in a backbone.js application. You declare a regex that represents the route to match and then provide either a string that references a function or an anonymous function. If a before filter returns false, the controller action will not get called. It works similar in the way rails before filters work. Its not intended to be complex but makes the concept available. It’s useful for stuff like checking if a user is logged in. Your requireAuth function could check the logged in state and render a login form if not and then return false. This prevents the need for if checks in your controller action. You can see the code here.


Managing one page web application with visual screen stack

Yeah, I know that title kinda sucks… Recently I have been spending time doing some web work in TripCase. Over a year ago I did a rather large refactoring of our web app to create a ‘screen stack’. The majority of the user interface in TripCase revolves around this window like space on the screen that is updated with ‘screens’ as the user progresses through workflows. I’m hoping to spend some time to extract an actual useable framework from the effort and maybe opensource it. The idea is you could have multiple ‘windows’ on a single page app all with their own screen stacks where screens can be pushed, popped, and updated. It may suck and never get used, but it could be a cool exercise to do the extraction and produce the framework.


Passion and Aptitude: The foundations of a great developer

I think I’m a pretty good developer… I’m also known as a bit ‘confident’ :) Recently, I have been reading various blog posts and articles surrounding the general topic of ‘what makes a good developer’. There are countless “Top x traits…” all outlining similar characteristics such as they are responsible or they get things done. Many state that a good developer knows traditional programming paradigms and have deep knowledge surrounding x language.

While I find all the reading entertaining, I continue to feel that all this is just wrong. Every great developer I have ever known share the same two traits:

1. Passion – It enables them to take their craft and continue its development. This passion drives them to learn constantly and drive for better solutions. For me, I think my passion for building clean code forces me to refactor. Its an itch that MUST be scratched. When I see bad code, something in me can’t let its existence continue. Of course this has to be throttled a bit so that you are not in the endless loop of refactoring without delivering value to the customer. Refactored code is great… but only if people actually use it. I also see passionate people contribute in some way externally. They either write, participate in local development groups, contribute in open source projects, or even have a presence in online Q&A sites surrounding technology and development. A person with this trait cares and they take what they do seriously.

2. Aptitude – It is the foundation for the person’s ability to learn and adapt quickly. They can digest a problem quickly and break it down to smaller problems. They are comfortable explaining a solution and have the confidence to explore alternate solutions. They are not fanboys and do not bind themselves to specific technology stacks. They like solving problems and can easily jump in on any framework with little help. The solve problems in an elegant way and their execution of the solution is readable.

I guess what I’m trying to say is that if a developer has these two traits in spades, then all the other stuff is probably there.. I’d argue that all the other stuff is there because their foundation is Passion & Aptitude.


Knocking off the dust

I’ve been dusty, rusty, and quiet for some time as it pertains to communicating outward to the software community. Various projects have pulled me in directions that have been keeping my head down and focused on development. My online presence is scattered among many sites, blogs, and open source projects. Hopefully, this will be my attempt to bring all those identities to a single place that represents me.. my ideals.. my passions.. and hopefully….. it will be “just clean code”.


Passing parameters to acts_as_state_machine events

This morning I ran into a small roadblock working with the acts_as_state_machine gem. My code started like this:

class Communication < ActiveRecord::Base
  include AASM
  aasm_column :status

  aasm_state :draft
  aasm_state :pending
  aasm_state :approved
  aasm_state :rejected

  aasm_event :submit do
    transitions :to => :pending, :from => :draft
  end

  aasm_event :approve do
    transitions :to => :approved, :from => [:pending, :rejected]
  end

  aasm_event :reject do
    transitions :to => :rejected, :from => [:pending, :approved], :guard => :validate_rejection_reason
  end

  aasm_initial_state :draft

  def validate_rejection_reason
    if self.rejection_reason
      true
    else
      raise AASM::InvalidTransition.new('A rejection reason is required')
    end
  end
end

This is a basic example using AASM to provide an approval process for my Communication model. I wanted the ability to just call instance.reject(“some reason”) or instance.reject!(“some reason”). I was really thinking to hard about it. The assm_event just creates some methods for me….so why not just decorate those methods using ruby aliases. This is what I ended up with:

  include AASM
  aasm_column :status

  aasm_state :draft
  aasm_state :pending
  aasm_state :approved
  aasm_state :rejected

  aasm_event :submit do
    transitions :to => :pending, :from => :draft
  end

  aasm_event :approve do
    transitions :to => :approved, :from => [:pending, :rejected]
  end

  aasm_event :reject do
    transitions :to => :rejected, :from => [:pending, :approved], :guard => :validate_rejection_reason
  end
  alias old_reject reject
  alias old_reject! reject!

  aasm_initial_state :draft

  def reject(reason)
    self.rejection_reason = reason
    self.old_reject
  end

  def reject!(reason)
    self.rejection_reason = reason
    self.old_reject!
  end

  def validate_rejection_reason
    if self.rejection_reason
      true
    else
      raise AASM::InvalidTransition.new('A rejection reason is required')
    end
  end

Notice the use of alias for reject and reject!. Now you have to call reject with a rejection reason. There may be another way to get parameters in to the event call….but this is how I rolled mine :)


New has_class_attr plugin

I wrote this as a plugin….but it really has nothing to do with rails. I guess it could be packaged as a gem, but its so small that it probably doesn’t make sense. You ever create class variables or class instance variables and then create getters for them for use as statics?

Old Way:

class MyClass
  @items = [1,2,3]

  def self.items
    @items
  end
end

MyClass.items  #[1,2,3]

New Way:

class MyClass
  has_class_attr :items, :data => [1,2,3]
end

MyClass.items  #[1,2,3]

Install:

  .script/plugin install git://github.com/angelo0000/has_class_attr.git

Follow

Get every new post delivered to your Inbox.