jeudi 14 juin 2018

Java/Groovy : Elegant way of initializing method with a class

Taking into consideration that I do now want to use static methods, which would be the best or most elegant way of invoking a method? In order to invoke a method I need also to instantiate the class.

What I am currently doing is the following. I am passing the needed parameters to the class and afterwards the same needed parameters to the method.

This is what I am doing:

boolean switchOffButton= new Light(script, data, lightsOn, lightsOff).calculateLightIlumination(script, DataHooks, lightsOn, lightsOff)

Do you think I could improve this in any way?Maybe applying a specific design pattern?

Thanks,

Kat

Aucun commentaire:

Enregistrer un commentaire