Archive for the ‘Uncategorized’ Category

Testing private classes in Java

When you’re doing test driven development you often run into the issue where you want to test package level classes and/or private/protected/package level methods on classes.  So what do you do?  Either you open up your design to make them testable or you use JUnitX.  Given that I don’t think it is a good idea generally to over expose yourself in public, I tend to go with JUnitX.  Better for you.  Better for me :-)

 

Here’s what my test code looks like (which lives in its own unique test package):

 

public class MyTest extends PrivateTestCase

{

….

public void testPrivateMethodCall() throws Exception
{
    // where Coffee is a private class within the package
    Object privateClass = newInstance(”com.cognifide.cafe.Coffee”, NOARGS);

 

    // AND drink is a private method on Coffee
    invoke(privateClass, “drink”, NOARGS);
}

}

Unfortunately, it is a bit quirky, and you have to create a boiler plate TestProxy class in the package for all classes that you want to test in this way.  But I’ve taken a look at the source and you can get round this by tinkering with junitx.framwork.TestProxyFactory.createProxyFor().  I just haven’t got round to doing it.  If you do, please drop me a line and send me your patch…

Eclipse is Good, IntelliJ is Better!

I have not done any serious Java programming for the last year as I’ve been busy with other stuff.  Today I installed IntelliJIDEA Version 7.0 Miletone II.  After 15 minutes of re-adjustment and getting use to the oh so heavy Java stack again (Spring, Hibernate, Web Frameworks, yada, yada, yada…), it was as if I was home again.  You know that feeling, where things just click!  I have never had that level of comfort with Eclipse.  I doubt I ever will.  Boy how I’ve tried, and been nagged at by various developers.  But nope, Eclipse and I are not meant to be… 

 

Anyway, I’ve got 60 days left to do some damage…rock on IntelliJ.

No Fluff, Plenty Of Stuff

I  attended the first European No Fluff, Just Stuff (NFJS)in London today and it was a hoot!  Great food.  Great people.  And plenty of technology around dynamic languages, functional programming, rich internet applications, agile techniques, yada, yada, yada…  Thanks to Wendy and crew of SkillsMatter for making it a really enjoyable experience. 

 

Clearly, I have been spending a lot of time walking the walk, and enjoyed these 3 days listening to similar minded people talk the talk.  I had a favourite speaker at the conference, Neal Ford, that I had to actually explain to him at the end that I was not really stalking him.  In all, I attended all but one of his many talks, and his keynote was real thought provoker.

 

Anyway, I have a lot of things to think over that I will drip feed some of my thoughts in this blog over the next couple of weeks.  The NFJS guys also gave away 10 books, 5 IntelliJ licenses and a Nintendo Wii Games Console, in that order, to those that attended the conference by picking delegate names out of a bag.  Guess whose name came out first, Miro Walker, our (Cognifide’s) CEO.  Unfortunately, because he couldn’t make it that day, he didn’t get the prize which would have been first choice of the 10 available books.  Shame! 

 

Now, guess whose name came out last and is now the proud owner of a spanking new Nintendo Wii Games Console…:-)  Yours truly!  Thanks NFJS.  Much appreciated.

 

Damn, I’d forgotten just how much I love conferences….

Year of the Ruby

Now, I wouldn’t call myself old-fashioned, but tradition is tradition.  Every year I commit learning a new (programming) language.  This year, is the Year of the Ruby!

 

I was in my hotel room last night and had 30 minutes to spare.  So I googled ‘ruby’ and was not surprised to see that main ruby site http://www.ruby-lang.org is ranked above the actual gemstone itself (It’s like having to google ‘java island’ to get to the island in Idonesia - wierd). 

 

Anyway, moving on, I read the twenty minute tutorial, which is really 10 minutes if you know another language, and was impressed.  With twenty minutes left before the witching hour (dinner with a beer), I downloaded and installed ruby and wrote my first application, without a main function.  Very nice! 

 

I want more Ruby.  If reads like prose compared to a lot of other languages.  Let’s see how the rest of the week goes…

Agile Customers need Agile Partners

I’ve been looking for an “article” like this for a long time (thanks Seb).   It’s funny that it pops up in the gaming industry, but then again gaming is a pretty fluid marketplace. 

 

The article about a company called Remedy Entertainment from Finland that is the maker of Max Payne (and the forthcoming Alan Wake).  Remedy are embracing the change in the gaming industry.  Remey needed to adapt to remain competitive.  You see Remedy understands that it needs to retain a small, highly experienced team that focuses upon assembling games.  This is what they know how do well.  This is their core knowledge.  Their primary business asset.  The bits around the edge pertaining to games engines and the like are essential, but secondary.  So Remedy decided to partner with companies that can deliver these secondary assets in support of its core business skills.

 

Now, the interesting part for me is that a company like Remedy, if it is to remain successful needs partners that it views as an extension of itself.  Ones with high quality standards, best practices, evolving skill sets and a no nonsense attitude to software development.  In short, like minded companies.    To quote Remedy, they need partners in which:

 

  • “Every team member is focused on shipping a masterpiece.”
  • “No politics, no egos, no empire building, no nonsense.”

 

I bet that Remedy have to look long and hard to find partners like this.  It is one of the primary reasons that Cognifide came to be and continues to inspect and adapt its internal processes to meet customer requirements such at these.  I’m not saying its easy.  It’s certainly challenging but most definitely a worth while pursuit.  It’s great to see customers are looking for quality and putting in the necessary time to ensure that they get it.

Who is behind Facebook?

In the UK at least, facebook has exploded.  At lot of my friends (and not friends :-) ) have started turning up in there.  Why?  I have no idea.  I only registered because I was forced to.  I wanted to go out but the organiser put the details on a wall within facebook.  How annoying?  Anyway, now I’m in I get notifications every other day about someone says this, someone is feeling that or someone has found me.  It’s weird.

 

Then I stumbled across this you tube write up on what is faceback.  Let me know what you think?

The Daily Scrum

Totally in jest, but the reason “Scrum Masters 2” is so funny is that you know you’ve been there.  I love it!

 

This is something you should show your new scrum teams…