The following is a guest post by Micah Corn and originally appeared on his blog.
Time is winding down, time is speeding up.
As I sit here opening up the bcrypt gem, I realize that this is something that I am going to have to do on a consistent basis. I realized real quick that I will not be able to coast through things when it comes to programming. There have been some things in my life in which I knew I could mail it in. This is not one of them.
So I am inside browsing around in my gem dir, looking for stuff. What kind of stuff you ask? Well, stuff. If I knew what I was looking for, I wouldn’t be in here looking for it would I! I open up the lib file and spread out the bcrypt.rb file and begin reading.
The first thing that I notice is how well written it appears. I actually don’t know enough good code to compare it to, but compare to my smashing examples of code, it appears well written. The commenting inside of the file really helps out. Some of the mathematical wizardry that is going on in some of the methods will continue to be out of reach, but at least the author of the code attempts to tell you what is going on. I look back at the code that I wrote and realized the lack of explanation in it. This seems to be a bad thing. I think if you are able to take a dense and compact method and break it down in a comment, this will help do two things. One, you will be able to explain yourself to other developers when they are peeking inside your code, and the other is you will be able to understand what you are trying to do. Even if you can’t refactor it now, you might be able to come back to it in the future and quickly pick up on your forgotten intentions.
Oh well, back to digging and trying to understand code. I have been thinking about blogging more and being more techie about it. So maybe this gem digging can become a habit for me and something that will force me in code and blog. We shall see.
Cool.