maandag 4 oktober 2010

What to place in @Before/ setUp method

Last week, I attended a TDD course by @unclebobmartin, and one of te practices I saw a lot was putting ALL test setup code in the setup method. This resulted in some quote like “all test methods should ideally be two lines long”. This leads to code like this:


@Before public void setUp(){
//setting up common test fixture ...
//manipulating test fixture for test1 running ...
//manipulating test fixture to have test2 running ...
}

@Test public void test1(){
//execute ...
//verify ...
}


Personally, I disagree with this statement as I believe no code should be in the setup method that is not relevant for all off the tests in the test body, so my motto is more like: “all test methods should ideally be three lines long: a setup part, an execution part and a verification part.”  It makes a test understandable by just looking at the test method itself, and that is essential if you want to have code that is easy to maintain. This leads to the following code which is generally a lot cleaner:



@Before public void setUp(){
//setting up common test fixture ...
}

@Test public void test1(){
//manipulating test fixture to have test1 running
//execute ...
//verify ...
}

zaterdag 3 april 2010

droidconbe notes

These are my very personal notes on the Droidcon.be gathering on April 2, 2010. Presentations were very short, and we were too much distracted by the twitter wall that was more prominent than the speakers themselves. It was a lot like the first Flash applications: a lot of animation distracting from what was important and creating irritation. Organizers, please make the twitter wall less dominant next time, and reduce the display time: nobody cares about tweets send 2 days ago when you're at the conference....
I did some cherry picking here, as so many topics make it hard to review them all. (Full schedule on www.droidcon.be)
  • Google keynote: we were a bit late due to public transport issues and could only follow the final 10-15 minutes of the presentation, but the impression was a bit that Google send some representative that didn't have permission to tell something interesting. On topics that she knew were coming, she had no more information than "I don't know that". And she started the first round in the battle about who's responsible for not having paying apps in the Belgian store: "ask the providers".
    But my impression could be wrong as we missed the major part of the presentation, and other participants seemed to be satisfied...
  • Mobile Monday
    "This loose network has been recognized as a catalyst for mobile innovation. Mobile Monday defines itself as the community of professionals of mobility."
    Looks interesting. I already put their session on Augmented Reality on 3rd of May in my agenda...
  • Betagroup.be
    "The BetaGroup is a group of 2.100 Web Entrepreneurs in Belgium passionate about Internet, Software, Mobile Technologies and Online Media.
    We aim to connect Entrepreneurs, Creative Thinkers, Software Developers, Digital Marketers, Web Designers, Web Agencies, Advertisers, Publishers, VC’s and Business Angels to innovate together. We want to provide a platform to meet each other, present our projects and foster new collaborations."
    I think you need to check out these guys if you plan to start your own business, but personally, I'm not that entrepreneurial (yet).
  • OneSocialWeb: provides a framework for integrating social web services into your application using XMPP. (Hey, we were no so mad after all in the good old ReNA days to use XMPP for our prototypes.)
    However, I had a bit the feeling that they were focussing a bit too much on dedicated XMPP servers, and thus not harvesting the existing social networks. But overall feeling for me was: "I wish we had that 3 years ago."
  • Game publishing on Android: a lot of interesting facts and figures about mobile gaming. I hope we have access to the presentations soon.
  • Sportwereld sportsapp - cross platform development presented an application written for iPhone and Android using Appcelerator's Titanium development environment: you write your application in HTML5 + CSS3, have access to native stuff like GPRS, camera, accelerometer, and compile directly to native Android and iPhone applications. I also looked very neat, so I immediately downloaded the stuff! (Meanwhile I found out that it only works from Android 1.6 on, which is a bit a bummer for me, but hey, you can't have it all.)
  • Build apps with Flash for Android: I expected something like the Titanium topic, but hey, Adobe keeps disappointing me last years at conferences. No access to the camera, need Froyo and new Android machines to run Flash in the browser... I think I'll skip Flash for some time...
  • Android App: STIB Very much impressed! (Unfortunately, the bus I needed to go home was not an STIB bus...)
  • Closing keynote: Ramon's vision I liked it a lot: the guy was telling all of developpers the most import lesson: it's only people that matter in the end...

woensdag 13 januari 2010

Android/Samsung horror list

I bought a Samsung Galaxy Spica running Android 1.5 last week, and had my share of problems with it. Not sure the problems are more important than switching to another OS in general, but anyway.

* Missed two times my wake up alarm in the morning. Seems to be a known problem on android. This can have several causes: closing some process on the phone (which I didn't) or something like adapting the volume while you are creating the alarm... Big frustration.
* Prediction library is only in the language of the locale of the phone. Since I want to have Dutch locale, but write a lot of messages in English, this is a big one for me.
Some paying apps seem to fix this problem: TouchPal and BetterKeyboard. Too bad they don't have that by default on the OS.
* Paying apps are only available in some countries, but not in Belgium. To get them anyway, some unofficial page explains that you can get paying apps if put a SIM card from a country that is actually supported. I tried that with an italian vodaphone card, and it actually worked.
* Tethering is not working out of the box, but you can use PdaNet (paying app, but free version has only minor limitations). Usb tethering works fine that way, but for Bluetooth tethering, you need at least Android 2.0, and my phone currently only has 1.5. Still better than iPhone though...
* When listening to music using headphones, incoming calls still go through the external speaker. Quite annoying.
* Too much unwanted notification sounds that are hard/impossible to turn down: plug in charger: BEEP, remove headphone: BEEP, ... The trick is to put the phone to silent mode, and I discovered the alarms still ring if the phone is on silent mode.
* Locking the screen doesn't lock the buttons. So, you can actually put the phone in flight or silent modus, or even totally off while the screen is locked! This caused some missing alarm for me, and missing phone calls. I think I might need some sleeve of some kind to solve this problem...