Oct 23, 2012

Agile practice: Time frame

One of the most interesting aspects in agile is time-frame. It's idea of defining start time and duration for every activity.  There are not a lot of links google are providing on it, so I decided to create one.

Time frame for an individual

Understand, what do you want to achieve. For example, I want to finish my small practice catalogue "best practices in 10 minutes" (working URL is theme.alwaysdata.net).
How it will be in S.M.A.R.T. way ? Break you task into small, testable, relevant parts, if possible.   I need to do 10 practices in same format.
Time-bound it. Estimate - how much time you're expecting to spent on every part. Or how much time you will spent on it every day/week. Best option is to have something delivered - new feature per day, new page for your book
I spend 0.5 hour every day creating practice description for my catalogue. It took me a week to get to the "almost  done" point. I've struggled for a month before applying time-frame, thinking "I still have time to do it later". 
So, I just start my pomodoro and focus on task, forgetting about everything else for 25 minutes.
After some time-units (for me it's pomodoro) You will be able to see what needs to be done and how much time will it take me to finish task, because you will know your velocity.

If there is no ability to create SMART tasks, I will reveal a secret. Smart tasks aren't needed to time frame, it's just useful to have ones. Just limit your time and at the end of each iteration think about what was done and what needs to be done. Important thing here is to mark previous task as done and create new task, putting there all the remaining work. If size of task changes (it may increase, if task is more complex than you thought) or scope becomes more clear - it means you've done right thing and you'll be more productive next iteration.

Time frame  for teams and iterations.

Limit your time for tasks, for iteration, for meetings. It will be painfull to end meetings in the middle of conversation or understand what task breakdown is needed in the end of iteration, but it will mean that next meeting will be more focused and next iteration planning will be more detailed.

Conclusion

Time is our most precious resource. Learning to respect it is a key for happy and productive work. Time framing is great-to-have practice, it will enhance your estimation ability greatly. Most important in time-framing - that at the end of each iteration you feel that you're one step closer to your goal.

Oct 12, 2012

Schedule at fixed time

Extract of some useful tip I've posted on stackoverflow,
how to schedule task at fixed time at specified timezone:

 
timer = new Timer("Timer", true);
    Calendar cr = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    cr.setTimeInMillis(System.currentTimeMillis());
    long day = TimeUnit.DAYS.toMillis(1);
    //Pay attention - Calendar.HOUR_OF_DAY for 24h day model 
    //(Calendar.HOUR is 12h model, with p.m. a.m. )
    cr.set(Calendar.HOUR_OF_DAY, it.getHours());
    cr.set(Calendar.MINUTE, it.getMinutes());
    long delay = cr.getTimeInMillis() - System.currentTimeMillis();
    //insurance for case then time of task is before time of schedule
    long adjustedDelay = (delay > 0 ? delay : day + delay);
    timer.scheduleAtFixedRate(new StartReportTimerTask(it), adjustedDelay, day);
    //you can use this schedule instead is sure your time is after current time
    //timer.scheduleAtFixedRate(new StartReportTimerTask(it), cr.getTime(), day);
 

Aug 16, 2012

How to be effective in agile way ?

During my thinking of agile and how I can be happy at work (thanks to flow book ) I found 3 ideas that guide creation of a lot of lean/agile practices:
  • inspect and adapt - understand where you are and what can be changed. Retrospectives and demo are good example of it implemented.
  • art of possible - what can be done better or automated or ignored? Facing your challenges provoke your brain to work on solution, even unconsciously
  • timeframe - plan is not a plan without reasonable timing. that's why proper stand-up meeting and iterations timing give you a lot of information to think about and be in touch with reality. Pomodoro technique is a great example of this on personal level. 
Details on these practices will be discussed in later posts.
Interesting question here is how personal practices corelate with team practices, for example pair programming and TDD ? And how personal effectiveness causes/permits team effectiveness?

I really should mention The 3 Pillars of Personal Effectiveness in this post, very interesting reading in GTD category.


Jul 6, 2012

Jun 14, 2012

BDD Beautiful development

In next couple of weeks I'm going to try BDD for java project - http://easyb.org/.
This tool looks promising compared to existing in-house solutions.

Mar 2, 2012

How to write javadoc tips

Worst documentation for code is one that repeats code. Some companies want to avoid this pitfall by implementing "no javadoc" rule (I'm talking about java). This is wrong.
Using following tips (hopefully) will help you to produce meaningful documentation for code:
  •  Use questions in templates for documentation. It's more mind stimulating to answer "What does this class do ?" than replace template "Write description of the class"
  • Write CRC in documentation. CRC means class-responsibility-collaborator data. Example:
    • class: What is it ?
    • responsibility: What and when does it work, what valuable does it do ?
    • collaborator: What classes/modules uses this class ? What classes/modules is used by it ?
  • Example of use. Basic usage scenario in javadoc is most useful thing. It's got noticed on first place (almost every class in JDK has one).
  • Design By Contract: For both class and method it's important to know:
    • Precondition: 
      • When it's legal to use class/method?
      •  What is a valid types and boundary conditions for arguments? Null, string format, data range
      • What is true about method/class execution (thread safe, can produce exception, require external resources, linked with other methods/classes)
      • What is possible outcome ? (Empty array, value object)
Last, a bit vague advice -  do not repeat class/method name. Describe code in business terms, using different words than in code. If you can-not do it or method is pretty obvious - don't write it.

Feb 16, 2012

Translator pattern

One common task in banking is translating from one form to another. I couldn't find an effectife solution for this problem, but TranslatorPattern offers interesting approach.
I've used similar functionality in Amoeba utility classes:

 private static interface Amoeba<Value> {

  boolean consume(Amoeba<Value> amoeba);

  Value produce() throws Exception;
 }

 private static class AmoebaUtils {

  static <Value> boolean populate(Collection<Amoeba<Value>> colony, Amoeba<Value> nominate) {
   for (Amoeba<Value> citizen : colony) {
    if (citizen.equals(nominate)) {
     return citizen.consume(nominate);
    }
   }
   return colony.add(nominate);
  }

  static <Value> Collection<Value> produce(Set<Amoeba<Value>> colony) throws Exception {
   Set<Value> values = new HashSet<Value>();
   for (Amoeba<Value> citizen : colony) {
    values.add(citizen.produce());
   }

   return values;
  }
 }

This gives ability to absorb source notes by related destination nodes, providing natural grouping and translating of information. This is kind of builder and translator, with non-linear rules of transformation (source node != dest node).

List of Lists

Task: to order input data according 2 integer keys.
Example: we have bunch of options. Options have indexes and legs. Legs have indexes and other useful information.
Question: how to extract one type of information from legs?
Answer:
...
private final List<List<FinDate>> expiryDateByOptionAndLeg;
expiryDateByOptionAndLeg = new ArrayList<List<FinDate>>(size){
...
@Override
public List<
FinDate> get(int index) { 
 List<
FinDate> rez = null;
  rez = super.get(index);
  if(rez == null) {
   rez = new ArrayList<
FinDate>(2);
   add(index, rez);
  }
  return rez;
}
};
...
  expiryDateByOptionAndLeg.get(optionsIndex).set(legIndex, expiryDate);


Answer: To use approach suggested in ThreadLocal class javadocs. In this way we receive clear 2-indeger index without need to create list in business code. Similar approach could be applied to Maps.
It's simpler than creating  separate business object and still readable and expressive.