domingo, 12 de outubro de 2008

Writing java code on you websites

If you are used to write blog posts, wiki pages or even documentation you will endup in a situation that you need to write a code.
It is nice to have you code with color, different font or what ever. Doing it by hand is paintfull, so why not to use a plugin for that? (Ok it is for eclipse).

Are you interested on that? Take a look on Java2Html.

Managing plugins on Eclipse

Have you ever asked to yourself if it is really necessary to copy your plugins into the Eclipse diretory and make everything a big mass?
No it is not necessary to make it, take a look on this IBM article: Manage your Eclipse environment, you will be amazed how easy it is to make things organized.

Testing your equals methods

We all know that testing is something important. But there is some situations that writing a test code could be quite confusing.
One of this situations is how to test a equals method and ensure that all the attributes are tested correctly. Most of the time we just test if all the fields are equals or not.
It is ok, but it is far from being complete and usefull.

Here is a pattern that you can follow and it will insure that all the fields are being tested correctly:

  1. Create two values for each of your class attribute, with different values between them;
  2. Create two objects, instances of the class that you want to test, call one as base and the other as ref;
  3. Make this block of code for each attribute (it doesn't matter the sequence):
    base.setAttribute(ATTRIBUTE);
    ref.setAttribute(DIF_ATTRIBUTE);
    assert !base.equals(ref);
    ref.setAttribute(ATTRIBUTE);
    assert base.equals(ref);

Making things like this will insure that your test code for equals works perfect. Let's say that it is a little bit painful to make it for a big class, but of course you could automate it.

sábado, 11 de outubro de 2008

Where can I store my project?

Must of us have small projects in mind, something that could be done in our free time. The purposes for this kind of project maybe as big as the universe, but basically we always face with some new technology or things like that.
Anyway one of the requirements is where to store it? How do I control bug tracking? And mainly, is there any free place that I can have all of it?
The awnser is YES, there is!

If you search for it you will find a lot of places, but I have been working with two of them. Assembla and Incubadora FAPESP. The second one is for academic and open project, it offers a lot of tools for knowledge publishing.
The first one can be used for your personal projects, as for your open source projects. Assembla uses Subversion, Trac and offers a wiki engine for your project pages, in fact it is available a set of webservices that allow you to integrate it with your automated stuffs, like for example your CI server.

It is worth to take a look at Assembla, it is a good place to store you project. Of course if you want more advanced stuffs you can go for the payed version, although I couldn't find any necessity yet.

Have a nice project.