The real battle is static vs dynamictypingIn other words: ● Static : The type of each variable (or expression) must be known at compile time. ● Dynamic:Type information is known only at runtime.
Which are their super powers ? ● Static Typing–Errors are often detected earlier and with better error messages–Better IDE support–Better optimisations are often possible ● Dynamic Typing–Speeds up development through duck-typing–Allows more expressiveness through DSLs
We choose the dynamic wayMany of the rules and patterns we have been taught no longerapply 1. Patterns to review ○ Singleton ○ Resources ○ Delegation ○ ... 2. Performace ○ Java always wins ? ○ We need win ?
DEMOSWhat are you doing?Lets go to see CODE !!!https://github.com/pablomoretti/ppt-groovy-vs-java
Lessons ● Testing the Duck: Used when flexibility is important, but it has appropriate tests in place.● Static Typing isnt the bad guy of the movie: Used when we know that code doesn´t need to be dynamic; typing is useful to shed some light on code.● Interface-oriented design: The use of interfaces is not necessary, but they are useful.● Performance: In Groovy, the sensitive parts can always be written in Java