Archive for the ‘OpenSource’ Category

A Case for Virtualization

In Computer science, OpenSource, Software Engineering, Tools on December 7, 2011 at 9:56 am

Maybe I’m late to the party, but until recently I had not paid much attention to using virtual machines on a regular basis. I figured that since I had a couple of desktop Windows systems and a couple of Mac notebooks, I’d be able to use almost any software I wanted without any problems. Well, that’s probably true, but when you begin to use lots of different software tools, especially open source tools that have many dependencies, things begin to get really sticky. And, when you try to figure out how to put together the software needed for students in your courses…well, let’s just say that if I had any hair left on my head, it would be gone. I am convinced that dependencies are the hobgoblins of open source.

If you’ve read some of my more recent posts, I’ve been playing with Cucumber for use in my upcoming Testing for Developers course. I want the students to be exposed to lots of tools and that means that we have a need for lots of different languages, especially some of the dynamic languages, on the system. While Microsoft makes developing software for Windows relatively easy, it’s not my favorite platform for doing anything outside of the Microsoft ecosystem. I understand that and I’m not complaining. In the words of Bill Belichick, “it is what it is.” So, I do almost all of my development on my Macbook. It’s fast and it’s pretty much Linux (the key words here are pretty much).

If you stick to just Java, C, or C++ it turns out that almost any platform works as well as the other. I mean, if you load MinGW onto a Windows system you have the ability to develop from the C family. Add Eclipse and you’ve got a pretty portable IDE. But, when you start to look out from these languages, things get really murky.

A Concrete Example

Let’s look at a real example of what I’m getting at, setting up Cucumber for the class. We’ll start by just considering my Mac setup. Cucumber is written in Ruby and works really well if you have simple scenarios that you use to exercise some simple Ruby code. By simple Ruby code I mean code that has no GUI, database, Internet, or other features. In other words, code that’s probably not very useful for a real application.

As I went through the examples in The Cucumber Book, I began to need additional components like Sinatra, Capybara, and a many others that I have no experience with. Well, how do you get all of this to work? Do they all really work together seamlessly? Maybe, if you have the right versions and the right versions of Ruby and other gems that you have.

It turns out that I had four versions of Ruby on my system. I had ruby 1.8.7, 1.9.1, 1.9.2, and MacRuby. What’s worse is that I didn’t realize it. Some of them were installed in a standard location (whatever that means). If I reordered the sequence of directories in my PATH, I got a different version of Ruby. I needed some consistency. I was using Ruby 1.9.1 and things were going along fairly well when I needed to get the service_manager gem. I installed is using the standard “gem install” approach. Then, when I tried to use it, there was a problem with readline.

After several hours of searching the Web, tweeting to a few friends, posting on stackoverflow, and The Cucumber Book forum, I got an answer that let me get past this. But things had deteriorated to the point that I had no idea what was installed, where. I had used bundler for some things, gem for others, and done some downloading packages, source code that I built, and other ways of getting the software on my system. I also tried rvm, but frankly by this time I wasn’t sure what I was doing and the documentation wasn’t very helpful. Do you need to be using bash? How do you get it working with other shells? I was sitting on a software stack that was about to come crashing down. I could feel it in my bones.


I decided to remove everything Ruby on my system and start over. Okay, that was another few hours, making sure that I copied everything I removed just in case I really messed it up. I finally was ready to start over. Thanks to Matt Wynne, one of the authors of The Cucumber  Book, I ended up using rvm, the Gemfile from the latest version of the installation appendix in the book, and I got the right version of Ruby installed along with the gems and packages I needed. Now, this wasn’t perfect, but it was manageable. Some of the documentation was a little bit off and I had to get on the rvm IRC channel to ask for help, but I did it.

Enter the Virtual Machine

Well, this was great. I now had a consistent installation on my Mac. Most of my students don’t use Mac. Some use Windows, some use Linux. Since they’re computer science students—advanced undergraduates and graduate students—I’m safe assuming that they know their way around Linux. If I could get the software configured on a Linux virtual machine, I could just give the students the VM image. Then I could either add new software for other topics I expect to cover in the course or simply create a different VM image.

I’ve been using VirtualBox for some time now in order to try out different versions of Linux, running Windows on my Mac, and so on. It’s free, runs on any x86 architecture, and just seems to work pretty well. So, that was the plan. I created the VM, loading on the latest Ubuntu Linux, made sure that had some basic software like Java and a few other components. Then I went through my checklist of how to get the right Ruby and Cucumber installed and in less than a half hour I had it running. Take a snapshot so that if I try to extend the image and mess it up I can back up. Voilà, the students can work without having to lose sleep over getting their system set up. There are other things they’ll lose sleep over that are much more important.

The VM approach, and the ability to snapshot and branch off of different snapshots makes life so much easier for me as a teacher and it will save the students a tremendous amount of time. I’m sure some of the uber-geeks in the class will set up the software on their systems because that’s in their DNA. However, for those who really want to concentrate on the course topics, they can now do that without the hassle of being a system administrator. I will definitely use this approach more in future courses.

POSSE retrospective

In OpenSource on June 12, 2010 at 9:00 pm

Well the POSSE Worcester session is over. It was a good experience and I got to meet some very interesting people. We finished up yesterday with a discussion of some educational issues, both pedagogical and practical. I gave a short overview of my WPI Suite project. Although right now, this project requires membership to the SourceForge Enterprise installation at WPI to get to the source repository, you can go to the site and download the file releases to try it out. If you’re interested in getting the sources, send me a message and then apply for an account from the site and I can approve it. I’m hoping that by the end of the summer we’ll have it set up much better as an open source project.

Today I finished the code on the Measure Activity and pushed it to the posse-clone branch. If there are no other changes by Monday evening, I’ll get a merge request to Walter. Unfortunately, testing Measure in Sugar on Fedora (in VirtualBox) has been difficult. There are a lot of problems that show up that have nothing to do with the code we’re working with.

Anyway, there was a very simple way of implementing the timer task. It was using a simple Timer object from the Python library.  Once the user clicks the record button, the code now creates a Timer object that fires after the appropriate delay. When the Timer fires, it causes the sample to get logged and creates another Timer before exiting. This goes on until the user stops the sampling. When that happens the current Timer’s cancel() method is called. Simple and it works fine. I think we made some definite improvements to Measure. I don’t know if I’ll have much time to work on it this summer since I have to finish my software engineering textbook, get WPI Suite V2.0 out, and get ready for school next year.

POSSE Day 4: Getting to E

In OpenSource on June 11, 2010 at 1:22 pm

After starting the day spraining my ankle as I left home, it could only get better. We continued hacking Measure. Adding the timer task is moving along. The code isn’t very well organized and there are some duplications we’re removing. The big problem, once you find where to put things in is getting the timer thread to work. We started by looking at an example from Geoffrey Foster, but that is a blocking thread.

Before breaking for the day, we thought about using a Timer object from the Python library. The documentation is not great on it, but when I asked my friend and former student Tom Rybka who’s now at Google about it, he did a little checking and told me that Timer seemed to be non-blocking.

We just haven’t had the time to implement it. We had a productive discussion in the afternoon about education issues (the E) that we’ll continue tomorrow.

Instead of joining the group for a nice dinner I went home and iced my ankle and didn’t work on the code at all. Maybe we’ll get the threads working tomorrow.

POSSE Day 3: Taking the measure of Measure

In OpenSource on June 9, 2010 at 11:04 pm

So today we started work on the Measure Activity. It certainly needs work. The idea behind Measure is really nice. The user can use a sensor or the microphone and capture data from them. The actual data is written to the journal, probably not in the best way, but it’s there. The data can be imported into other applications for analysis.

My partner, Mihaela and I started working on ticket 1911 from the Sugar bug tracker. There are several problems we uncovered while trying to understand the code enough to reproduce the original problem and understand what the application was trying to do. Here are the things we discovered.

  • The pull down that shows “Now”, coupled with the button whose tool tip says “Start Recording” are terribly misleading It implies, as the author of the ticket seems to have understood, that the Measure will begin recording data when you press the button and stop recording automatically when the specified time ends. In fact, the time is the interval between samples and this goes on until press the button again.
  • Once you realize that the interval is correct, it actually doesn’t represent the right amount of time between snapshots. The code uses a counter and the counts are wrong. This may be due to different processor or microphone sensing rates.
  • The tool tips are quite misleading and do not exist on all of the controls on the toolbar.
  • The behavior of Measure is rather fragile. We had it crash a couple of times for no obvious reason. It also hung after we put in a debug statement, but then when we brought it back up, it worked fine. Also, when we tried to quit, the Activity asked if we wanted to keep (the entries?) it came up with a “Keep error.” This too went away mysteriously. But that’s for another day.

We’ve made quite a few changes. We added appropriate tool tips to the combo box that contains the sampling interval and to the button that starts and stops the sampling. We also changed the text in the combo box to be more descriptive and removed the choice that did nothing. Next we tackle the harder problem of controlling the timing for taking the snapshots into a timing thread.

POSSE Day 2: Getting into the code

In OpenSource on June 8, 2010 at 10:35 pm

So, today we got into the Python code for one of the Sugar Activities: abacus. Adding a new abacus to the code was very painless. The code was quite readable—at least for the things we needed to do—and very easy to work with. There are some obvious refactorings that I noticed, and that Walter mentioned, like generating some of the callbacks, etc. dynamically. I might take a whack at that sometime.

As for the workshop day, it was much less hectic. In fact, there were a couple of hours with not a lot to do. I think the group was waiting for some guidance from Mel and Walter and they were busy in IRC with some Sugar and SoaS issues. I wish we had known that and I probably would have gone and tried to focus on something interesting or at least gotten my release of WPI Suite built.

The project for the next couple of days

Jerry Breecher and I are going to look at getting some tests done for the Activity selected for the group. Right now, it’s not clear whether it will be the Measure Activity or the Sets Activity. If Walter gets Measure to the point it can run by tomorrow that will be it. In either case, it doesn’t look like there’s much of a standard for testing so it should be fun to take a whack at it. The goal is to have a good set of smoke tests that can give an indication of the Activity’s readiness. We’ll look at some existing tests from some of the modules and emulate them or try to do better (something like PyUnit maybe).

POSSE Day 1: Now I know what my students feel like

In OpenSource on June 8, 2010 at 1:17 am

After the first day of POSSE I know how my students feel when I hit them with everything at the beginning of the software engineering courses. This immersion is great. In some ways, it’s utter chaos, but one begins to feel somewhat comfortable by the end of the day with some of the tools. I think that getting Fedora set up in VirtualBox was the most frustrating for me. I didn’t quite get it right this morning and was behind for most of the day I finally got that tonight. This video on YouTube helped a lot.

What was frustrating—too many accounts needed to be set up. A single login for all of them would work really well. That’s the only thing that got me frustrated.

It was kind of cool getting to use some of the tools that I haven’t used before. I’ve never used it before. I’m not sure I like it. There’s just too much going on and it seems too easy to miss things that are meant for me. I prefer using IM, but I am willing to bet that there are ways of filtering things in IRC. Hopefully we’ll get to that tomorrow.

I’m looking forward to the actual activity we’ll be working on this week. Even though Python isn’t my favorite language, I think it will be interesting using it on something real and see how things go.

Like my students, I’m suffering from information overload, but I know that it will all come out okay. That’s the alue of experience.