samedi 12 septembre 2015

Best Strategy to make this code efficient

I'm currently start my career in Java , I build my first successful application. Client is happy from work but sometimes my code reviewing team tell that your is not efficient! I have search a lot but couldn't find which design pattern is suitable for this piece of Code. This code based on Vaadin Framework.

public class MyWindow extends Window {

private Button button;

public Button getButton() {
    return button;
}

public void setButton(Button button) {
    this.button = button;
}

}

This class is currently using in 20+ other classes differently but now I'm just showing example here

public class Practise {


public static void main(String []args) {
    MyWindow myWindow = new MyWindow();
    myWindow.getButton().addClickListener((event)->{

    });
}

}

From my above code can you please tell me what is the best practise for doing this.

Thanks in Advance Yasir

Aucun commentaire:

Enregistrer un commentaire