application architecture in groovy

Post on 08-May-2015

280 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Speaker: Daniel Woods Groovy provides flexible and dynamic capabilities for developing modular, maintainable code. With Groovy's extension framework, developers can modularize common application utility functions. Leveraging Groovy's dynamic nature can allow developers to create powerful, easy-to-follow business components. Employing Groovy categories and mixins can help localize and simplify transformation and adaptation logic that would otherwise be verbose and difficult to maintain. This talk will focus on leveraging the strengths and flexibilities in Groovy to employ a powerful, maintainable, and simple application architecture.

TRANSCRIPT

 

Applica(on  Architecture  in  Groovy  

ABOUT  ME  

@danveloper  github.com/danveloper  

daniel.p.woods@gmail.com   Principal  Consultant  

Applica(on  Architecture  in  Groovy  

WHAT  IS  AN  ARCHITECT?  

WHAT  IS  ARCHITECTURE?  

Applica(on  Architecture  in  Groovy  

ARCHITECTURE  IS  NOT  JUST  ABOUT  STRUCTURE  

Applica(on  Architecture  in  Groovy  

ARCHITECTURE  IS  A  SET  OF  PRINCIPLES  TO  FOLLOW  

Applica(on  Architecture  in  Groovy  

ARCHITECTURE  SHOULD  BE  ADAPTABLE  &  EASY  TO  MAINTAIN  

Applica(on  Architecture  in  Groovy  

“ARCHITECT”  HAS  BECOME  A  BUZZ  WORD  

I’m  an  Architect!  

Applica(on  Architecture  in  Groovy  

“THE  BIG  PICTURE”  

Applica(on  Architecture  in  Groovy  

WHAT  MAKES  APPLICATION  ARCHITECTURE  IN  GROOVY  DIFFERENT?  

Applica(on  Architecture  in  Groovy  

GROOVY  IS  MORE  THAN  JUST  SYNTAX  SUGAR  

Applica(on  Architecture  in  Groovy  

GROOVY  IS  MORE  THAN  JUST  SYNTAX  SUGAR  

Applica(on  Architecture  in  Groovy  

GROOVY  “MAGIC”  IS  EVERYWHERE!  

Applica(on  Architecture  in  Groovy  

IDIOMATIC  GROOVY  CAN  BE  SCARY  

Applica(on  Architecture  in  Groovy  

“GOLDILOCKS  GROOVY”  NOT  TOO  GROOVY…  JUST  GROOVY  ENOUGH  

Applica(on  Architecture  in  Groovy  

PRINCIPLES  OF  APPLICATION  ARCHITECTURE  

Applica(on  Architecture  in  Groovy  

PREDICTABILITY  PATTERN:  TIGHTLY  COUPLE  FORM  AND  FUNCTION  

Applica(on  Architecture  in  Groovy  

THE  “FORM”  OF  A  RESOURCE    SHOULD  HINT  TO  ITS  “FUNCTION”  

Ü  LIKE GRAILS: “CONTROLLER”, “SERVICE”, “TAGLIB”!

 Ü  AVOID  NAMES  LIKE  DomainWizardBeanImpl!

Applica(on  Architecture  in  Groovy  

THE  “FUNCTION”  OF  A  RESOURCE    SHOULD  RESOLVE  ITS  “FORM”  

ü  Follow Single Responsibility Principle!

Applica(on  Architecture  in  Groovy  

MAKE  CODE  “MORE  READABLE”  

Applica(on  Architecture  in  Groovy  

EVERY  MINUTE  LOST  DECIPHERING…  IS  A  MINUTE  LOST  IMPLEMENTING  

Applica(on  Architecture  in  Groovy  

BDD  FRAMEWORKS  AIM  FOR  “READABILITY”  

Applica(on  Architecture  in  Groovy  

IF  (ISUSINGGROOVY())  {  “USE  GROOVY!”()  }  

Applica(on  Architecture  in  Groovy  

SYNTAX  SUGAR  IS  A  GOOD  THING  

Applica(on  Architecture  in  Groovy  

CLOSURE  AS  FINAL  VARARG  IN  METHOD  

ü  Provides  “Scoped”  Execu(on  Environment    ü  Contains  code  to  enhance  readability  

ü  Programma(cally  determine  resolu(on    ü  Shortcut  otherwise  verbose  steps  

Applica(on  Architecture  in  Groovy  

MAPS  ARE  FIRST-­‐CLASS  CITIZENS  

ü  Map-­‐based  constructors  lend  code  to  self-­‐documenta(on    ü  Allow  explicit  named  assignments    ü  Ad-­‐hoc  data  structure  is  great  for  method  method  args    ü  Great  overall  reduc(on  of  code  verbosity  

Applica(on  Architecture  in  Groovy  

METHOD  MISSING  &  PROPERTY  MISSING  THE  “ALL  ELSE  FAILED”  HANDLERS  

Applica(on  Architecture  in  Groovy  

FLUENT,  HUMAN-­‐READABLE  DSLS  

ü  Dis(ll  reusable  complex  opera(ons  into  a  human-­‐readable  string    ü  Built-­‐in  self-­‐documenta(on  of  intent    ü  A  licle  capital  expense  to  facilitate  low  opera(ng  expense    ü  Great  developers  up  to  speed  very  quickly  

Applica(on  Architecture  in  Groovy  

FLUENT,  HUMAN-­‐READABLE  DSLS  

o  What  should  they  be  used?    o  Who  should  develop  the  DSL?  

Applica(on  Architecture  in  Groovy  

BE  EXPLICIT  WITH  MAGIC  

Applica(on  Architecture  in  Groovy  

METACLASS  ENHANCEMENTS  CAN  COME  FROM…  

ü  Custom  MetaClasses    ü  Conven(on  MetaClasses  named:  

groovy.runtime.metaclass.[package].[class]MetaClass!  ü  Libraries  /  Plugins    ü  Anywhere  at  run(me!!  

Applica(on  Architecture  in  Groovy  

BUILD  CONVENTION  AROUND    -­‐WHERE-­‐  

MAGIC  IS  COMING  FROM  

Applica(on  Architecture  in  Groovy  

BE  VERY  CLEAR  WHEN  OVERLOADING  OPERATORS    

(USE  A  CATEGORY)  

Applica(on  Architecture  in  Groovy  

USE  CATEGORIES  FOR  ONE-­‐OFF  MIXINS,    OR  CONCEPT-­‐BASED  OVERLOADS  

Applica(on  Architecture  in  Groovy  

FAVOR  CONVENTION  OVER  CONFIGURATION  

Applica(on  Architecture  in  Groovy  

GROOVY  ECOSYSTEM  EMBRACES  CONVENTION-­‐OVER-­‐CONFIGURATION  

Applica(on  Architecture  in  Groovy  

USE  CONVENTION-­‐OVER-­‐CONFIGURATION  TO  BUILD  AN  ADAPTIVE  DEVELOPMENT  ENVIRONMENT  

Applica(on  Architecture  in  Groovy  

.ALL  DONE.    J  

QUESTIONS?  

top related