Archive for April, 2007

Looking for Information Application

I am looking for a good way of storing information, things like serial numbers, lists, code snippets, etc. Some of the info is personal so I don’t want to use a web based application. I looked at “Circus Ponies Notebook”:http://www.circusponies.com/store/index.php?main_page=notebook&sub=organize, but I am not sure I want something that is outline based (it is hard to store a code snippet as an outline). I am also looking for something that works on OS X.

Another requirement is that everything is stored in one app/file, I don’t want to have to continually load up different files. I would also like the application to store my information in some form of plain text so if the app stops being developed or supported, I still have access to my info.

I am currently demoing “Yojimbo,”:http://www.barebones.com/products/yojimbo/ which is meets all of my requirements except the last one–the information being stored in plain text.

Anyone have any suggestions?

Unit Tests as Documentation

One aspect of using test-driven development is that your unit tests become your documentation. They define your code’s API(Application Program Interface) and how it works. To learn how the code works, all you need to do is look at the tests.

The reasoning behind this is twofold: first, no one updates comments left in the code and second, the unit tests, if comprehensive, have to stay up to date in order to pass. This means that the tests evolve along with the code and need to be changed and updated (and not simply commented out or deleted) as the code changes.

The problem with comments in the code is that they quickly become outdated and no longer describe the code. Every time you refactor the code, if you are relying on comments, you have to refactor the comments. Whereas the unit tests have to be refactored right along with the code.

Which Windows to run on my Mac?

I have Parallels for my Mac. Now all I need is a version of Windows. I own Windows 2000. I need to buy either XP or Vista if I want something more up to date. I am not sure when Microsoft’s support of 2000 is suppose to run out. The problem is that I can’t decide which OS to install and am looking for some advice. Here are my requirements:

* It needs to be able to log into a Domain
* Needs to run under the latest release of Parallels
* It would be nice if it looked cool alongside OS X

Okay, the only real requirement is that it can log into a Windows Domain. And I am not sure that Windows Vista Ultimate can do that. I really don’t want to move back to Windows 2000 (something about not liking to go backwards), but I am not sure that Vista Ultimate can meet my requirements and XP Pro is getting hard to find.

Any suggestions?

Thoughts on joining my first ThoughtWorks project

I have been working on my first ThoughtWorks project for about a month now. The first two weeks, I was doing performance testing on the application. For the last two weeks I have been trying to learn the application due to one of our developers resigning. This project is at the end of its development process and will hopefully be going live soon. As such, we are mostly just fixing bugs right now and finishing up a little bit of development.

Joining a project at the end is very hard. It is even harder when you cannot pair with an experienced developer. We have five developers on the project. This means one person is left out, usually me due to the other developers doing more important work and the developer that is leaving trying to finish some stuff up before going.

In this type of situation, pairing is an absolute. There is no way that someone can learn an application’s domain, its code, and the technologies used in the application without pairing with someone more experienced. it just isn’t possible.

However, with that said, I have to add that the way people pair also helps. One of the developers would jump around in the code and between windows, never slowing down for the other pair to catch up. This makes it very hard for the pair to keep up and to learn.

So far, though, it has been a lot of fun and a challenge. And I like challenges, so it’s all good.

Use Hibernate Paging when processing lots of objects

At work right now I have been trying to solve an OutOfMemoryException in a Java web application. The app exposes a bunch of web services. All of which can end up processing a large collection of objects returned via Hibernate. All of which can also keep a Hibernate session opened for a very long time.

So far, the solution we have found is to use paging along with releasing the session before doing another Hibernate query. We do the query, get back a collection of objects and iterate over that collection, processing each one in turn. Then, when we are done, we close that session, open a new one and get another collection of objects.

Hibernate makes this very easy to do:

public Collection find(int page, String hsql) {
    getSession.close();
    getSession();
    int page_size = 25;
    query=session.createQuery(hsql);
    return query.setFirstResult(page * page_size)
            .setMaxResults(page_size).list();
}

I have not supplied implementations for getSession since this depends on how you are working with Hibernate (i.e., Spring or HibernateUtil class).