Becoming a Recording, sorry I meant Software, Engineer

July 12th, 2009

Recently I was sent a survey from the college I attended, the Liverpool Institute for the Performing Arts. In the survey I was asked a question about what I’ve done in the field of music, that’s what my degree is in, since I’ve graduated. I typed up a rather long winded answer to the question and afterwards I thought it was actually thought it was an interesting commentary on the recording industry. It also shows the path a guy like me takes from being a musician to being a software engineer.

Anyway, I thought I would share this little story with you all. I hope you enjoy it.

About 3 – 4 after graduating I found myself unemployed and decided that I would take that opportunity and try to pursue a career as a recording engineer. I spent two years struggling and working very hard at one of the best studios around and I found that things were just not working out.

I don’t necessarily think it was a problem of my not having the skills needed for the job, but rather it had to do with several other factors. One, because of the state of the recording industry ‘proper’ studios are/were struggling to find work because more and more musicians are doing recording at home on their computers. While their results might not be as ‘high quality’ as those of the studios, the musicians are/were finding that it was good enough to help land them gigs in town.

Because the studio was struggling, and I was the lowest guy on the totem pole, because I was the ‘newest’, I found that I was only getting a few sessions each month, that compared with the ‘top’ engineers who were only getting a week or two worth of work each month.

It was at this point that I sat down and re-evaluated what I wanted most in life. I decided that was really important to me was to have a family and be happy with what I was doing, and to just generally enjoy my life. Realizing that, I had to decide if my current situation was really going to work for me. While I thoroughly enjoyed being a recording engineer, when I got to do it that is, I found the pay ($90 a day – awful!), the hours (usually 12-14 hours), and the lack of sessions to not be a viable way to raise a family.

Once I decided that being a recording engineer wasn’t going to work for me, I needed to find something that would. I thought long and hard about this, as well, and realized that I really enjoyed being a software engineer. It is strangely creative, the pay is very good, and I was damn good at it.

The Evolving Table of Contents

June 20th, 2009

For those of you who have checked out the Rough Cuts version of my book, “Distributed Programming with Ruby”, I thought you would like to get a peek into how the Table of Contents is going to change shortly. For those of you who haven’t seen the old Table of Contents, or are just plain old interested to see what’s going to be in the book, or to see how far along with the book I am, here is the current Table of Contents as of tonight:

As you can see it has evolved quite a bit from what was posted on Rough Cuts just about a month ago. Chances are that it will probably change again, and as it does, I’ll try and keep you all posted. There is talk of adding a large chapter at the end that takes a handful of the technologies I discuss in the book and use them to build a “real world” example application, like a Twitter clone, or something like that. If anyone has any good ideas on what they would like to see for this example, please them my way, I’d love to hear them.

If there are no sections listed below a particular chapter that means that I have either not written it yet, or I’m still too early in that chapter’s development to have properly assigned it actual sections.

The first draft of the book is slated for the end of July. So there is still a lot of work to be done, but it’s still rather exciting. Well, it’s exciting for me at least. Talk to you all soon.

Cachetastic 3.0.0 Released

June 18th, 2009

After more than two years powering production level applications I found that Cachetastic was starting to get a bit long in the tooth. I felt that there was a lot I could to make Cachetastic an even better library than it already was. I thought that I had added a bunch of cruft to the framework that people were just not using and maintaining it all seemed like a bit of a pointless chore.

So what was I unhappy about?

Configuration:

I was pretty unhappy with the way configuration was being done. I liked using Configatron to power the configuration, but I didn’t like the way I implemented the way I was using Configatron. For example, to set up one of the default settings, like the expiry time, you would configure it like such:

configatron.cachetastic_default_options.expiry_time = 30.minutes

Now you would configure that same option like this:

configatron.cachetastic.defaults.expiry_time = 30.minutes

That’s a little savings, but it really hits when you want to configure a particular cache. Let’s say we a cache called My::Super::AwesomeCache, to configure it in past versions of Cachetastic we would do this:

configatron.my_super_awesome_cache_options.expiry_time = 15.minutes

Now in Cachetastic 3.0.0 we configure like this:

configatron.cachetastic.my.super.awesome_cache.expire_time = 15.minutes.

As you can see all configuration now happens under the cachetastic namespace in Configatron. Then it’s a matter of using a Configatron namespace for each of your modules. I find it a lot easier to manage.

Another change in configuration is that in previous versions if you wanted to override one default configuration value for a particular cache,  you had to override them all. Now, you can just override the one value  you want, and the rest will be nicely inherited from the defaults.

Speed

Cachetastic has always been a very fast library, but I knew that more could be squeezed from that stone. With Cachetastic 3.0.0 you now get a hefty 25% improvement in the Memcached adapter and a whopping 99% in the LocalMemory adapter! Those are pretty awesome numbers. These numbers were easy to achieve when I stepped back and examined what it was I really wanted to do, and picked the most straightforward path to that goal.

Bloat

After more than two years Cachetastic was starting to suffer from a severe case of bloat. For example, I’ve never used the DRb adapter, have you? So why is it there? The same goes for the HtmlFile adapter. I wrote that because at my last job the operations team weren’t savvy  enough to be able to get Apache to talk to Memcached, so they wanted to serve HTML files, hence the rather awful adapter. Both of those adapters are now history.

There also used to be support for Rails Session Caching. Considering that most people are now using the Cookie store for sessions, there really is no need for this cache. It could also be argued that it should not have been bundled with Cachetastic at all. I would agree with those arguments. Cachetastic is, and should always be, a standalone caching framework, that can be plugged into Rails or any plain old Ruby project that needs caching support.

Also purged is automatic support for mixing in the Cachetastic::Cacheable module into ActiveRecord. If you want this functionality, it is very easy to include in your application. I don’t want to force it on anyone, so that is gone now.

Finally there are a handful of smaller features that I’m sure no one will miss that I’ve yanked out in the name of performance, reliability, and ease of maintenance.

Nice and Clean

When I realized what I really wanted, and what I didn’t want, it became clear that what was needed was a fresh code base. With that said, I hit delete (well, not really) and started over again. The code is now smooth, so much easier to read, and fast. In previous versions even my eyes went a bit crossed when I tried to figure out exactly what was going on. There where quite a few levels of indirection, and things just weren’t place where they probably should’ve been. That has all been fixed.

With a nice, clean code base comes a brand new set of tests. The tests are now extremely comprehensive, and while 2.x was very well tested, I know that 3.0.0, is tested to the hilt.

Because 3.0.0 is a brand new code base, I should probably stress the fact that is NOT backward compatible. So please be advised.

Installation:

$ sudo gem install cachetastic

Conclusion

I really hope everyone likes this brand new version of Cachetastic. I’m very happy with it, and I think if you give it a chance, you will be too.

If you’d like to have a peek at the RDoc, it can be found at:
http://cachetastic-api.mackframework.com/

Distributed Programming with Ruby Book Update

May 22nd, 2009

Hey there folks, I know it’s been awhile, so I thought I would give you all a very quick update as to how the book is going. It’s going really well. I’m about 100 pages into it, and it’s shaping up very nicely. Addison-Wesley is preparing to put it into their “Rough Cuts” program so you can all get your dirty little hands on what I’ve written so far as early as a few weeks from now, or so I’m told.

While I don’t want to give too much away about the contents, everybody loves a good surprise, let me say that part one of the book will be the most comprehensive guide to DRb and Rinda that you’ll find anywhere. Including the source code!!

I’m working hard on part two of the book which focuses on third party tools, frameworks, and libraries. It’s quite a fun part of the book to write as there are a great deal of choices out there, including my own Distribunaut. (PS. I released a new version of it on GitHub a week or so ago.) Writing about different libraries is quite fun as I get to really delve into the source code and see the good and bad ways people like to write code. Plus some of the libraries have really great features, or really turn things on their head.

When the book is available as a “Rough Cut”, I’ll certainly keep you all informed. In the mean time keep watching this space and have a great weekend!

Distribunaut

April 5th, 2009

Hey there everyone, it certainly has been awhile, a month by my count. I have been diligently working on a book for Addison-Wesley called, “Distributed Programming with Ruby”, so having the time to blog went from a luxury to almost non-existent. But here’s another little post to keep your RSS feeds happy.

I’ve started working on porting the mack-distributed package to the non-Mack world. This new project, and I use the term new loosely for the time being, is tentatively called Distribunaut. The project on GitHub can be found here: http://github.com/markbates/distribunaut/tree/master. It’s pretty rough right now. I’ve ported over the distributed objects section of mack-distributed, but not the views and routes.

You can install the gem like such:

$ gem sources -a http://gems.github.com
$ sudo gem install markbates-distribunaut

To use Distribunaut we first need to start a Rinda::RingServer. Distribunaut comes with a binary to help make this easier:

$ distribunaut_ring_server start

Once we’ve done that we can create an object we would like to share:

When we run that we can access it like such:

That would result in the following being printed out by our ‘client’ code:

On our ’server’ side we would see something like this:

This is, clearly, a very simple example, but it shows you how easy it is to use Distribunaut. We haven’t done any real configuration, and things just magically work!

Over the next couple of months I’ll be extending and rebuilding this library to make it even more powerful and easy to use. I’m going to add fault tolerance, selection algorithms, and whole lot more. The API you see in these examples will most likely remain unchanged, but I’m planning on pretty big under the cover changes.There will be a very in-depth look into all of this in the book, obviously. (Shameless plug, I know.)

If anybody out there wants to contribute to this project, I’d love the help. Any sort of feedback is welcome.