SlideShare a Scribd company logo
1 of 50
#JavaEE @alextheedom
Professional Java EE Design
PatternsAlex Theedom
@alextheedom
alextheedom.com
@alextheedom#JavaEE
Speaker’s Bio
•Senior Java Developer
•Author: Professional Java EE Design Patterns
•E-learning Platforms
•Cash Machine Software
•Microservice Based Lottery Systems
•Spring and Java EE
@alextheedom#JavaEE
What to expect
•What’s the story
•Why am I here? What’s the message?
•Whistle stop tour
•Design Patterns: what, when and why
•Context Dependency Injection
@alextheedom#JavaEE
What to expect
•Deep Dive
•Singleton Pattern
•Factory Pattern
•Harnessing the power (something special)
•Quickie Patterns
•Façade, Decorator, Observer
•Q&A
@alextheedom#JavaEE
What’s the story
•Java EE changed design pattern implementation
•Implementation has simplified
•Implementation has been enhanced
•Greater creativity
•How?
•I will show you today
•Change is part of Java EE continued development
@alextheedom#JavaEE
Design patterns: 3W’S
•What are design patterns?
•Why do we need them?
•When to use them?
@alextheedom#JavaEE
Context Dependency Injection
•Simplifies programming model
•Annotations have replaced XML config files
•Convention over Configuration
•Resources are injected by type
•@Inject and disambiguation @Qualifier
•POJO (JSR 299 managed bean)
•Otherwise @Producer
@alextheedom#JavaEE
Singleton Pattern
•Ubiquitous and controversial but inescapable
•Instantiated once
•Not normally destroy during application life cycle
@alextheedom#JavaEE
Conventional Implementation
public class Logger {
private static Logger instance;
private Logger() {
// Creation code here
}
public static synchronized Logger getInstance() {
if(instance == null) {
instance = new Logger();
}
return instance;
}
}
public class Logger {
private static Logger instance;
private Logger() {
// Creation code here
}
public static synchronized Logger getInstance() {
if(instance == null) {
instance = new Logger();
}
return instance;
}
}
@alextheedom#JavaEE
Conventional Implementation
•Only one instance of Logger created
•Created by first call the getInstance()
•Thread safe creation
•Use it like so:
Logger logger = Logger.getInstance();Logger logger = Logger.getInstance();
@alextheedom#JavaEE
Java EE Implementation
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
}
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
}
@alextheedom#JavaEE
Java EE Implementation
•Only one instance of Logger created
•Created by container (lazily)
•Knows it’s a singleton because @Singleton
•Use it like so:
@Inject
Logger logger;
@Inject
Logger logger;
@alextheedom#JavaEE
Java EE Implementation
•Eager instantiation @Startup
•Perform startup tasks @PostConstruct
@alextheedom#JavaEE
Java EE Implementation
@Startup
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
@PostConstruct
void startUpTask() {
// Perform start up tasks
}
}
@Startup
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
@PostConstruct
void startUpTask() {
// Perform start up tasks
}
}
@alextheedom#JavaEE
Java EE Implementation
•Specify dependent instantiation
@DependsOn("PrimaryBean")
@Startup
@Singleton
public class Logger {
...
}
@DependsOn("PrimaryBean")
@Startup
@Singleton
public class Logger {
...
}
@alextheedom#JavaEE
Java EE Implementation
@DependsOn("PrimaryBean")
@Startup
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
@PostConstruct
void startUpTask() {
// Perform start up tasks
}
}
@DependsOn("PrimaryBean")
@Startup
@Singleton
public class Logger {
private Logger() {
// Creation code here
}
@PostConstruct
void startUpTask() {
// Perform start up tasks
}
}
@alextheedom#JavaEE
Java EE Implementation
•Conclusions so far
•Very different implementation
•Substantially less boilerplate code
•Enhancements via specialized annotations
@alextheedom#JavaEE
Java EE Implementation
•Further enhancements
•Fine grain concurrency management
•Container vs. bean managed
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class Logger {
...
}
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class Logger {
...
}
•What about method access?
@alextheedom#JavaEE
Java EE Implementation
•Method access
•LockType.WRITE and LockType.READ
@Lock(LockType.WRITE)
public void addMessage(String message) {
// Add message to log
}
@Lock(LockType.READ)
public String getMessage() {
// Get message
}
@Lock(LockType.WRITE)
public void addMessage(String message) {
// Add message to log
}
@Lock(LockType.READ)
public String getMessage() {
// Get message
}
@alextheedom#JavaEE
Java EE Implementation
•Method access timeout
•ConcurrentAccessTimeoutException
•Defined by annotation @AccessTimeout
•Class and method level
@AccessTimeout(value = 30, unit=TimeUnit.SECONDS)
@Lock(LockType.WRITE)
public void addMessage(String message) {
// Add message to log
}
@AccessTimeout(value = 30, unit=TimeUnit.SECONDS)
@Lock(LockType.WRITE)
public void addMessage(String message) {
// Add message to log
}
@alextheedom#JavaEE
Conclusion
•Substantially different manner of implementation
•Marked reduction in code (~50%)
•Implementation improved via specialized annotations
•Startup behavioural characteristics
•Fine grain control over concurrency and access timeout
@alextheedom#JavaEE
Factory Pattern
•Creational pattern
•Interface for creating family of objects
•Clients are decoupled from the creation
@alextheedom#JavaEE
Conventional Implementation
public class DrinksMachineFactory implements AbstractDrinksMachineFactory{
public DrinksMachine createCoffeeMachine() {
return new CoffeeMachine();
}
}
public class DrinksMachineFactory implements AbstractDrinksMachineFactory{
public DrinksMachine createCoffeeMachine() {
return new CoffeeMachine();
}
}
•Use it like so:
AbstractDrinksMachineFactory factory = new DrinksMachineFactory();
DrinksMachine coffeeMachine = factory.createCoffeeMachine();
AbstractDrinksMachineFactory factory = new DrinksMachineFactory();
DrinksMachine coffeeMachine = factory.createCoffeeMachine();
•Abstract factory
@alextheedom#JavaEE
Java EE Implementation
•CDI framework is a factory
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
•Use it like so:
@Inject
DrinksMachine drinksMachine;
@Inject
DrinksMachine drinksMachine;
@alextheedom#JavaEE
Java EE Implementation
•Problem! Multiple concrete implementations
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
public class SoftDrinksMachine implements DrinksMachine {
// Implementation code
}
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
public class SoftDrinksMachine implements DrinksMachine {
// Implementation code
}
@Inject
DrinksMachine drinksMachine;
@Inject
DrinksMachine drinksMachine;
•Which DrinksMachine to inject?
@alextheedom#JavaEE
Java EE Implementation
•Solution! Qualifiers
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface SoftDrink
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface SoftDrink
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface Coffee
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface Coffee
@alextheedom#JavaEE
Java EE Implementation
•Annotate respective classes
@Coffee
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
@Coffee
public class CoffeeMachine implements DrinksMachine {
// Implementation code
}
@SoftDrink
public class SoftDrinksMachine implements DrinksMachine {
// Implementation code
}
@SoftDrink
public class SoftDrinksMachine implements DrinksMachine {
// Implementation code
}
@alextheedom#JavaEE
Java EE Implementation
•Annotate injection points
@Inject @SoftDrink
DrinksMachine softDrinksMachine;
@Inject @SoftDrink
DrinksMachine softDrinksMachine;
@Inject @Coffee
DrinksMachine coffeeDrinksMachine;
@Inject @Coffee
DrinksMachine coffeeDrinksMachine;
@alextheedom#JavaEE
Java EE Implementation
•Conclusions so far
•No boilerplate code
•Container does all the hard work
•Disambiguation via qualifiers
•Remember
•Only JSR299 beans are ‘injectable’
@alextheedom#JavaEE
Java EE Implementation
•Dive deeper
•Producer methods
•Use it like so:
@Produces
@Library
public List<Book> getLibrary(){
// Generate a List of books called 'library'
return library;
}
@Produces
@Library
public List<Book> getLibrary(){
// Generate a List of books called 'library'
return library;
}
@Inject @Library
List<Books> library;
@Inject @Library
List<Books> library;
@alextheedom#JavaEE
Java EE Implementation
•Scope
•Determines when method called
•Life of object: @RequestScoped -> @ApplicationScoped
@SessionScoped
@Produces
@Library
public List<Book> getLibrary(){
// Generate a List of books called 'library'
return library;
}
@SessionScoped
@Produces
@Library
public List<Book> getLibrary(){
// Generate a List of books called 'library'
return library;
}
@alextheedom#JavaEE
Java EE Implementation
•Parameterized creation
public class LoggerFactory{
@Produces
public Logger logger(InjectionPoint injectionPoint) {
return Logger.getLogger(
injectionPoint.getMember()
.getDeclaringClass().getName());
}
}
public class LoggerFactory{
@Produces
public Logger logger(InjectionPoint injectionPoint) {
return Logger.getLogger(
injectionPoint.getMember()
.getDeclaringClass().getName());
}
}
@Inject
private transient Logger logger;
@Inject
private transient Logger logger;
@alextheedom#JavaEE
Java EE Implementation
•Conclusions so far
•Virtually any object can be made injectable
•Automatic per class configuration
@alextheedom#JavaEE
Harnessing the power of CDI
•A variation on the factory pattern
•Imaginative use of CDI
•Multiple implementations of the same interface
•Collect and select pattern
•Uses @Any, enums, annotation literals and Instance class
@alextheedom#JavaEE
Harnessing the power of CDI
•@Any
@Any
@Inject
private Instance<MessageType> messages
@Any
@Inject
private Instance<MessageType> messages
@alextheedom#JavaEE
Harnessing the power of CDI
•Distinguish between message types using qualifiers
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Message {
Type value();
enum Type{ SHORT, LONG }
}
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Message {
Type value();
enum Type{ SHORT, LONG }
}
@alextheedom#JavaEE
Harnessing the power of CDI
•Annotate our classes
@Message(Message.Type.SHORT)
public class ShortMessage implements MessageType{
// Short message implementation code
}
@Message(Message.Type.SHORT)
public class ShortMessage implements MessageType{
// Short message implementation code
}
@Message(Message.Type.LONG)
public class LongMessage implements MessageType{
// Long message implementation code
}
@Message(Message.Type.LONG)
public class LongMessage implements MessageType{
// Long message implementation code
}
@alextheedom#JavaEE
Harnessing the power of CDI
•Create an annotation literal for messages
public class MessageLiteral extends
AnnotationLiteral<Message> implements Message {
private Type type;
public MessageLiteral(Type type) {
this.type = type;
}
public Type value() {
return type;
}
}
public class MessageLiteral extends
AnnotationLiteral<Message> implements Message {
private Type type;
public MessageLiteral(Type type) {
this.type = type;
}
public Type value() {
return type;
}
}
@alextheedom#JavaEE
Harnessing the power of CDI
•Putting the puzzle together
@Inject
@Any
private Instance<MessageType> messages;
public MessageType getMessage(Message.Type type) {
MessageLiteral literal = new MessageLiteral(type);
Instance<MessageType> typeMessages =
messages.select(literal);
return typeMessages.get();
}
@Inject
@Any
private Instance<MessageType> messages;
public MessageType getMessage(Message.Type type) {
MessageLiteral literal = new MessageLiteral(type);
Instance<MessageType> typeMessages =
messages.select(literal);
return typeMessages.get();
}
@alextheedom#JavaEE
Harnessing the power of CDI
•Use it like so:
@Inject
private MessageFactory mf;
public void doMessage(){
MessageType m = mf.getMessage(Message.Type.SHORT);
}
@Inject
private MessageFactory mf;
public void doMessage(){
MessageType m = mf.getMessage(Message.Type.SHORT);
}
@alextheedom#JavaEE
Conclusion
•CDI removes need for factory pattern
•Container does all the hard work
•Substantially less boilerplate code
•Disambiguation via qualifiers
•Increased creativity
•Collect and select
@alextheedom#JavaEE
Other Patterns
•Facade
•Decorator
•Observer
@alextheedom#JavaEE
Façade Pattern
•Encapsulates complicated logic
•@Stateless, @Stateful
@Stateless
public class BankServiceFacade{
@Inject
private AccountService accountService;
}
@Stateless
public class BankServiceFacade{
@Inject
private AccountService accountService;
}
@Stateless
public class AccountService{}
@Stateless
public class AccountService{}
@alextheedom#JavaEE
Decorator Pattern
•Dynamically adds logic to an object
@alextheedom#JavaEE
Decorator Pattern
@Decorator
@Priority(Interceptor.Priority.APPLICATION)
public class PriceDiscountDecorator implements Product {
@Any
@Inject
@Delegate
private Product product;
public String generateLabel() {
product.setPrice(product.getPrice() * 0.5);
return product.generateLabel();
}
}
@Decorator
@Priority(Interceptor.Priority.APPLICATION)
public class PriceDiscountDecorator implements Product {
@Any
@Inject
@Delegate
private Product product;
public String generateLabel() {
product.setPrice(product.getPrice() * 0.5);
return product.generateLabel();
}
}
@alextheedom#JavaEE
Observer Pattern
•Notifies dependents of state change
public void trace(@Observes String message){
// Response to String event
}
public void trace(@Observes String message){
// Response to String event
}
@alextheedom#JavaEE
Final Conclusion
•Efficiency savings
•Greater control over behaviour
•New features enhance implementation
•Opens doors to new pattern design
#JavaEE @alextheedom
40% discount with promo code
VBK43
when ordering through
wiley.com
valid until 1st September
@YourTwitterHandle#DVXFR14{session hashtag} @alextheedom#JavaEE
Q & A
#JavaEE @alextheedom
Professional Java EE Design
PatternsAlex Theedom
@alextheedom
alextheedom.com
Thank You

More Related Content

What's hot

Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahiericjamesblackburn
 
Building an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developersBuilding an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developerskim.mens
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverPankaj Biswas
 
Selendroid in Action
Selendroid in ActionSelendroid in Action
Selendroid in ActionDominik Dary
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
Front-end Automated Testing
Front-end Automated TestingFront-end Automated Testing
Front-end Automated TestingRuben Teijeiro
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Edureka!
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplifiedVikas Singh
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summaryAlan Richardson
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application TestingYnon Perek
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introductionSagar Verma
 
WebObjects Developer Tools
WebObjects Developer ToolsWebObjects Developer Tools
WebObjects Developer ToolsWO Community
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Edureka!
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Simplilearn
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium TestingMary Jo Sminkey
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBayDominik Dary
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Simplilearn
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 

What's hot (20)

Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
Building an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developersBuilding an Eclipse plugin to recommend changes to developers
Building an Eclipse plugin to recommend changes to developers
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Selendroid in Action
Selendroid in ActionSelendroid in Action
Selendroid in Action
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
Front-end Automated Testing
Front-end Automated TestingFront-end Automated Testing
Front-end Automated Testing
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introduction
 
WebObjects Developer Tools
WebObjects Developer ToolsWebObjects Developer Tools
WebObjects Developer Tools
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium Testing
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBay
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 

Viewers also liked

Devoxx UK 2015: How Java EE has changed pattern implementation
Devoxx UK 2015: How Java EE has changed pattern implementationDevoxx UK 2015: How Java EE has changed pattern implementation
Devoxx UK 2015: How Java EE has changed pattern implementationAlex Theedom
 
Iwama 2014 - Shanghai
Iwama 2014 - ShanghaiIwama 2014 - Shanghai
Iwama 2014 - ShanghaiLapo Chirici
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Alex Theedom
 
Java EE changes design pattern implementation: JavaDays Kiev 2015
Java EE changes design pattern implementation: JavaDays Kiev 2015Java EE changes design pattern implementation: JavaDays Kiev 2015
Java EE changes design pattern implementation: JavaDays Kiev 2015Alex Theedom
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns Alex Theedom
 
The Critical Path Method
The Critical Path MethodThe Critical Path Method
The Critical Path MethodNicola2903
 
Jersey Coders New Term Introduction
Jersey Coders New Term IntroductionJersey Coders New Term Introduction
Jersey Coders New Term IntroductionAlex Theedom
 
Java EE revisits design patterns
Java EE revisits design patternsJava EE revisits design patterns
Java EE revisits design patternsAlex Theedom
 
SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016Alex Theedom
 
Critical path method (cpm)
Critical path method (cpm)Critical path method (cpm)
Critical path method (cpm)hoang tung
 
process of making Pepsi
process of making Pepsiprocess of making Pepsi
process of making Pepsijubin
 
The Network Diagram and Critical Path
The Network Diagram and Critical PathThe Network Diagram and Critical Path
The Network Diagram and Critical Pathdmdk12
 
Critical Path Ppt
Critical Path PptCritical Path Ppt
Critical Path PptJeff Hilton
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanAlex Theedom
 
Decision Making Process
Decision Making ProcessDecision Making Process
Decision Making ProcessAima Masood
 

Viewers also liked (20)

Devoxx UK 2015: How Java EE has changed pattern implementation
Devoxx UK 2015: How Java EE has changed pattern implementationDevoxx UK 2015: How Java EE has changed pattern implementation
Devoxx UK 2015: How Java EE has changed pattern implementation
 
Iwama 2014 - Shanghai
Iwama 2014 - ShanghaiIwama 2014 - Shanghai
Iwama 2014 - Shanghai
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"
 
Java EE changes design pattern implementation: JavaDays Kiev 2015
Java EE changes design pattern implementation: JavaDays Kiev 2015Java EE changes design pattern implementation: JavaDays Kiev 2015
Java EE changes design pattern implementation: JavaDays Kiev 2015
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns
 
The Critical Path Method
The Critical Path MethodThe Critical Path Method
The Critical Path Method
 
Jersey Coders New Term Introduction
Jersey Coders New Term IntroductionJersey Coders New Term Introduction
Jersey Coders New Term Introduction
 
Java EE revisits design patterns
Java EE revisits design patternsJava EE revisits design patterns
Java EE revisits design patterns
 
SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016
 
jDays Sweden 2016
jDays Sweden 2016jDays Sweden 2016
jDays Sweden 2016
 
Critical path method (cpm)
Critical path method (cpm)Critical path method (cpm)
Critical path method (cpm)
 
Critical Path Method
Critical Path MethodCritical Path Method
Critical Path Method
 
process of making Pepsi
process of making Pepsiprocess of making Pepsi
process of making Pepsi
 
Decision making process
Decision making processDecision making process
Decision making process
 
Critical Path Method(CPM)
Critical Path Method(CPM)Critical Path Method(CPM)
Critical Path Method(CPM)
 
The Network Diagram and Critical Path
The Network Diagram and Critical PathThe Network Diagram and Critical Path
The Network Diagram and Critical Path
 
Critical path method
Critical path methodCritical path method
Critical path method
 
Critical Path Ppt
Critical Path PptCritical Path Ppt
Critical Path Ppt
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
Decision Making Process
Decision Making ProcessDecision Making Process
Decision Making Process
 

Similar to Java days Lviv 2015

Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.WO Community
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkESUG
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeJesse Gallagher
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptKevin Read
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Kevin Read
 
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Florent BENOIT
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=HibernateJay Shah
 
Core data intermediate Workshop at NSSpain 2013
Core data intermediate Workshop at NSSpain 2013Core data intermediate Workshop at NSSpain 2013
Core data intermediate Workshop at NSSpain 2013Diego Freniche Brito
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Eragraemerocher
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Lars Vogel
 

Similar to Java days Lviv 2015 (20)

Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
 
tut0000021-hevery
tut0000021-heverytut0000021-hevery
tut0000021-hevery
 
tut0000021-hevery
tut0000021-heverytut0000021-hevery
tut0000021-hevery
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScript
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8
 
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 
Selenium Topic 2 IDE
Selenium Topic 2 IDESelenium Topic 2 IDE
Selenium Topic 2 IDE
 
Core data intermediate Workshop at NSSpain 2013
Core data intermediate Workshop at NSSpain 2013Core data intermediate Workshop at NSSpain 2013
Core data intermediate Workshop at NSSpain 2013
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
 
DOSUG Wicket 101
DOSUG Wicket 101DOSUG Wicket 101
DOSUG Wicket 101
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Era
 
Wicket Web Framework 101
Wicket Web Framework 101Wicket Web Framework 101
Wicket Web Framework 101
 
Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4 Eclipse 40 and Eclipse e4
Eclipse 40 and Eclipse e4
 

More from Alex Theedom

Build an Amazon Polly connector in 15 mins with MuleSoft
Build an Amazon Polly connector in 15 mins with MuleSoftBuild an Amazon Polly connector in 15 mins with MuleSoft
Build an Amazon Polly connector in 15 mins with MuleSoftAlex Theedom
 
Java EE 8 security and JSON binding API
Java EE 8 security and JSON binding APIJava EE 8 security and JSON binding API
Java EE 8 security and JSON binding APIAlex Theedom
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youAlex Theedom
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youAlex Theedom
 
Java EE Revisits Design Patterns
Java EE Revisits Design PatternsJava EE Revisits Design Patterns
Java EE Revisits Design PatternsAlex Theedom
 
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youAlex Theedom
 

More from Alex Theedom (6)

Build an Amazon Polly connector in 15 mins with MuleSoft
Build an Amazon Polly connector in 15 mins with MuleSoftBuild an Amazon Polly connector in 15 mins with MuleSoft
Build an Amazon Polly connector in 15 mins with MuleSoft
 
Java EE 8 security and JSON binding API
Java EE 8 security and JSON binding APIJava EE 8 security and JSON binding API
Java EE 8 security and JSON binding API
 
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to youJDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
JDKIO: Java EE 8 what Servlet 4 and HTTP2 mean to you
 
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to youJava EE 8: What Servlet 4.0 and HTTP2 mean to you
Java EE 8: What Servlet 4.0 and HTTP2 mean to you
 
Java EE Revisits Design Patterns
Java EE Revisits Design PatternsJava EE Revisits Design Patterns
Java EE Revisits Design Patterns
 
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to youJava EE 8: What Servlet 4.0 and HTTP/2 mean to you
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Java days Lviv 2015

  • 1. #JavaEE @alextheedom Professional Java EE Design PatternsAlex Theedom @alextheedom alextheedom.com
  • 2. @alextheedom#JavaEE Speaker’s Bio •Senior Java Developer •Author: Professional Java EE Design Patterns •E-learning Platforms •Cash Machine Software •Microservice Based Lottery Systems •Spring and Java EE
  • 3. @alextheedom#JavaEE What to expect •What’s the story •Why am I here? What’s the message? •Whistle stop tour •Design Patterns: what, when and why •Context Dependency Injection
  • 4. @alextheedom#JavaEE What to expect •Deep Dive •Singleton Pattern •Factory Pattern •Harnessing the power (something special) •Quickie Patterns •Façade, Decorator, Observer •Q&A
  • 5. @alextheedom#JavaEE What’s the story •Java EE changed design pattern implementation •Implementation has simplified •Implementation has been enhanced •Greater creativity •How? •I will show you today •Change is part of Java EE continued development
  • 6. @alextheedom#JavaEE Design patterns: 3W’S •What are design patterns? •Why do we need them? •When to use them?
  • 7. @alextheedom#JavaEE Context Dependency Injection •Simplifies programming model •Annotations have replaced XML config files •Convention over Configuration •Resources are injected by type •@Inject and disambiguation @Qualifier •POJO (JSR 299 managed bean) •Otherwise @Producer
  • 8. @alextheedom#JavaEE Singleton Pattern •Ubiquitous and controversial but inescapable •Instantiated once •Not normally destroy during application life cycle
  • 9. @alextheedom#JavaEE Conventional Implementation public class Logger { private static Logger instance; private Logger() { // Creation code here } public static synchronized Logger getInstance() { if(instance == null) { instance = new Logger(); } return instance; } } public class Logger { private static Logger instance; private Logger() { // Creation code here } public static synchronized Logger getInstance() { if(instance == null) { instance = new Logger(); } return instance; } }
  • 10. @alextheedom#JavaEE Conventional Implementation •Only one instance of Logger created •Created by first call the getInstance() •Thread safe creation •Use it like so: Logger logger = Logger.getInstance();Logger logger = Logger.getInstance();
  • 11. @alextheedom#JavaEE Java EE Implementation @Singleton public class Logger { private Logger() { // Creation code here } } @Singleton public class Logger { private Logger() { // Creation code here } }
  • 12. @alextheedom#JavaEE Java EE Implementation •Only one instance of Logger created •Created by container (lazily) •Knows it’s a singleton because @Singleton •Use it like so: @Inject Logger logger; @Inject Logger logger;
  • 13. @alextheedom#JavaEE Java EE Implementation •Eager instantiation @Startup •Perform startup tasks @PostConstruct
  • 14. @alextheedom#JavaEE Java EE Implementation @Startup @Singleton public class Logger { private Logger() { // Creation code here } @PostConstruct void startUpTask() { // Perform start up tasks } } @Startup @Singleton public class Logger { private Logger() { // Creation code here } @PostConstruct void startUpTask() { // Perform start up tasks } }
  • 15. @alextheedom#JavaEE Java EE Implementation •Specify dependent instantiation @DependsOn("PrimaryBean") @Startup @Singleton public class Logger { ... } @DependsOn("PrimaryBean") @Startup @Singleton public class Logger { ... }
  • 16. @alextheedom#JavaEE Java EE Implementation @DependsOn("PrimaryBean") @Startup @Singleton public class Logger { private Logger() { // Creation code here } @PostConstruct void startUpTask() { // Perform start up tasks } } @DependsOn("PrimaryBean") @Startup @Singleton public class Logger { private Logger() { // Creation code here } @PostConstruct void startUpTask() { // Perform start up tasks } }
  • 17. @alextheedom#JavaEE Java EE Implementation •Conclusions so far •Very different implementation •Substantially less boilerplate code •Enhancements via specialized annotations
  • 18. @alextheedom#JavaEE Java EE Implementation •Further enhancements •Fine grain concurrency management •Container vs. bean managed @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) public class Logger { ... } @Singleton @ConcurrencyManagement(ConcurrencyManagementType.BEAN) public class Logger { ... } •What about method access?
  • 19. @alextheedom#JavaEE Java EE Implementation •Method access •LockType.WRITE and LockType.READ @Lock(LockType.WRITE) public void addMessage(String message) { // Add message to log } @Lock(LockType.READ) public String getMessage() { // Get message } @Lock(LockType.WRITE) public void addMessage(String message) { // Add message to log } @Lock(LockType.READ) public String getMessage() { // Get message }
  • 20. @alextheedom#JavaEE Java EE Implementation •Method access timeout •ConcurrentAccessTimeoutException •Defined by annotation @AccessTimeout •Class and method level @AccessTimeout(value = 30, unit=TimeUnit.SECONDS) @Lock(LockType.WRITE) public void addMessage(String message) { // Add message to log } @AccessTimeout(value = 30, unit=TimeUnit.SECONDS) @Lock(LockType.WRITE) public void addMessage(String message) { // Add message to log }
  • 21. @alextheedom#JavaEE Conclusion •Substantially different manner of implementation •Marked reduction in code (~50%) •Implementation improved via specialized annotations •Startup behavioural characteristics •Fine grain control over concurrency and access timeout
  • 22. @alextheedom#JavaEE Factory Pattern •Creational pattern •Interface for creating family of objects •Clients are decoupled from the creation
  • 23. @alextheedom#JavaEE Conventional Implementation public class DrinksMachineFactory implements AbstractDrinksMachineFactory{ public DrinksMachine createCoffeeMachine() { return new CoffeeMachine(); } } public class DrinksMachineFactory implements AbstractDrinksMachineFactory{ public DrinksMachine createCoffeeMachine() { return new CoffeeMachine(); } } •Use it like so: AbstractDrinksMachineFactory factory = new DrinksMachineFactory(); DrinksMachine coffeeMachine = factory.createCoffeeMachine(); AbstractDrinksMachineFactory factory = new DrinksMachineFactory(); DrinksMachine coffeeMachine = factory.createCoffeeMachine(); •Abstract factory
  • 24. @alextheedom#JavaEE Java EE Implementation •CDI framework is a factory public class CoffeeMachine implements DrinksMachine { // Implementation code } public class CoffeeMachine implements DrinksMachine { // Implementation code } •Use it like so: @Inject DrinksMachine drinksMachine; @Inject DrinksMachine drinksMachine;
  • 25. @alextheedom#JavaEE Java EE Implementation •Problem! Multiple concrete implementations public class CoffeeMachine implements DrinksMachine { // Implementation code } public class SoftDrinksMachine implements DrinksMachine { // Implementation code } public class CoffeeMachine implements DrinksMachine { // Implementation code } public class SoftDrinksMachine implements DrinksMachine { // Implementation code } @Inject DrinksMachine drinksMachine; @Inject DrinksMachine drinksMachine; •Which DrinksMachine to inject?
  • 26. @alextheedom#JavaEE Java EE Implementation •Solution! Qualifiers @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface SoftDrink @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface SoftDrink @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface Coffee @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface Coffee
  • 27. @alextheedom#JavaEE Java EE Implementation •Annotate respective classes @Coffee public class CoffeeMachine implements DrinksMachine { // Implementation code } @Coffee public class CoffeeMachine implements DrinksMachine { // Implementation code } @SoftDrink public class SoftDrinksMachine implements DrinksMachine { // Implementation code } @SoftDrink public class SoftDrinksMachine implements DrinksMachine { // Implementation code }
  • 28. @alextheedom#JavaEE Java EE Implementation •Annotate injection points @Inject @SoftDrink DrinksMachine softDrinksMachine; @Inject @SoftDrink DrinksMachine softDrinksMachine; @Inject @Coffee DrinksMachine coffeeDrinksMachine; @Inject @Coffee DrinksMachine coffeeDrinksMachine;
  • 29. @alextheedom#JavaEE Java EE Implementation •Conclusions so far •No boilerplate code •Container does all the hard work •Disambiguation via qualifiers •Remember •Only JSR299 beans are ‘injectable’
  • 30. @alextheedom#JavaEE Java EE Implementation •Dive deeper •Producer methods •Use it like so: @Produces @Library public List<Book> getLibrary(){ // Generate a List of books called 'library' return library; } @Produces @Library public List<Book> getLibrary(){ // Generate a List of books called 'library' return library; } @Inject @Library List<Books> library; @Inject @Library List<Books> library;
  • 31. @alextheedom#JavaEE Java EE Implementation •Scope •Determines when method called •Life of object: @RequestScoped -> @ApplicationScoped @SessionScoped @Produces @Library public List<Book> getLibrary(){ // Generate a List of books called 'library' return library; } @SessionScoped @Produces @Library public List<Book> getLibrary(){ // Generate a List of books called 'library' return library; }
  • 32. @alextheedom#JavaEE Java EE Implementation •Parameterized creation public class LoggerFactory{ @Produces public Logger logger(InjectionPoint injectionPoint) { return Logger.getLogger( injectionPoint.getMember() .getDeclaringClass().getName()); } } public class LoggerFactory{ @Produces public Logger logger(InjectionPoint injectionPoint) { return Logger.getLogger( injectionPoint.getMember() .getDeclaringClass().getName()); } } @Inject private transient Logger logger; @Inject private transient Logger logger;
  • 33. @alextheedom#JavaEE Java EE Implementation •Conclusions so far •Virtually any object can be made injectable •Automatic per class configuration
  • 34. @alextheedom#JavaEE Harnessing the power of CDI •A variation on the factory pattern •Imaginative use of CDI •Multiple implementations of the same interface •Collect and select pattern •Uses @Any, enums, annotation literals and Instance class
  • 35. @alextheedom#JavaEE Harnessing the power of CDI •@Any @Any @Inject private Instance<MessageType> messages @Any @Inject private Instance<MessageType> messages
  • 36. @alextheedom#JavaEE Harnessing the power of CDI •Distinguish between message types using qualifiers @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) public @interface Message { Type value(); enum Type{ SHORT, LONG } } @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) public @interface Message { Type value(); enum Type{ SHORT, LONG } }
  • 37. @alextheedom#JavaEE Harnessing the power of CDI •Annotate our classes @Message(Message.Type.SHORT) public class ShortMessage implements MessageType{ // Short message implementation code } @Message(Message.Type.SHORT) public class ShortMessage implements MessageType{ // Short message implementation code } @Message(Message.Type.LONG) public class LongMessage implements MessageType{ // Long message implementation code } @Message(Message.Type.LONG) public class LongMessage implements MessageType{ // Long message implementation code }
  • 38. @alextheedom#JavaEE Harnessing the power of CDI •Create an annotation literal for messages public class MessageLiteral extends AnnotationLiteral<Message> implements Message { private Type type; public MessageLiteral(Type type) { this.type = type; } public Type value() { return type; } } public class MessageLiteral extends AnnotationLiteral<Message> implements Message { private Type type; public MessageLiteral(Type type) { this.type = type; } public Type value() { return type; } }
  • 39. @alextheedom#JavaEE Harnessing the power of CDI •Putting the puzzle together @Inject @Any private Instance<MessageType> messages; public MessageType getMessage(Message.Type type) { MessageLiteral literal = new MessageLiteral(type); Instance<MessageType> typeMessages = messages.select(literal); return typeMessages.get(); } @Inject @Any private Instance<MessageType> messages; public MessageType getMessage(Message.Type type) { MessageLiteral literal = new MessageLiteral(type); Instance<MessageType> typeMessages = messages.select(literal); return typeMessages.get(); }
  • 40. @alextheedom#JavaEE Harnessing the power of CDI •Use it like so: @Inject private MessageFactory mf; public void doMessage(){ MessageType m = mf.getMessage(Message.Type.SHORT); } @Inject private MessageFactory mf; public void doMessage(){ MessageType m = mf.getMessage(Message.Type.SHORT); }
  • 41. @alextheedom#JavaEE Conclusion •CDI removes need for factory pattern •Container does all the hard work •Substantially less boilerplate code •Disambiguation via qualifiers •Increased creativity •Collect and select
  • 43. @alextheedom#JavaEE Façade Pattern •Encapsulates complicated logic •@Stateless, @Stateful @Stateless public class BankServiceFacade{ @Inject private AccountService accountService; } @Stateless public class BankServiceFacade{ @Inject private AccountService accountService; } @Stateless public class AccountService{} @Stateless public class AccountService{}
  • 45. @alextheedom#JavaEE Decorator Pattern @Decorator @Priority(Interceptor.Priority.APPLICATION) public class PriceDiscountDecorator implements Product { @Any @Inject @Delegate private Product product; public String generateLabel() { product.setPrice(product.getPrice() * 0.5); return product.generateLabel(); } } @Decorator @Priority(Interceptor.Priority.APPLICATION) public class PriceDiscountDecorator implements Product { @Any @Inject @Delegate private Product product; public String generateLabel() { product.setPrice(product.getPrice() * 0.5); return product.generateLabel(); } }
  • 46. @alextheedom#JavaEE Observer Pattern •Notifies dependents of state change public void trace(@Observes String message){ // Response to String event } public void trace(@Observes String message){ // Response to String event }
  • 47. @alextheedom#JavaEE Final Conclusion •Efficiency savings •Greater control over behaviour •New features enhance implementation •Opens doors to new pattern design
  • 48. #JavaEE @alextheedom 40% discount with promo code VBK43 when ordering through wiley.com valid until 1st September
  • 50. #JavaEE @alextheedom Professional Java EE Design PatternsAlex Theedom @alextheedom alextheedom.com Thank You