Friday, 3 October 2008

MAX 2008 Europe Milan, Italy — December 1 - 4, 2008

Need I say more????

This is going to be the second European max conference ever and If last year in Barcelona is anything to go by this year will prove to be an amazing display of the best in RIA.

Pragmatic Unit Testing.. wahey it's Friday after all!

I have been improving my unit testing of late and came across a great book called Pragmatic Unit Testing in Java with JUnit [ Hunt . Thomas , ISBN - 10 0-9745140-1-2]

It's one of a series of three that make up the Pragmatic Starter Kit, which together cover the essential basics for software development. A talented and wise architect on a n level project I worked on made the three books compulsary reading for new starts.

I recommend all three in the series as desktop references actually :

Pragmatic version control ; Pragmatic project automation and Pragmatic Unit testing.

Monday, 22 September 2008

SCJP Exam study

Have studied :

  • Static imports
  • Generics & collections
  • Enhanced for loops
  • Automatic boxing and unboxing of primitives

Currently studying :

  • Enumerated types

Code Review!

1. Use Dry runs to determine algorithm logic

a dry run is a mental run of an algorithm, sometimes expressed in pseudocode, where the computer scientist examines the algorithm's procedures one step at a time. In both uses, the dry run is frequently assisted by a table (on a computer screen or on paper) with the program or algorithm's variables on the top.

2. Retain functional responsibilities

Use local variables instead of instance variables to help retain functional responsibilities.

Sunday, 21 September 2008

Code Review!

Here's the refactorings from my latest code review:

1. Looping over a single collection when searching for matches, avoid nested for loops and use a do while loop instead.

for example the following is a do while loop that checks for matches and performs a rollup:


var i:int = 1;

do {
var dp1:Object = tmp.getItemAt(i - 1) as Object;
var dp2:
Object= tmp.getItemAt(i) as Object;

if (intervalComparisonFunction(dp1, dp2)) {
// they're the same, so delete the previous
tmp.removeItemAt(i - 1);
} else {
// move to the next object in the array..
i++;
}

} while(i <>



2. Use of Closure functions :
Closure
A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression).
The simple explanation of a Closure is that ECMAScript allows inner functions; function definitions and function expressions that are inside the function bodes of other functions. And that those inner functions are allowed access to all of the local variables, parameters and declared inner functions within their outer function(s). A closure is formed when one of those inner functions is made accessible outside of the function in which it was contained, so that it may be executed after the outer function has returned. At which point it still has access to the local variables, parameters and inner function declarations of its outer function. Those local variables, parameter and function declarations (initially) have the values that they had when the outer function returned and may be interacted with by the inner function.

For example :

a closure function is passed as an argument,

private static function rollUp(dataPoints:ArrayCollection, intervalComparisonFunction:Function) : ArrayCollection {}

then in the rollUp method body :

if (intervalComparisonFunction(dp1, dp2)) {
// some logic
}