Pages

Sunday 20 February 2011

Java2word in numbers statistics

Java2word started in August 2010. Since then, I have spent many hours of my own time to implement this code. There has been a lot of collaboration from people all over the world. 


Last 30 days: 
  • Visits: 850  
  • Pageviews: 3,189 

At all times(7 months):
  • Visits: 3,429
  • Pageviews: 15,146

Now we have style, fluent interface, over 92% test coverage.
Unfortunately I can't fit cucumber here...


TODO:
  • Knock off some cyclomatic complexity
  • Get to 100% test coverage
  • Make font-size work
  • Implement bullet points


I decide to write in one unit test that uses all elements of the API. This works like a documentation/demonstration  of what can be done with java2word.


Take a look at the project page and search (ctrol + f) for "testJava2wordAllInOne"

https://code.google.com/p/java2word/



thanks everyone for helping!

Leonardo Correa
 

Saturday 19 February 2011

Java2word covariant return type

When I was studying for SCJP exam, in 2007, I had to learn a lot of things that didn't make sense and I thought that I would never use. 

Today, in my Java2word library, I utilized Covariant Return Type.

This basically is when you override some method, you can return any subtype of the original return type. Eg.:

The class ParagraphPieceStyle extends AbstractStyle and overrides the method create().

public abstract class AbstractStyle implements ISuperStylin {

    private IElement element;
   
    public void setElement(IElement element) {
        this.element = element;
    }
   
    public IElement create() {
        return this.element;
    }
   
}

public class ParagraphPieceStyle extends AbrstractStyle{

    @Override
    public ParagraphPiece create() {
        return (ParagraphPiece) super.create();
    }

}


The original return type is "IElement" but returns "ParagraphPieceStyle".The advantage of this is the flexibility to return any subtype of the original type.

this is the code without Covariant:

ParagraphPiece myParPiece01 = (ParagraphPiece) ParagraphPiece.with("...");


This is with covariant:

ParagraphPiece myParPiece01 = ParagraphPiece.with("..."); 

Now I don't need to do a type cast (downcast) of the type.




https://code.google.com/p/java2word/


cheers

Leonardo Correa

Saturday 12 February 2011

My Dexter Addiction

what is our concept of wrong and right? how about punishment; how should we punish someone that does something wrong? Have you ever thought that you would like someone that kills people?


Friend of mine called Dylon talked about a TV serie that the main character is a serial killer. I couldn't believe it! But he said: He kills only bad people!
Yeah... sounds cool...

I downloaded some episodes, watched them and quickly became addicted to it. It surprised me the  number of people supporting the ideas behind Dexter.
On the other hand, there are lots of people against Dexter's concepts - I respect their opinion.


I must define "bad people" at this point:

Murderers, Brazilian Politicians (all fucking corrupt politicians and policemen), presidents and ex-presidents of some countries, ..., ..., ..., this list could never finish...


The pleasure to see real punishment, punish whom ever f$%#ng deserve is priceless. We are sick of bad people* not being punished properly.

 Dexter judges and executes the sentence at the same time. He efficiently does what the system can't do it.

Surely no one wouldn't mind if Dexter applies his skills on Brazilian politicians - I think they deserve... fucking deserve. Conventional justice doesn't work for then.

If you grew up in a first world-country (or decent place), you have NO idea what I am talking about here. You may have never seen corruption in the same way.

I have seen so much corruption in the government. I used to be an accountant and worked in the treasure department for 3 years.


 Everybody has their own secrets. I love when Dexter is holding his baby and says: "I ll tell you a secret - daddy kills people, but only bad guys..."

In my point of view people love Dexter because the world is missing a very simple thing: give bad people what they deserve. At the end of the day what we want is justice, nothing more...