I have been hard at work over my birthday to now. I’ve spent the better part of 20 hours with my dad working on my new standing desk. Where I was working before was extremely cluttered and an upgrade to my life was needed.

I wasn’t able to take pictures from the initial start of the project, due to us having to do multiple things at once before Home Depot closed. However, after we settled down, I had Amanda come out and take pictures as we were working on the desk.

We built the desk using Oak tongue and groove boards. My parents finished an interior remodel of their house about two years ago. A lot of oak boards were left over and my dad suggested we use it instead of buying a new sheet of Birch.

I hate glossy polyurethane. Even a satin finish still bothers me some. For me wood isn’t supposed to be reflective. I opted for a Matte finish with a Dark Walnut stain.

Staining was probably the best feeling in the world. I was so close to being done!

After three layers of polyurethane and some serious tender love and care. I took it home with me to assemble! This table is super heavy due to all the Oak that we used.

Feels great now that I have this completed!

Finally! I have graduated from the University of Texas at San Antonio with a Bachelor’s degree in Computer Science. I waited for 4.5 years (9 semesters) to finally reach this point in my life. Though now I wonder what awaits me in the future.

Now I’m able to work Full Time at ZippyKid where I help build and maintain the deployment system. Ever since I started working here in January 2012, I’ve grown a lot and I have learned a TON.

Things I’ve learned:

• Rails is not the answer to all questions
• Venturing out of your comfort zone is great
• Good OO design is not easy
• There is no silver bullet
• No one really knows what they are doing in software engineering

I despise consuming 3rd party APIs for one reason, speed. Many of the APIs I have to consume on a daily basis, respond slower than it would take to deliver an email. But, their integration with our application is absolutely critical. They are so critical infact, that if an error should happen during any point of the commissioning, then I need to be notified and or the job needs to be reattempted at a later date.

On many occassions, I have simply split the 3rd party API object into its own Rails model that is persisted in the database with a state_machine or some sort of identifier on it that lets the application know if it is in an erroneous state.

Billing is a prime example of this:

# app/models/subscription.rb
#  Table: subscriptions
#    - user_id
#    - subscription_id
class Subscription
belongs_to :user

def subscribe
# subscribe to api here
# set subscription_id = id in api
end

def unsubscribe
# unsubscribe from api here
# invoke .destroy
end

def update_billing_information
# interact with api here
end
end


I mentioned earlier that I would use a state machine on models that interact with APIs. However, in this example, if the subscription_id is not set, then the Subscription will be in an erroneous state.

I prefer to make job classes, only because they allow for me to separate my backgrounding code, from my model code. Plus, there is the possibility that you are sticking too much data into the delayed job queue by doing User.delay.send_some_email or @user.delay.send_some_email is even worse. It will turn that ruby object into a YAML formatted object and stick it into the queue.

The following is the best way, IMO to do backgrounding with Delayed Job. Just put a few simple values in and it keeps the queue lean.

# app/jobs/subscribe_subscription.rb
class SubscribeSubscription
def initialize id
@id = id
end

def perform
subscription = Subscription.find(@id)
subscription.subscribe
end

def error job, exception
puts "[ERROR] subscription=#{@id} message=#{exception.message}"
end
end


I would then invoke the Delayed::Job queue by using an observer. Now this part you don’t have to necessarily put into an observer, but it makes for a cleaner model. As an aside, I store my observers in app/observers, it just makes it a little easier to organize my thoughts.

# app/observers/subscription_observer.rb
class SubscriptionObserver < ActiveRecord::Observer
def after_create subscription
Delayed::Job.enqueue(SubscribeSubscription.new(subscription.id))
end
end


We would then be able to do the following:

# app/controllers/subscriptions_controller.rb
class SubscriptionsController < AuthorizedController
# ...

def create
sub  = current_user.subscriptions.build(subscription_params)

if sub.save
# success
else
# booo failure
end
end

# ...

private

def subscription_params
params.require(:subscription).permit(:name, :more, :fields)
end
end


We have decoupled the 3rd party interaction from the controller and put it into a background job, where it will be handled. However, in this straw man example I did not show a proper way to handle failure. If I was going to actually do this with a payment system, I would definitely notify the user that something is up and make them reattempt the sign up again.

I discovered the Flight micro-php framework this week. I found it because I was looking for a simple PHP 5.3+ framework that didn’t have a large amount of extra cruft. I had a project to do for my Database class at UTSA where we had to utilize an Oracle database. Not exactly my choice for databases, but we had to make do with what we were given.

It is a very sparse framework that looks very similar to Sinatra except it is even lighter. Flight provided me ways to easily extend and customize.

I used a fairly straight forward file structure:

|-assets
|-config
|-controllers
|-db
|-lib
|-models
|-views


Flight doesn’t come with a Database class. So you will have to roll your own or use an ORM or use Mike Cao’s Sparrow library. I haven’t had a chance to play with it yet, but it looks very promising. Unfortunately, it does not support Oracle, so I had to roll my own implementation, and it’s not pretty by any means.

I look forward to playing with this library some more, and hopefully building something with it soon.

I have been staring at Ruby for so long that I have become disgusted with low level languages like C or C++. Mid level languages like Java still make me cringe when I look at them. As I sit and write code in Ruby that runs on a terribly slow VM I begin to think.

Why don’t high level languages like Ruby or Python compile into assembly level code like C does when it is compiled?

I know compilers and interpreters are difficult to design and program. Someone, somewhere, has to feel the pain that I do when looking at C, Java, C#, etc… and not wonder why a high level syntax wont compile into low level assembly code.

I wrote a Scheme interpreter in Java for my Programming Languages class. That was probably the most eye opening experience that I have really had in development. Not simply because Lisp like languages are terribly simple, but that an interpreter can run the code at a decent speed (minus garbage collection).

Now I am not saying, take Ruby and make it into assembly level code. No, that is not my point. Ruby is a VERY dynamic language that can hinder speed. Nay, what I am saying is that we can have a static typed language that has a very verbose and simple syntax that can be fun and beneficial to all.