Wicket Impressions 1

Posted by Berin Loritsch Fri, 04 Dec 2009 14:02:00 GMT

I chose Wicket for this project, partly because I met some people who were very enthusiastic about the framework, and partly because I wanted something that was easily tested. My client requires a Java solution, so Ruby on Rails was out. I did a quick little shoot out between three Java framework options, and Wicket passed the first impression stage.

Now I’ve got a couple of iterations of software development with it under my belt and I’m starting to feel a bit more comfortable with the framework. As far as Java web frameworks go, its pretty good, but… I would do things a bit differently. The application is written in a style that would actually better fit Ruby, SmallTalk, Lisp, or some language that supported passing in procedures or lambdas (as the language gurus call them) natively. Take for instance the Link class. In order to do anything useful, you need to subclass and implement the onClick callback method—even if all you want is to go to another page. Here is an example:

add(new Link("wicketId") {
    @Override
    public void onClick() {
        // do fancy logic
        setResponsePage(new IncidentPage(incident));
    }
});

If this were Ruby the code would look like something like this:

self << Link.new("wicketId") do 
    // do fancy logic
    respond_with(IncidentPage.new(incident)
end

So am I complaining about semantics? Possibly. However, there are more “Java” ways of accomplishing the same class—particularly if you want to manage all business logic in a few classes. The more “Java” way would be something like using the java.lang.Runnable interface. That would allow you to set up an enum to include all your business logic like this:

enum IncidentLogic implements Runnable {
    EDIT {
        @Override
        public Page run() {
            // do fancy logic
            return new IncidentPage(incident);
        }
    }
}

and it would be used in your page like this:

add(new Link("wicketId", IncidentLogic.EDIT));

I’ve also experimented with using a dynamic proxy to bind any method to an interface. That would let you set up a logic utility class and reference it like this:

add(new Link("wicketId", Linker.link(IncidentUtility.class, "edit"));

It’s not as pretty but it works. Now here’s the nice thing about Wicket. If I feel strongly enough about it, I can create my own subclass of the Link object to implement that approach myself. My DynamicLink would look something like this:

public class DynamicLink extends Link {
    public static interface Executable {
        Page do();
    }

    private final DynamicLink.Executable click;

    public DynamicLink(String wicketId, DynamicLink.Executable action) {
        super(wicketId);
        this.click = action;
    }

    @Override
    public void onClick() {
        setResponsePage(click.do());
    }
}

In fact, I think I may just do that. It’s better than having bits and pieces of behavior spread throughout the Pages and panels defined in the application. I think I find it a bit frustrating when i need to do things like that just to format dates the way I want. Why can’t the provided DateFormatter let you set the pattern you wanted to use? Why do I have to subclass the one in Wicket just to get that feature?

At the end of the day, my complaints are minor and the Wicket community is helpful. I’m fine with that. The Wicket framework is probably one of the leaders in providing a test harness that can be used easily in your JUnit tests. That is a much bigger selling point to me.

Ruby IDEs Come of Age 2

Posted by Berin Loritsch Fri, 16 Oct 2009 02:07:00 GMT

Aptana logo
RubyMine 2.0
There’s nothing better than finding that sweet spot with developing your software where your tools work with you, and all is right with the world. With Java that started when JetBrains introduced their IntelliJ IDEA product. That product changed the way we think about integrated development environments, and even the open source alternatives like Eclipse imitated the features included in the IDEA product. At some point they specialized differently, each with their own set of pros and cons.

The Ruby development environment lagged seriously behind with people content to use glorified text editors.

Ruby on Rails brought a whole new community of developers to the Ruby platform, many who were curious malcontents from the Java arena like me. For folks who were used to the IDE integrating with your version control system, and even your issue tracking system, going back to text editors alone wasn’t going to cut it. Yet, so strong was the pull from Rails that some enterprising folks started creating a Ruby IDE: RadRails. RadRails is now a plugin for the Aptana web development platform, and Eclipse based tool. Aptana was my IDE of choice for quite a while. Since I was already used to Eclipse, and I had a set of plugins that I already enjoyed using, there really wasn’t much reason to switch. Except for this nagging feeling things could be better. I was still sorely missing refactorings, decent intentions, and working type-ahead for the Ruby API. Sure I was aware of the technical limitations, but I knew it could be done.

I limped along until I noticed that the Ruby Language had made Ruby 1.9.1 the new official Ruby. It had Rake and RubyGems as standard components, so there will be no issues with the stinking Linux distros that refuse to make an RPM for RubyGems. It’s all included. Of course, there are still some growing pains with some gems. Check out Is it Ruby 1.9 for details (they have a sister site for JRuby in case you are interested). I had an upgrade project ahead of me that required some features from Ruby 2.3.x, cleaning up, and security enhancements. Since I had to re-implement the site anyway, Ruby 1.9 was measured to execute faster, and I had the liberty of doing so, I decided to make Ruby 1.9.1p243 the new baseline.

That’s where my troubles began. It wasn’t just the Gems either. The IDEs just couldn’t handle it. They turned into glorified text editors with the ability to track commits. The debug feature was broken.

I remembered the Zen like experience that I had with JetBrains IDEA from the Java world, and knew they also had a product for .NET. I hoped they had a product for Ruby, and sure enough they have the RubyMine product. If you are looking at Ruby 1.9, or Rails 2.3.3+ don’t look at RubyMine 1.1.1. Look at their new RubyMine 2.0-beta. This is what Ruby programming should be. The price point is currently $79 USD with the current promotion, but normally it is $99. That puts it in the range that mere mortals like me can afford. It works quite nicely with Ruby 1.9, and even Rails 2.3.4 (although that wasn’t the version they developed against). I have my refactorings, my intentions, my effortless subversion integration. Formatting works. It’s fast. Type-ahead doesn’t flake out. Debug works (made possible with coordinated efforts between myself, the debug-ruby-ide gem maintainer and the JetBrains team—the latter two doing the heavy lifting). Let me tell you, JetBrains is as good and responsive as they always were, and the Ruby community is like the Java community used to be, but better and more pragmatic.

Aptana and RadRails will catch up, it’s a matter of time. However, JetBrains RubyMine works now, and it works better and faster than Aptana. On Windows, RubyMine performance is acceptable (on par with Eclipse), but on Mac it sings. Eclipse/Aptana’s performance doesn’t change no matter what platform you are on.

While I’m at it, I do have a major gripe with the Eclipse baseline. As a developer, I have a list of plugins I depend on because those features don’t come out of the box with Eclipse. However, the Eclipse developers who are ever moving forward, break the plugin API and the plugins I need to use. I can’t download a version of Eclipse and expect it to work properly. Then, if I have to hunt around for an older version, God help me. At least Aptana goes through great efforts to provide a stable and usable baseline. OK Eclipse, how is it that you provide an IDE for developing enterprise applications, and you don’t bundle the plugins for Subversion, CVS, and GIT? If Aptana can do it, why can’t you? It’s unthinkable that a responsible developer will touch code without the safety net of a version control system. Give them tools out of the box so they don’t have to separately install these plugins. Support the open source projects around you, so open source version control systems should have preferred status. And don’t release a version of Eclipse until you’ve got those plugins working with it. Really. I mean it. It helps you out in the long run.

"Beyond" the Zone System

Posted by Berin Loritsch Mon, 22 Jun 2009 12:14:00 GMT

In the process of trying to coerce a working system in my darkroom, I purchased the book “Beyond the Zone System” because I know it has a lot to help understand sensitometry. What appeals to me is the ability to both test the speed of your film and the development time within 6 sheets. Since Ansel Adam’s film speed test takes seven sheets and an unknown amount of sheets for the dev test (at least one but in practice a few more), I’m all about conserving resources. The cost of the sheet of film is only one part of the cost—it’s the investment in time that I’m most concerned about.

BTZS starts out with a nice little overview of how paper and film work together to make the finished image. It also has a review of all the types of math and graphing theory that pertains to this testing process. The math’s not that hard, but the problem is in the way it’s presented. You can tell the author has a wealth of information, and he tries to make it accessible all in one or two chapters, but you almost end in confusion.

Where my head really starts swimming is when he gets in to calculating film speed. With Ansel Adams, it’s simply a density of 0.1 over film base+fog. The author covers the history and the pros and cons of how film speed was calculated over time, instead of just choosing one and teach how to do that one. It’s useful information, but the alternatives could be moved to an appendix to make that section more accessible.

With a proper handle of the basics of how the film and paper relate to each other, you can intelligently make decisions on exposure, development, and printing decisions. The road to understanding taken in the BTZS approach is very technical, which is not for the feint of heart. However, once you’ve learned the basics, you learn useful bits of information. For example, changing development times is similar to changing apertures—they both follow the same geometric progression of numbers (4, 5.6, 8, 11, 16…) to produce the same changes in final density. Shutter speed times and film speed numbers follow the same progression of numbers.

If you are serious about understanding more about how your materials work and respond to light, this book is definitely something you should have in your library. It will take time to “get it”, but once you do it will help you with your final results. You have a better understanding of why you choose a particular density for your print materials. You also have a better understanding of how zones don’t equal stops of exposure—yet the two still relate predictably.

Safari on Windows, How do you feel about that? 1

Posted by Berin Loritsch Fri, 10 Aug 2007 11:52:00 GMT

As a matter of fact, I am writing this article in Safari on my Windows laptop right now. It’s a beta application, which you can download from Apple any time you want. Apple has its sites on expanding the browser war a bit, and leveraging the good will from iTunes to get people to switch to Safari. That’s an interesting move. In Steve Job’s Keynote introducing Safari on Windows (about an hour into the video if you want to skip ahead of the OS X Leopard announcements) they replace Firefox and “Other” browsers’ market share instead of encroaching on IE’s market share. My opinion? That 2% not using either IE or Firefox will likely continue using what they are using, particularly if this Opera fanboy is any indication. I also doubt they will put a serious dent in Firefox’s share.

There’s some impressive numbers thrown around by the benchmarks, but benchmarks only show a part of the picture. More than one person is very skeptical about the whole proposition. But is Safari all that bad? Sure it has it’s rough edges, and its a beta, but are these just haters speaking? You know me, I’m not satisfied until I get my hands dirty and form my own opinion. I believe there are some features not fully funished yet, and things can only get better.

The Good

Safari is not the complete loser that some people make it out to be. First, the text rendering is better than either IE or Firefox on my laptop. Firefox needs the most improvement in this area, although it is better than it used to be. The tabs work pretty well, although moving them around is really not that important to me. The user interface is pretty clean, and the RSS feed and bookmark features are pretty nice. If you are familiar with Firefox, you’ll be familiar enough with them. Big text areas like the one I type into to write this article has a little handle on it so I can resize it the way I like. That comes out of the box without any issues whatsoever. Many sites render better in Safari than in either IE or Firefox. It’s like there is some magic voodoo done on the images (maybe like gamma correction done properly) where they seem to look a bit better. There’s a few very subtle things throughout Safari that are nice, but difficult to talk about. Have fun playing around with them.

Now, if you really want to bowl me over with an Apple unique browsing experience, give me that page flipping thing you do with your finder in Safari. That would be really cool! Sometimes when I’m browsing along with several tabs open because I saw something that caught my eye but I want to get back to it, I have a number of tabs open. The little bit of text in the tab title doesn’t always give me an idea of what’s on that tab (and many times that’s the fault of the web designers not giving a decent and succinct title in the page header). I looked, after all this is an Apple product and they have it in iTunes for movies and TV shows. Why not here? Note to Firefox: if you want to add a killer feature give me a way I can quickly go through the things I have open in my tabs. Opera has the thumbnail view, Apple may take my idea (or come to the same conclusion themselves), so this is where you can do something cool.

The Bad

There are some definite quirks. First, despite the hype over the speed, I haven’t seen any real improvement over many of the pages I frequent. My blog takes longer to render than Firefox, and some things just don’t work. For example, I can’t upload files to Typo with Safari. Typo uses AJAX to give me a progress bar, and Safari gets one refresh and stops sending the file. Also, the WYSIWYG editor in Wikispaces doesn’t work in Safari. It’s a problem because I use Wikispaces at work. I’m sure they’ll fix this. I mean if they are serious about taking market share from either Firefox or IE. Another major issue? My OpenID has a feature to install a certificate on your browser for authentication purposes. Unfortunately it does not work with Safari because Safari does not send a certificate request, or a properly formatted one. Again, if you claim to be standards compliant, you have to be completely standards compliant.

There is a feature in the “Edit” menu under “Spelling” to check spelling while typing. Well, its not working and not selectable. I can type something obliviously wrong and it won’t be flagged or corrected. Firefox takes care of this really easily and nicely. I’m sure there are other features that are not working, but I’m probably not going to look into and find them all.

I don’t know what happened yesterday, but Safari became unstable. It just started churning away, eating up all my processing power as it tried to load even the simplest pages. It would churn along for about a minute or so and then render the page—very slowly. I uninstalled and reinstalled Safari and it is working now. That’s OK for a beta, but don’t let it happen in the final release.

The Ugly

I’m not a fan of the blue progress bar behind the location text. It took a few pages before I realized what was going on. I find it distracting, but not a deal breaker. It’s just how they chose to show how things are moving along. I’m also not a fan of the non-standard RSS badge in the location bar. IE, Firefox, Feedburner, and almost every RSS generating source uses the orange feed symbol because it is a standard . Again, if you are going to support standards, please do so. Also, if you are going to differentiate yourselves do it on something that matters and not something like this.

The bookmark handling is fairly nice… when it works properly. The link dragging is still a bit too quirky. I had difficulty dragging links into a folder. All that would happen is the bookmarks would rearrange themselves, which is not what I wanted. Please, take a lesson from Firefox on how to do this properly. I mean, if you are serious about taking marketshare from them you have to be better, not worse.

Tabs in Safari are OK when you have a mouse, but they are a pain when you don’t want to aggravate carpal tunnel syndrom (I don’t have it, but mousing around is a pain) then follow Firefox’s lead with the key combination shortcuts. Ctrl-Tab should move from you to the tab to the right (and wrap around when you are at the end), and Ctrl-Shift-Tab should move you to the tab to the left. In Safari they just move you further down the page. That’s what the Page Up and Page Down keys are for.

The location bar has autocompletion help for you, but I’m curious what selection criteria they use. I started typing the URL for Technorati and the first option was Them Anime Reviews and I haven’t been there in this browser. I typed in the URL for BH Photo Video and one of the first options (before I actually went to BH) was Bleach Portal . I’ll admit I do visit all of these sites on occasion, but it makes me wonder what kind of fanboys are working on Safari :)

The Verdict?

For now I’m going to stick with Firefox as my main browser, but I’ll continue to keep my eye on Safari. Despite its quirks, it has some big advantages over IE, but it doesn’t match Firefox at the moment. I won’t talk about Opera because I don’t have it, and people who are willing to pay for a browser are going to be really happy with what they bought. I think that it is really telling that among the Mac visitors I get, most of them use Firefox. I can only guess that they use it because it is better for them than Safari.

Please, Safari developers, fix the spell checking, the tab quirkiness, the outright malfunctioning things, and give me page flipping. That would rock.