Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Created October 15, 2015 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrichardsz/860ef4a711094b365aff to your computer and use it in GitHub Desktop.
Save jrichardsz/860ef4a711094b365aff to your computer and use it in GitHub Desktop.
System that supports dynamic behavior.
Desarrollar la clase Producto para que soporte procesos o reglas dinamicas:
class Producto {
method1()
method2()
method3()
submit() {
//before generic submit()
if(CustomBehavior.execute()){//read scripts from disk, database, etc
continue;
}else {
throw error; // or something
}
genericSubmit()
}
}
Llega un requerimiento en el que se debe enviar la info del
producto a un sistema interno o externo.
No se modifica el core, solo se crea un script: sendata.grrovy
class SendDataToAnotherSystem{
readProductData()
sendProductData()
}
La clase Producto detecta un script y lo ejecuta
antes de su metodo submit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment