Sunday, May 13, 2012

Bug Fix

I think I may have submitted my first bug fix. Or I just added to the noise level.
In Pharo, the TestRunner tool allows for determining how much coverage your test suite has over some package. Basically, it records all the messages sent during execution of the tests, and compares this against all the messages implemented in that package. My personal goal is 100% test coverage, though that sometimes leads to a few seemingly meaningless tests.

Development on Pharo-2.0 is moving to restructure the basic tools and frameworks in the system, which has the unfortunate side effect of sometimes breaking the tools you are using. Something happened in the past week that broke the Run Coverage tool in TestRunner. I noticed that I could patch around it by undoing a few small changes that the developers made in the system dictionary (basically, the method for finding which tool handles which class of tasks). This worked for a few days, until the tool I moved it back to was removed from the system by another patch.

I spent a couple days working in Pharo-1.4 because of this, which is stable and unlikely to have more new problems. Today, I updated a clean 2.0 image and just let the debugger show me what was wrong. Four new methods later, I was able to get a coverage list running. The Smalltalk debugger is such a useful tool!

Rather than simply emitting a message, it gives you the entire call stack. Each stack frame is live, that is, you can look at all the passed arguments, change them, inspect them, send methods to them, etc. All of the errors I received were ultimately of the form X does not understand Y (trying to call a function on an object that doesn't implement it). Rewinding 2 stack frames showed me the call site in TestRunner's collectResultsFor method, and in the debugger, I could click on the does not understand error, click create, tell it which class in the hierarchy of X to implement the message in, choose a protocol, write the (very short) code to handle the method, and restart the stack frame where the call failed, and try over.

Honestly, as a very inexperienced programmer, to have a system so immediately supportive as to allow fixing a problem with the system tools in a few button clicks, test it, confirm that it's working, and move on with my life, is a huge relief. Having a system so understandable that it takes about 10 minutes and 10 lines of code to fix a problem in the IDE is exhilarating.

The next process involved feeding this back to the developer team. In Pharo, issues are tracked on google code, and if you've opened a ticket, you can automatically document your patch. In Nautilus, I clicked create a slice, which asked me for an issue number (mine was 5839), then automatically inserted the issue description in the slice. Submitting to PharoInbox was one more click away, and if what I did was useful, that's a bug fix!


Wednesday, May 09, 2012

Milestones for this week

Well, it's already Wednesday. I plan to get as much test coverage and documentation sorted out by Friday as possible. Then on to building/reconstructing/thinking about ODE's and their solutions.


SciSmalltalk Progress and github concerns

Today, I've been working on getting better test coverage for the packages in Math for SciSmalltalk. I have documented and completed coverage for DhbFloatingPointMachine. It looks like (following Didier Besset's Book) DhbPolynomial will be next, in chapter 2.2.

I added the complex class, and it looks like there are a lot of failing tests for Trigonometric/Circular functions.

Werner Kassens is interested in adding a KDTree implementation, and I'm excited to incorporate this when it materializes.

Does anyone know how to refork/synch a fork with upstream master on git/github? I've made the mistake of committing directly to upstream, and want to catch up with the changes I've made, but don't see the way to refresh a fork once upstream has gotten ahead of me. I think in the future what I want to do is push to my fork, then pull into master.

Also, has anyone had an issue with github deciding to use korean text in button images? The hover text is english, but all the graphics are now Hangul. Though I'm open to learning new powerful magics, I'm more of a Roman/Cyrillic/Hellenic reader, and Asian scripts always strike me as too foreign.

Lastly, I created a dummy-repo to test inline images in markdown. This is nowhere as easy as it should be! Dummy Repo

Tuesday, May 08, 2012

Ubuntu woes

Urgh, once again I struggled through the semiannual fight to bring a new ubuntu release onto my machines. It looks like my laptop adapted just fine, no loss of data or functionality, and apparently multiscreen display started working again.

My desktop had an issue where the soundcard module wasn't loaded into the kernel at boot. lsmod and modprobe showed tons of good things, but sound preferences was sending all my output to dummy device... well, reinstall from disk and thank heaven I partition /home far from /bin and /boot, and a fresh install is never more than a few hours of synaptic from yesterdays machine.

Since I've moved well away from Unity, I sometimes forget how little I like it, it's like a cute little jail, with a non-configurable dock, stupid invisible scrollbars, and garish colors. Gnome 2 on the laptop and WindowMaker on the desktop are the winners, still.

Only thing left is to set static ip on boot, not sure why the 'friendly' installer doesn't ask these questions anymore. Time was, installation was full of more questions than an income tax form.

Monday, April 23, 2012

Summer of Code

I just received my congratulatory email from Google. It looks like I am set to get a lot done this summer. I will be working on Sci-Smalltalk, implementing mathematical software in Pharo.

I am very excited to move forward on this. I expect to have the best summer ever.

Sunday, April 08, 2012

Ubuntu Tour

Alright, normally the Ubuntu folks have been aggravating more each release. especially when it comes to UI divergence and pesky 'features', like the removal of locatable scrollbars.

However, in fairness, I thought this was a rather clever test-drive page:
Ubuntu Tour

The most surprising thing (besides how attractive it looks), is that they just render off-site content in firefox if you use it. The back button doesn't work, but is this a free web page proxy?

Thursday, March 08, 2012

Smalltalk First Impressions

For the past two weeks I have been experimenting with Smalltalk. I was having a conversation perhaps a month ago with a classmate, who was taking a programming languages survey, and she was mentioning smalltalk, and how weird it was. I tried to explain that it wasn't so foreign, but I may have been tainted by exposure to common lisp, so much of the dynamic nature of smalltalk seemed like a natural thing to expect from a programming system.

I started to look into squeak, and a little reading lead me to Pharo, which if you are an adult looking to write programs and learn smalltalk, offers a much cleaner UI, is compatible with the squeak vm, and has excellent development tools, and no toy like features which provide a funny first impression of Squeak.

It turns out much of what I thought I knew about smalltalk was either incomplete or just plain wrong, borrowing from things I remembered about Objective C from a furtive attempt to start using it years ago. I have been repeatedly blown away by the depth of the object metaphor in smalltalk. The inspector and explorer are leagues above the tools I had become used to (either gdb+emacs or slime+emacs). The additional scratchpads at the bottom of the inspector allowing modification of the object at runtime are well planned and very useful. The debugger at first glance looks like the slime debugger, a variety of restarts are available, a somewhat terse message regarding the offending condition, and a partial stack trace / message history are presented. But the immediate usability of the system comes in the ability to browse the offending code site, modify the code definitions, restart or proceed and fix on the spot the problem.

In two weeks, I worked through the "Pharo By Example" LightsOut program (which was Quinto in Squeak by Example), get a quick feel for SUnit and the test runner, where the tests are only a keystroke away, and can be automatically created, blindly find my way through a currency converter gui program (a la Learning Cocoa), and have created a small DFA simulator. The learning curve is a little steep, but having seen the example application, and learned the short syntax of the language (really fits on a single sheet of paper, possibly a 4x6 card), the remainder of programming seems to have been selecting the appropriate classes, browsing their sanely named selectors, putting the pieces together, and running the tests.

My DFA simulation took about 45 minutes to piece together in between classes one morning, and I am a complete novice in Smalltalk.

Things I don't understand, certainly include monticello/metacello, how to install software, which pieces are loadable but will break your system, and have certainly had my share of frozen images. I recommend to anyone starting to keep a pristine image, and if you ever start it, to immediately save your working copy as an alternate name. Monticello is very useful in packaging versioned bundles, and seems to beat fileOut handily.

The Pharo developers have a very active community, their mailing list is busy, the community is experimenting in several directions at once, and what's most important, the system is discoverable. The browsers and finders are beautiful, the debugger is amazing, the Morphic Hierarchy is easy to browse, and finding the right tool for the job is simply a matter of finding the right pieces to put together.

One thing I haven't discovered in Morphic is how to specify relative position of submorphs, so I simply give explicit locations in the bounds, and hope the user doesn't alter the initial size too much. VisualWorks' GUI Painter seems to have simple checkboxes to control this behavior (if you've used Interface Builder in XCode you will be familiar with Springies...), and perhaps it's present in Morphic as well.

I have to say a few nice things about Stephane Ducasse's well kept links to available books, and his personal efforts in pushing Pharo forward.