Tuesday, March 13, 2012

Scrum planning meeting: because everything is created twice

"Good plans shape good decisions. That's why good planning helps to make elusive dreams come true."- Lester Robert Bittel
    With Scrum and at the beginning of each sprint, the team, scrum Master , product owner and may be some of the stakeholders (expert ,clients representative ..) are invited to attend a time boxed meeting where we are going to discuss and negotiate the scope of the current sprint .The goal is to create a blueprint and develop construction plans before any code is produced : the first creation. Indeed the goal of the scrum planning meeting is to try to get a very clear sense of what the team is going to commit to during the sprint ,if we want a drag and drop or a simple table view ,if we want a synchronous or asynchronous functions calls … .We work with our imagination and visualization to create and get a very clear image of what we want to accomplish at the end of the sprint ,thus to share a transversal vision among all the team before the second creation or the physical creation where the code get typed take place, in order to prevent expensive changes that may increase the cost of failure over the implementation process.

   During this meeting the product owner describes the highest priority stories to the team. Some questions and negotiation may follow to limit the scope of what is going to be taken to the sprint backlog, the team subsequently discusses the committed to stories and how the implementation will be built (conception, just-in-time design...).The presence of the product owner is important at this part even if he is not directly involved, since further questions and clarification asked by the team may help them taking better technical decision and making better decomposition of the stories into tasks. The tasks are then estimated and each team member chooses what he will be committed to .The velocity input from past stories allows the team to make a realistic commitment to the scope of the work being defined to prevent demotivation coming from the “unrealistic initial estimation” excuse.

   At the end, an explicit agreement from the team on the sprint backlog is made, and the product backlog, release and sprint burndown charts are updated.

Wednesday, December 7, 2011

Méthodologies agiles : Kanban et processus informatiques


Le Kanban est un mode de gestion de flux créé par l’industrie automobile (Toyota). 
Elle signifie en japonais "étiquette visuelle", et implique deux principes : un très fort feedback visuel et une recherche de la perfection au moindre coût (réduire le gaspillage) .Dans la présentation qui suit je vais essayer de démystifier son concept et proposer une façon de l’appliquer au contexte de l’ingénierie logiciel.




Monday, January 3, 2011

How to add Annotations at Runtime to a java class method using Javassist? (Part 1 )

Annotations are a new feature from Java 5. Annotations are a kind of comment or meta data you can insert in your Java code. But how can we add them dynamically at runtime to the java class since the jdk doesn’t provide any addAnnotation method ?

Introduction
Java annotations were introduced in 2002 through the JCP (JSR-175) and were approved inSeptember 2004 as an alternative to the configuration xml files. Java annotations, can (if necessary) be accessible to the programmer at the runtime through reflection api.

How to scan java annotations?

The easiest way to scan through a resource is to load it through a Classloader and use the Java Reflection API to look for the specified annotation. However, this approach will only help you to find annotations that are visible at runtime @Retention (value = RetentionPolicy.RUNTIME), and loading each resource into memory will consume an unnecessary amount of memory.


Lets create a simple annotation, annotations are defined like interfaces. Here is the @PersonneName definition: 
package sample;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(value = RetentionPolicy.RUNTIME)  //The annotation is saved in the*.class and can be used by the JVM.     
@Target(value = ElementType.METHOD)  //The annotation can be used on methods.
public @interface PersonneName {
public String name();
}

let's now create a simple SayHelloBean on wich we will apply this simple annotation


package sample;
import java.lang.reflect.Method;
import sample.PersonneName;

public class SayHelloBean {
 
private static final  String HELLO_MSG = "Hello ";

@PersonneName(name="World !! (simple annotation)")
public String sayHelloTo(String name){
 return HELLO_MSG+name;
}

public static void main(String[] args) {
 
 
   try{
    //instanciate the bean
    SayHelloBean simpleBean  = new SayHelloBean(); 
    //get the method descriptor through reflection
          Method helloMessageMethod = simpleBean.getClass().getDeclaredMethod("sayHelloTo", String.class); 
          //scan the annotation
          PersonneName mySimpleAnnotation = (PersonneName) helloMessageMethod.getAnnotation(PersonneName.class);
          
          System.out.println(simpleBean.sayHelloTo(mySimpleAnnotation.name()));
      }
      catch(Exception e){
          e.printStackTrace();
      }
}
}

Runing the main method produce : Hello World !! (simple annotation)

How to add Annotations dynamically at Runtime to a java class method?

Why ?
  • Jdk doesn’t provide an addAnnotation method through reflection.
  • Sometimes we need to define annotation dynamically at runtime (example of jsr 303 validation annotations )
  • Add new behaviors to your classes 
How ?

We will use Javassist (Java Programming Assistant) . It is a class library for editing bytecodes in Java; it enables Java programs to define a new class at runtime and to modify a class file when the JVM loads it. (More informations and downloads here javassist ).

Now let’s modify the preceding example to add the @PersonneName at runtime to the SayHelloBean,first we will delete the annotation from the SayHelloBean code


package sample;

public class SayHelloBean {
 
private static final  String HELLO_MSG = "Hello ";

public String sayHelloTo(String name){
 return HELLO_MSG+name;
}
}


second we create the class AddRunTimeAnnotation that will add the annotation dynamically to the SayHelloBean class :


package sample;
import java.lang.reflect.Method;

import sample.PersonneName;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.annotation.Annotation;
import javassist.bytecode.annotation.StringMemberValue;




public class AddRunTimeAnnotation {
 
  public static void addPersonneNameAnnotationToMethod(String className,String methodName) throws Exception{
   
 //pool creation 
 ClassPool pool = ClassPool.getDefault();
 //extracting the class
 CtClass cc = pool.getCtClass(className);
 //looking for the method to apply the annotation on
 CtMethod sayHelloMethodDescriptor = cc.getDeclaredMethod(methodName);
 // create the annotation
 ClassFile ccFile = cc.getClassFile();
 ConstPool constpool = ccFile.getConstPool();
 AnnotationsAttribute attr = new AnnotationsAttribute(constpool, AnnotationsAttribute.visibleTag);
 Annotation annot = new Annotation("sample.PersonneName", constpool);
 annot.addMemberValue("name", new StringMemberValue("World!! (dynamic annotation)",ccFile.getConstPool()));
 attr.addAnnotation(annot);
 // add the annotation to the method descriptor
 sayHelloMethodDescriptor.getMethodInfo().addAttribute(attr);
 
 
 // transform the ctClass to java class
 Class dynamiqueBeanClass = cc.toClass();
 //instanciating the updated class 
 SayHelloBean sayHelloBean = (SayHelloBean) dynamiqueBeanClass.newInstance();
 
  try{
  
         Method helloMessageMethod = sayHelloBean.getClass().getDeclaredMethod(methodName, String.class);  
         //getting the annotation
         PersonneName personneName = (PersonneName) helloMessageMethod.getAnnotation(PersonneName.class);
         System.out.println(sayHelloBean.sayHelloTo(personneName.name()));
     }
     catch(Exception e){
         e.printStackTrace();
     }
 

}
public static void main(String[] args) {
 
 try {
  AddRunTimeAnnotation.addPersonneNameAnnotationToMethod("sample.SayHelloBean", "sayHelloTo");
 } catch (Exception e) {
 
  e.printStackTrace();
 }
 
}
}

Runing the main method now produce : Hello World!! (dynamic annotation).

Looking ahead
There's a lot more to Javassist than what we've covered in this article. Javassist  enables Java programs to define a new class at runtime and to modify a class file before the JVM loads it. Unlike other similar systems, Javassist provides source-level abstraction; programmers can modify a class file without detailed knowledge of the Java bytecode.start enjoying it :).
Ressources :

Friday, May 28, 2010

How to make an agile software user card ?

Agile User Stories are a simple way of capturing user just-in-time requirements throughout a project. They are feature oriented and help to emphasis and cover the why, who, and what on each backlog feature.

So, what makes a good User Story?

The INVEST acronym can help to enlighten this:

I – Independent : Stories are easiest to work with if they are independent
N – Negotiable : they are not contract
V - Valuable : each card might add business value to the customer
E - Estimable: not a precise estimation, the time box can be negotiated.
S - Small : at most a few person-weeks of work
T - Testable : writing the tests early helps to know whether the goal of the User Story is met or not

What should a user story card contain?

There is no fixed template on what a user card should contain, it always depends on the project’s need, more centered, it depends on the need of each product backlog feature, the aim is always to bring everyone to a common understanding of what may be the need and the result.
A common and general template may contain the key points below:

Stakeholder’s description and estimated time .
DBADeveloperArchitectEstimated time
ABChours or unite

Story card name or id :
Useful when managing requirements.

Story card goal:
As a User or role I want Business Functionality so that Business Justification

Business scope:
Description of the business added value. (exp: Development of this report will help administrator to send punctual status to investigator when demanded).

Use case scenario :
Not always needed, but helps better understanding.
Exp :
1. Recruiter submits credit card number, date, and authentication information.
2. System validates credit card.
3. System charges credit card full amount.
4. Job posting is made viewable to job seekers.
5. Recruiter is given a unique confirmation number

User Interface with inputs validation.

Security:
who should have access to what.
Exp:
Role ADMIN:Create/ Update /Submit
Role MANAGER: Update /Submit.

Business rules and policies.

Acceptance Criteria:
What makes the story card 100% done.
Exp :
1.Release Specification.
2.Stability Specifications.
3.Process Dependent Specifications.
4.Functionality that the system will perform
5.Interface look and feel
6.Necessary documentation

Comments:
Impediment, impact, estimation… whatever helps historical learning.

The goal is always to better serve the client by keeping the focus on the goal of the product rather than the list of its attributes.

Thursday, April 29, 2010

How to start implementing agile practices in your company ?

Implementing an agile method in your company may requires continuous and progressive changes to raise stakeholders commitment and culture to handle those new packaged practices ,thus you may start by implementing actions that have an almost direct impact on quality assurance issues and development life cycle to make your team more productive and rigorous through the release process. Here are some of the points you may start with, to help you going through:

Just in time and lightweight requirements:
Keep the requirement level at the minimum required to start the development process.

Automated repeatable unit tests :
Test must be integrated throughout the lifecycle, not at the end .Test scenarios should be written before the development starts (knowing that you would write them anyway!).

Software release must rely on customer feedback :
Don’t waste your time developing unusable functionalities that wouldn’t add any business value to your software; focus on getting the most important features and items first to the market. Make them prioritized to get the better of agility and flexibility.

Stick to a regular software release cycle:
Fixed release cycle (iteration, sprint) is vital, it creates routine (stakeholders, departments, team members) and routine increases productivity. At the end of each release, all features must be completely done and functional, this ensures a clear and complete vision toward the software development progress, reduced risk and higher value.

Get the best of your stakeholders:
By making them working toward a shared goal.

Remember, the success of your project is all about making your stakeholders happy :).

Wednesday, April 21, 2010

How to get the job done within your team



As leader you often have to provide and inspire guidance, instruction, direction, leadership to your team through all the project life cycle, to break through the mediocrity and inspire success where there was no success before, here it is some of my favorite tips to get people accomplish their tasks :

Create a Vision:
Effective leaders supply a shared vision; and inspire people to achieve more than they may ever have dreamed possible. To inspire you must be able to articulate a shared vision in a way that inspires others to act making work exciting.

Know your people:
Give your team enough time to know you, this how you could gain respect, avoid the impact of their subconscious judgment, know what should motivate them, and learn about their Strengths.

Lead by example:
Always show your people the good example, share fully their hardships and privations experienced during the work process, your authority and ability to motivate will increase exponentially for doing so.

Keep Giving Feedback:
Always keep giving performance measurement to your team member, Depriving people of feedback causes them to create their own referential that may not be adequate to the results or success criteria you want your team to accomplish.

Push your people to care about the job:
Don’t stress them, they will lose focus and won’t perform adequately.

Reward:
Take the blame for their mistakes and give them praise for their success.

Trust:
Create an environment of trust, trust is essential in all human relationships – professional or private, there is no place for snipers in a team.

Set goals:

General rule of thumb that greater or more difficult goals actually increase performance, help your people visualize themselves reaching their goals also makes achievement of those goals more tangible

Create routines:

Routine help creating habits, habits increase productivity.

Just remember, that your job as a leader is to keep the work exciting beyond the day-to-day tasks.

Tuesday, April 20, 2010

Revamping Morocco JUG




Actually I'm working with some of my friends on revamping the moroccan java user group, inspired by the egyptian experience we aim to be at the same level, and to rise up the Java skills on morocco.

As our first step is to involve more people on the Java world here in morocco, we should start to work on universities and Engineering schools to get in touch with young engineers and developpers to be able push them up on the software industry with a strong technical and architectural skills on Java technologies.

For further information, please visit and join: https://moroccojug.dev.java.net/