I’m working on a long post about Merb, but I figured I’d post a link to MerbCamp videos from the event in October. I was unable to attend, so these videos are really, really nice to be able to watch.
It also looks like they were able to stream some of the event live, and people participated in the conversations over IRC. Way cool.
I’ve now watched almost every video posted on the site. My favorite videos include:
- Keynote by Ezra Zygmuntowicz – Ezra reviews the core tenets of Merb and introduces Nanite. Nanite is a really cool library for scaling the backends of web apps. Basically, when you build a web app, you want to be able to respond to the browser quickly. However, some tasks take some power to process, so you can kick these tasks out to Nanite Agents. You can have as many machines running as nanite agents as you want. They can be located anywhere, and can be added as needed. Very cool.
- MerbSlices by Daniel Neighman – This is something I’ve wanted to see in Rails and other frameworks for a long time. Basically, it provides a way to build reusable applications. So, I have frequently had clients ask if I could just add a forum, a blog, or some kind of CMS to their site. Integrating authentication and user accounts across a custom site to a forum (like vBulletin) or a blog (like WordPress) is a real pain. If a forum slice or a blog slice would be a great mixin to a custom site.
- Using Multiple Databases with Merb by Wesley Beary – Wesley talks about an experimental site that he’s got on Github that uses CouchDB and a RDBMS together. As I mentioned in a previous post, CouchDB is one of the newer technologies that I’m following. Pretty cool. I wouldn’t recommend sharing images though like he talks about in his presentation just for the reason that the port may be blocked on some networks. I’m sure there are other security implications as well.
- Learning from Django by Edward O’Connor – A good presentation on similarities between Django and Merb. Fun to learn about why Django is cool.
- Keynote by Yehuda Katz – Yehuda talks about future goals for Merb and why Rubyists don’t need to be ashamed about Ruby.
I have to admit that I was disappointed in the “From Rails to Merb” video. While the discussion was interesting, I was really hoping someone would address good strategies for migrating a site to Merb. Oh well.
Overall, there is some great content at the MerbCamp site, and this would have been a very fun event to attend.
Ben Mabey just posted a really good deck of slides on Story Runner and Behavior Driven Development (BDD) from a recent Utah Ruby User Group meeting.
Don’t be overwhelmed by the 99 slides. It moves really fast, and walks you through the history and concept of BDD.
Perhaps my favorite concept from the slide show is “Design is a Process, not a Phase.” As I have embraced Behavior Driven Development, I have seen improved software design come from the process. I believe this is true because writing the specs help create a clean public interface for your objects and classes. By having the tests that verify the behavior of your code, you can easily refactor without the worry of unknowingly breaking desired behavior.
I always forget the command for doing this so I’m posting it here so I can find it easily.
If you want to overwrite accessors in rails (ActiveRecord), you will run into problems if you try to do it the same way you would with a regular Ruby object. For example, say you want to apply a transformation to an attribute as you assign it:
@person.name = 'ralph'
You always want name to be capitalized, so you would like to modify the name= method. With plain Ruby you would just do:
@name = value.capitalize
You can’t do this with ActiveRecord, you will need to use a method named
write_attribute so the method will look like:
There is also a
read_attribute method to help with overwriting the read method on your attributes in ActiveRecord
Today I was looking for some xml matchers for RSpec so I googled ‘xml matchers rspec’, clicked on the first result, which happened to be exactly what I was looking for, and I posted a comment. After posting the comment, I realized that the post had only been up for 22 minutes! That is the fastest turnaround I’ve ever seen from blog post to Google results. Wow.
I was so amazed that I took some screenshots:
Anyways, if you’re into RSpec and doing much with XML document creation, his matchers seem to be a great way to verify that your documents are being created correctly. Thank you.
Buying screencasts at Peepcode is worth every penny. The quality of the tutorials is superb. The topics they cover will increase your Rails development productivity, systems reliability, and overall maintainability.
Go check out the screencasts that are available and actually buy one. You won’t be sorry.
[Note: This is NOT an affiliate marketing promotion. I honestly love the work these guys produce.]
Behavior Driven Development (BDD) is quickly grabbing attention of developers who are looking for a better way of developing applications. BDD revolves around the idea of writing specifications for your application, writing the API that your code will need to implement to meet the specifications, and then finally implementing the API to pass all of the specifications.
I used to be guilty of not writing good tests for the code that I developed. I found it difficult to really find the meaning of writing the tests. I knew it was a good practice and would alert me if I broke my code later on, but I had a hard time figuring out what types of tests to write, and which code I actually needed to write tests for. I think this is a problem that Dave Astels saw happening in the Test Driven Development (TDD) world. See his original post leading to BDD.
Behavior Driven Development has helped me begin writing practical tests for my code, and has helped me focus on the specifications of what my application should be fulfilling. It has really caused quite a shift in my thought process.
RSpec is a testing framework that facilitates BDD for Ruby. It makes the testing during the development process work for you. You write your tests first, watch them fail (because you haven’t yet implemented anything yet), and then implement the code and see it pass. It’s a wonderful process, and RSpec makes it fun.
The above example shows some some results of some Ruby development I’m currently working on. I’m working on implementing a FamilyTreeApi client’s person method. You’ll see that you can read the tests and see what the specifications are of that particular method. The Green are specifications that the library is currently passing, and the yellow are not yet implemented.
Below is the actual test for the first specification of the client ‘person’ method description.
If you are interested in learning more about BDD and RSpec, I suggest going through the following tutorials:
One more interesting thing with RSpec. Ben Maybe has posted an article on using RSpec for your C code. This is way cool, being able to harness the power of RSpec while writing an application in C.
Has anyone else seen any other good BDD frameworks for other languages? How about more good tutorials? What has been your experience with BDD or TDD?
I just got word this week that the LDS Church is opening up an API for their new FamilySearch. I believe this will open up a whole array of innovative family history/genealogy applications. Never before has there been an API which would allow developers to gain access to such powerful genealogical resources.
It’s amazing to see how the innovations and changes that happen in the world seem to come together to help the church in moving the work forward. Richard Miller and the rest of the team at the More Good Foundation have been keeping up with the latest web trends and have been using new technology to help move the work along. It’s cool to now see the technical department of the church grab hold of some of the web 2.0 principles and put them to work.
Update: I’ve been developing for a few months now with this new FamilySearch API, and I’m loving it. I’ve got an Open Source Ruby API wrapper project hosted at Google Code.