Remove presentations
@ -188,10 +188,6 @@ Use the Abstract Factory pattern when
|
||||
## Tutorial
|
||||
* [Abstract Factory Pattern Tutorial](https://www.journaldev.com/1418/abstract-factory-design-pattern-in-java)
|
||||
|
||||
## Presentations
|
||||
|
||||
* [Abstract Factory Pattern](etc/presentation.html)
|
||||
|
||||
|
||||
## Real world examples
|
||||
|
||||
|
Before Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 26 KiB |
@ -1,190 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Design Patterns - Abstract Factory Presentation</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
|
||||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
|
||||
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
|
||||
blockquote {
|
||||
border-left: 0.3em solid rgba(0,0,0,0.5);
|
||||
padding: 0 15px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="source">
|
||||
|
||||
class: center, middle
|
||||
|
||||
# Abstract Factory
|
||||
|
||||
---
|
||||
|
||||
# Also known as
|
||||
|
||||
* Kit
|
||||
|
||||
---
|
||||
|
||||
# Intent
|
||||
|
||||
* Provide an interface for creating families of related or dependent objects without specifying their concrete classes
|
||||
|
||||
---
|
||||
|
||||
# Explanation
|
||||
|
||||
* [Wikipedia](https://en.wikipedia.org/wiki/Abstract_factory_pattern) says:
|
||||
> "The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes"
|
||||
|
||||
<br />
|
||||
|
||||
* In plain words:
|
||||
* A factory that groups individual but related/dependent factories together without specifying their concrete classes;
|
||||
* A factory of factories;
|
||||
|
||||
---
|
||||
|
||||
# Example
|
||||
|
||||
* In a factory that creates kingdoms, we need objects with common theme:
|
||||
|
||||
* Elven kingdom needs an Elven king, Elven castle and Elven army;
|
||||
|
||||
* Orcish kingdom needs an Orcish king, Orcish castle and Orcish army;
|
||||
|
||||
<br />
|
||||
|
||||
* There is a dependency between the objects in the kingdom;
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
* Based on the kingdom example, the diagram below showcases the different concrete factories and their concrete products:
|
||||
|
||||
.center[]
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
* The class diagram below showcases the factory of factories;
|
||||
|
||||
* At runtime, we can define which Kingdom type is needed and pass it as a parameter to define which concrete KingdomFactory to instantiate;
|
||||
|
||||
* The concrete factory returned will then be able to produce the related objects of the specified type;
|
||||
|
||||
.center[]
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Abstract Factory pattern when:
|
||||
|
||||
* A system should be independent of how its products are created, composed and represented;
|
||||
|
||||
* A system should be configured with one of multiple families of products;
|
||||
|
||||
* A family of related product objects is designed to be used together, and you need to enforce this constraint;
|
||||
|
||||
* You want to provide a class library of products, and you want to reveal just their interfaces, not their implementations;
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Abstract Factory pattern when:
|
||||
|
||||
* The lifetime of the dependency is conceptually shorter than the lifetime of the consumer;
|
||||
|
||||
* You need a run-time value to construct a particular dependency;
|
||||
|
||||
* You want to decide which product to call from a family at runtime;
|
||||
|
||||
* You need to supply one or more parameters only known at run-time before you can resolve a dependency;
|
||||
|
||||
---
|
||||
|
||||
#Use Cases
|
||||
|
||||
* Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime;
|
||||
* Unit test case writing becomes much easier;
|
||||
|
||||
---
|
||||
|
||||
# Consequences
|
||||
|
||||
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time
|
||||
|
||||
---
|
||||
|
||||
# Real world examples
|
||||
|
||||
[javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
|
||||
|
||||
[javax.xml.transform.TransformerFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/transform/TransformerFactory.html#newInstance--)
|
||||
|
||||
[javax.xml.xpath.XPathFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/xpath/XPathFactory.html#newInstance--)
|
||||
|
||||
---
|
||||
|
||||
# Credits
|
||||
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
|
||||
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
* Source code http://java-design-patterns.com/patterns/abstract-factory/
|
||||
|
||||
</textarea>
|
||||
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
|
||||
</script>
|
||||
<script>
|
||||
var slideshow = remark.create();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -36,10 +36,6 @@ Use the Command pattern when you want to
|
||||
* implement callback functionality
|
||||
* implement the undo functionality
|
||||
|
||||
## Presentations
|
||||
|
||||
* [Command Pattern](etc/presentation.html)
|
||||
|
||||
## Real world examples
|
||||
|
||||
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
|
||||
|
Before Width: | Height: | Size: 56 KiB |
@ -1,243 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Design Patterns - Command Presentation</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
|
||||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
|
||||
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
|
||||
blockquote {
|
||||
border-left: 0.3em solid rgba(0,0,0,0.5);
|
||||
padding: 0 15px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="source">
|
||||
|
||||
class: center, middle
|
||||
|
||||
# Command
|
||||
|
||||
---
|
||||
|
||||
# Also known as
|
||||
|
||||
* Action, Transaction
|
||||
|
||||
---
|
||||
|
||||
# Intent
|
||||
|
||||
* Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
|
||||
|
||||
---
|
||||
|
||||
# Explanation
|
||||
|
||||
* [Wikipedia](https://en.wikipedia.org/wiki/Command_pattern) says:
|
||||
> In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters.
|
||||
|
||||
<br />
|
||||
|
||||
* In plain words:
|
||||
|
||||
* Enable the construction of components that are able to delegate, sequence or execute method calls at a time of their choosing;
|
||||
|
||||
---
|
||||
|
||||
# Explanation
|
||||
|
||||
Four terms always associated with the pattern:
|
||||
|
||||
* Command
|
||||
* Object that knows about the receiver and invokes a method of the receiver;
|
||||
|
||||
* Receiver
|
||||
* Object that does the work;
|
||||
|
||||
* Invoker
|
||||
* Knows how to execute a command, and optionally does the bookkeeping about the command execution;
|
||||
|
||||
* Client
|
||||
* Decides which commands to execute at which points, passing the command object to the invoker object;
|
||||
|
||||
---
|
||||
|
||||
# Example
|
||||
|
||||
In our example, a Wizard can cast spells on targets.
|
||||
|
||||
* Spell will be the command (implements the Command interface);
|
||||
* Goblin (a Target object) will be the receiver;
|
||||
* Wizard will be the invoker;
|
||||
* App will be the client;
|
||||
|
||||
```
|
||||
|
||||
//App.java
|
||||
public static void main(String[] args) {
|
||||
Wizard wizard = new Wizard();
|
||||
Goblin goblin = new Goblin();
|
||||
goblin.printStatus(); //Goblin, [size=normal] [visibility=visible]
|
||||
|
||||
wizard.castSpell(new ShrinkSpell(), goblin);
|
||||
wizard.castSpell(new InvisibilitySpell(), goblin);
|
||||
|
||||
goblin.printStatus(); //Goblin, [size=small] [visibility=invisible]
|
||||
|
||||
wizard.undoLastSpell();
|
||||
|
||||
goblin.printStatus(); //Goblin, [size=small] [visibility=visible]
|
||||
|
||||
wizard.redoLastSpell();
|
||||
goblin.printStatus(); //Goblin, [size=small] [visibility=invisible]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
.center[]
|
||||
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Command pattern when you want to:
|
||||
|
||||
* Parameterize objects by an action to perform;
|
||||
* You can express such parameterization in a procedural language with a callback function, that is, a function that's registered somewhere to be called at a later point;
|
||||
|
||||
* Commands are an object-oriented replacement for callbacks;
|
||||
|
||||
<br />
|
||||
|
||||
* Specify, queue, and execute requests at different times;
|
||||
* A Command object can have a lifetime independent of the original request;
|
||||
|
||||
* If the receiver of a request can be represented in an address space-independent way, then you can transfer a command object for the request to a different process and fulfill the request there;
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Command pattern when you want to:
|
||||
|
||||
* Support undo;
|
||||
* The Command's execute() operation can store state for reversing its effects in the command itself;
|
||||
|
||||
* The Command interface must have an added unexecute() operation that reverses the effects of a previous call to execute;
|
||||
|
||||
* Executed commands are stored in a history list;
|
||||
|
||||
* Unlimited-level undo and redo is achieved by traversing this list backwards and forwards calling unexecute() and execute(), respectively;
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Command pattern when you want to:
|
||||
|
||||
* Support logging changes so that they can be reapplied in case of a system crash;
|
||||
* By augmenting the Command interface with load() and store() operations, you can keep a persistent log of changes;
|
||||
|
||||
* Recovering from a crash involves reloading logged commands from disk and re-executing them with the execute operation;
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Command pattern when you want to:
|
||||
|
||||
* Structure a system around high-level operations build on primitive operations;
|
||||
* Such a structure is common in information systems that support transactions;
|
||||
|
||||
* A transaction encapsulates a set of changes to data;
|
||||
|
||||
* The Command pattern offers a way to model transactions;
|
||||
|
||||
* Commands have a common interface, letting you invoke all transactions the same way;
|
||||
|
||||
* The pattern also makes it easy to extend the system with new transactions
|
||||
|
||||
---
|
||||
|
||||
# Use Cases
|
||||
|
||||
* To keep a history of requests;
|
||||
|
||||
* Implement callback functionality;
|
||||
|
||||
* Implement the undo functionality;
|
||||
|
||||
---
|
||||
|
||||
# Real world examples
|
||||
|
||||
[java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
|
||||
|
||||
[Netflix Hystrix](https://github.com/Netflix/Hystrix/wiki)
|
||||
|
||||
[javax.swing.Action](http://docs.oracle.com/javase/8/docs/api/javax/swing/Action.html)
|
||||
|
||||
---
|
||||
|
||||
# Credits
|
||||
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
|
||||
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
* Source code http://java-design-patterns.com/patterns/command/
|
||||
|
||||
</textarea>
|
||||
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
|
||||
</script>
|
||||
<script>
|
||||
var slideshow = remark.create();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -69,10 +69,6 @@ Use the Factory Method pattern when
|
||||
* a class wants its subclasses to specify the objects it creates
|
||||
* classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate
|
||||
|
||||
## Presentations
|
||||
|
||||
* [Factory Method Pattern](etc/presentation.html)
|
||||
|
||||
## Real world examples
|
||||
|
||||
* [java.util.Calendar](http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance--)
|
||||
|
Before Width: | Height: | Size: 58 KiB |
@ -1,185 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Design Patterns - Factory Method Presentation</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
|
||||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
|
||||
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
|
||||
blockquote {
|
||||
border-left: 0.3em solid rgba(0,0,0,0.5);
|
||||
padding: 0 15px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="source">
|
||||
|
||||
class: center, middle
|
||||
|
||||
# Factory Method
|
||||
|
||||
---
|
||||
|
||||
# Also known as
|
||||
|
||||
* Virtual Constructor
|
||||
|
||||
---
|
||||
|
||||
# Intent
|
||||
|
||||
* Define an interface for creating an object, but let subclasses decide which class to instantiate;
|
||||
* Factory Method lets a class defer instantiation to subclasses;
|
||||
|
||||
---
|
||||
|
||||
# Explanation
|
||||
|
||||
* [Wikipedia](https://en.wikipedia.org/wiki/Factory_method_pattern) says:
|
||||
> "In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method (either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes) rather than by calling a constructor."
|
||||
|
||||
* In plain words:
|
||||
* It provides a way to delegate the instantiation logic to child classes;
|
||||
|
||||
---
|
||||
|
||||
# Example
|
||||
|
||||
* Blacksmith manufactures weapons;
|
||||
|
||||
* Elves require Elvish weapons and Orcs require Orcish weapons;
|
||||
|
||||
* Depending on the customer at hand, the right type of blacksmith is summoned and, consequently, the right type of weapon;
|
||||
|
||||
---
|
||||
|
||||
# Programmatic Example
|
||||
|
||||
Considering the blacksmith example, we have a blacksmith interface and some implementations for it:
|
||||
|
||||
<br />
|
||||
|
||||
```
|
||||
public interface Blacksmith {
|
||||
Weapon manufactureWeapon(WeaponType weaponType);
|
||||
}
|
||||
|
||||
public class ElfBlacksmith implements Blacksmith {
|
||||
public Weapon manufactureWeapon(WeaponType weaponType) {
|
||||
return new ElfWeapon(weaponType);
|
||||
}
|
||||
}
|
||||
|
||||
public class OrcBlacksmith implements Blacksmith {
|
||||
public Weapon manufactureWeapon(WeaponType weaponType) {
|
||||
return new OrcWeapon(weaponType);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Programmatic Example
|
||||
|
||||
Now, as the customers come, the correct type of blacksmith is summoned and weapons are instantiated via the factory method `manufactureWeapon()`:
|
||||
|
||||
<br />
|
||||
|
||||
```
|
||||
Blacksmith blacksmith = new ElfBlacksmith();
|
||||
blacksmith.manufactureWeapon(WeaponType.SPEAR);
|
||||
blacksmith.manufactureWeapon(WeaponType.AXE);
|
||||
// Elvish weapons are created
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
* The diagram below showcases the example:
|
||||
|
||||
.center[]
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use the Factory Method pattern when:
|
||||
|
||||
* A class can't anticipate the class of objects it must create;
|
||||
|
||||
* A class wants its subclasses to specify the objects it creates;
|
||||
|
||||
* Classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate;
|
||||
|
||||
---
|
||||
|
||||
# Real world examples
|
||||
|
||||
* [java.util.Calendar](http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance--)
|
||||
* [java.util.ResourceBundle](http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html#getBundle-java.lang.String-)
|
||||
* [java.text.NumberFormat](http://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.html#getInstance--)
|
||||
* [java.nio.charset.Charset](http://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html#forName-java.lang.String-)
|
||||
* [java.net.URLStreamHandlerFactory](http://docs.oracle.com/javase/8/docs/api/java/net/URLStreamHandlerFactory.html#createURLStreamHandler-java.lang.String-)
|
||||
* [java.util.EnumSet](https://docs.oracle.com/javase/8/docs/api/java/util/EnumSet.html#of-E-)
|
||||
* [javax.xml.bind.JAXBContext](https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/JAXBContext.html#createMarshaller--)
|
||||
|
||||
---
|
||||
|
||||
# Credits
|
||||
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)
|
||||
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
* Source code http://java-design-patterns.com/patterns/factory-method/
|
||||
|
||||
</textarea>
|
||||
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
|
||||
</script>
|
||||
<script>
|
||||
var slideshow = remark.create();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -29,9 +29,6 @@ Use Hexagonal Architecture pattern when
|
||||
## Tutorials
|
||||
* [Build Maintainable Systems With Hexagonal Architecture](http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/)
|
||||
|
||||
## Presentations
|
||||
* [Hexagonal Architecture](https://github.com/iluwatar/java-design-patterns/tree/master/hexagonal/etc/presentation.html)
|
||||
|
||||
## Real world examples
|
||||
|
||||
* [Apache Isis](https://isis.apache.org/) builds generic UI and REST API directly from the underlying domain objects
|
||||
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 34 KiB |
@ -1,25 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<mxfile userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36" version="6.0.1.3" editor="www.draw.io" type="device"><diagram name="Page-1">7Zpdk6I4FIZ/jbdbJAHEyx7nY/diqrqqd2tnLiOJSDUSK6ZHe3/9BkmUfFiDDqBM2TcNBwLxOe85nBOYoPl6/4XjzeorI7SYwIDsJ+jjBEKA4kj+qyzvtWUag9qQ8Zyok06Gl/w/qoyBsr7lhG6NEwVjhcg3pjFlZUlTYdgw52xnnrZkhXnXDc6oY3hJceFa/82JWNXWJApO9j9pnq30nUGgjixw+ppx9laq+00gWh7+6sNrrK+lzt+uMGG7hgl9mqA5Z0zUW+v9nBYVW42tHvf5zNHjvDktRZsBqB7wAxdvVM/4MC/xrlnIKW6qzRXd44yVE/RhQ3m+poLyk/X5ZPqwW+WCvmxwWo3aSYFI20qsC7kH5Ka6I+WC7s/OGhxZSI1RJi/N3+UpagBMFD4lL6D3dydnIa2lVcNRMFZGrASSHa99giQ3FCc/MzhKZmgaGcyOKBrMAPQwO2r7V5iFDrM549ThJgfJEKc/B7LMi2LOCsYP46oYg2kq7VvB2SttHCHxIo7ibhCGATARJshBqDNfk2AXoot+Lrpr4RFMk6UXXpwmdLHsCF5s6W/qwkMe+aEO4MW/GzwEPQmvJ3jT0cMDMxNeGA0GLxk7PDQ1H7VDKm82fnh2zoODwdPlz3jphdCUHoyGkx5oUeRdTS+iCQl99BK4QHFHxUoUWfQ89V5v9Fq0FXdOz9ZeMCC9Nk/ckjxVfa7cK1lJTWJ0n4tvje3vcjuotks5k2/Nne/6rJJ8zqsJHQ7Vd6PE6ZEtenJG7I2n1KhQBeYZFU0duJAbECMPRG3jtMAi/2HOwkdW3eGZ5XJ+Z7vECFjOqWevRjWbZOtCCJkXCu2Cvv7NzoUOjj7+7Ha+b1MwXOz7P6IefQwfPr7Qx33WNYNkR5s60nXuANkR9lnXDEIPWc8WNBvu2aJn+8v5JfDkF/V0Ac2nS3e5J/Hkntkj91yWe7S7O/U/OO/9/nzfWC5/+L6d70dfldsrOSEcbiXHs4R9ZeTUGdEXO41E2mX0TD3Rc1+Vue2gq6Mn6S963BX4Z8bF1hGBlLcwPW/GhFJGM4CUCRd5VsrdVDrz8FaoCpY8xcWTOrDOCSnOBWcH8YVmoYHzGDgNWYS+12pdxJe7SP/PVlKQZ1Q0ltVvtVEfXrRSojD3/w4NALvudd9hAN97x7ALQO6ywN90WwUDzqiS903h2CvFiZucZ32xcdvmv6RqMi6zFCtvjuZY4et851lN6g2N221+xAIv8Pb28RQHJhcwG04yOrU1uHxl6au0kLvBYz3dYOTi6S3doPF2irpKNAqe2I96mIIHWJ6Mr20XgF059dcuoD5axWEEoOsRQwDThwAuFECbfvE+Ox5dlxkCSB4CuFAAXbW8vpcRvldRHT4CfAK46WrhKAXQ5quzOxUAdAWAbrpkOEoBuE35E8Eb2Y//XuseVh+CPP1ZR+secvf0dXftkdMn9OjT/w==</diagram></mxfile>
|
@ -1,127 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
|
||||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
|
||||
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="source">
|
||||
|
||||
class: center, middle
|
||||
|
||||
# Hexagonal Architecture
|
||||
|
||||
---
|
||||
|
||||
# Also known as
|
||||
|
||||
* Ports and Adapters
|
||||
* Clean Architecture
|
||||
* Onion Architecture
|
||||
|
||||
---
|
||||
|
||||
# Layered architecture problems
|
||||
|
||||
* No clear application core
|
||||
* Business logic leaks to the presentation layer
|
||||
<br />
|
||||
<br />
|
||||
|
||||
.center[]
|
||||
|
||||
---
|
||||
|
||||
# Intent
|
||||
|
||||
* Application can be driven by users, programs, automated test or batch scripts
|
||||
* Application can be developed and tested in isolation from its eventual run-time devices and databases
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
Use Hexagonal Architecture pattern
|
||||
|
||||
* When the application needs to be independent of any frameworks
|
||||
* When it is important that the application highly maintainable and fully testable
|
||||
|
||||
---
|
||||
|
||||
# Concepts
|
||||
|
||||
* Ports are interfaces
|
||||
* The ports that drive the application are called primary ports
|
||||
* The ports that are driven by the application are called secondary ports
|
||||
|
||||
---
|
||||
|
||||
# Concepts
|
||||
|
||||
* Adapters are interface implementations
|
||||
* Typically different adapters for testing and production are provided
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
.center[]
|
||||
|
||||
---
|
||||
|
||||
# Real world examples
|
||||
|
||||
* [Apache Isis](https://isis.apache.org/) builds generic UI and REST API directly from the underlying domain objects
|
||||
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
* Blog http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/
|
||||
* Source code http://java-design-patterns.com/patterns/hexagonal/
|
||||
|
||||
</textarea>
|
||||
<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js">
|
||||
</script>
|
||||
<script>
|
||||
var slideshow = remark.create();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -129,9 +129,6 @@ are several common situations in which the Proxy pattern is applicable
|
||||
## Tutorials
|
||||
* [Controlling Access With Proxy Pattern](http://java-design-patterns.com/blog/controlling-access-with-proxy-pattern/)
|
||||
|
||||
## Presentations
|
||||
* [Proxy](https://github.com/iluwatar/java-design-patterns/tree/master/proxy/etc/presentation.html)
|
||||
|
||||
## Real world examples
|
||||
|
||||
* [java.lang.reflect.Proxy](http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Proxy.html)
|
||||
|
@ -1,92 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
|
||||
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
|
||||
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
|
||||
|
||||
body { font-family: 'Droid Serif'; }
|
||||
h1, h2, h3 {
|
||||
font-family: 'Yanone Kaffeesatz';
|
||||
font-weight: normal;
|
||||
}
|
||||
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="source">
|
||||
|
||||
class: center, middle
|
||||
|
||||
# Proxy
|
||||
|
||||
---
|
||||
|
||||
# Also known as
|
||||
|
||||
* Surrogate
|
||||
|
||||
---
|
||||
|
||||
# Intent
|
||||
|
||||
* Provide a surrogate or placeholder for another object to control access to it.
|
||||
|
||||
---
|
||||
|
||||
# Applicability
|
||||
|
||||
* Protection proxy limits access to the real subject.
|
||||
* Virtual proxies are used when an object is expensive to instantiate.
|
||||
* Caching proxies are used to cache expensive calls to the real subject.
|
||||
* Remote proxies are used in distributed object communication.
|
||||
* Smart proxies are used to implement reference counting and log calls to the object.
|
||||
|
||||
---
|
||||
|
||||
# Diagram
|
||||
|
||||
.center[]
|
||||
|
||||
---
|
||||
|
||||
# Tutorials
|
||||
|
||||
* Blog http://java-design-patterns.com/blog/controlling-access-with-proxy-pattern/
|
||||
* Source code http://java-design-patterns.com/patterns/proxy/
|
||||
|
||||
</textarea>
|
||||
<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js">
|
||||
</script>
|
||||
<script>
|
||||
var slideshow = remark.create();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 24 KiB |
@ -1,25 +0,0 @@
|
||||
<!--
|
||||
|
||||
The MIT License
|
||||
Copyright © 2014-2019 Ilkka Seppälä
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
-->
|
||||
<mxfile userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36" version="6.0.2.5" editor="www.draw.io" type="device"><diagram name="Page-1">7Vhtb5swEP41kbYPnQJuaPexeVv3YVK1aur60YEL8WowM05K+utnYxswkC6p2rSbmkoNfnx3vpfnLsAATZLiC8fZ6huLgA78YVQM0HTg+x4KPPmlkK1GziwQcxIZoRq4Jg9gwKFB1ySC3BEUjFFBMhcMWZpCKBwMc87uXbElo+6pGY6hA1yHmHbRGxKJlUbPR8MavwQSr+zJ3tDsLHB4F3O2Ts15Ax8ty4/eTrC1ZeTzFY7YfQNCswGacMaEvkqKCVCVW5s2rTffsVv5zSEV+yica4UNpmuwHgdUqo4z5Z3YmowEv9fKpXGCeUzSAbqQu8OskP8lWAam8BPBMr132tgTUIgTTEls9ELpG/DapryKzXd5MmkAOJEGx7S7+qpsLHEIFeyqOBZl/KR9yoJ3EAtcrxe/FKtq7UVbVmJZG1txlTLLZRudtzvQJ6WYwlI0crzLdje8PpdfxgMlW9b4ww15wDz6qKU3TLJuT/d8xzF/A1wQ2Z4XmkXTkmdjw6mpdmjMpNSSlt20JJLlaLxkqTDDxfPNeo4TQtVYugS6AWVVlU4kVAkpGak6YZTx8mTbvWicC87uoLEzLD+KahxHRMbb2Juezrz5qIpEuQ/Fzhb1qsaXAxVYAoJvpYhR8M/NrDCz1A6h+3owVeNk5Q4lMxDNMIwr0/VAkBdmJvTPB+vumxoQVTd+B0yP1awR2fQGbFOuHPcf68g8w+lBPSLddnUquPTl9VvlhYmPfJf4fcz3TnuYHzwH8f23TPwrzortO+X/O8oHnkv5s9ERGY/eIuN336VNqCrE/k3wj99SzAL19zw0G70iy7pPHLNCQBrlnQpJ8EI9y8nVgrLwTsYuIZv8QC/nZVmmQzfjMg98+1Phn0Z2eWv3CiIaW3J1awxoDyDqPBu28iq9ZGsegnuLJCTtQTQeq7rpbybYJpMDxYJs3CP7MmzMXTGiWL+jlAi1aqQ9NUrNB8GWHd/7iyEdXsdQWe8qxP0o8PmoFPCaBKiL/tOoVAQodw5v1SeSxn8nzUGkQd37sR85PEYYlkHq8kXN6wjnK4gMLZp0MZTwOpSoZ0mXSE8sPnov/mHF77s12V35lKVQ9izmomd8NOZFKWLWbULs8RPSJcvz/YToEI/CiKD1hqF643AsSsgi4W1DLFMC+eEO1wzTFvfkm1zWb1y1eP1aG83+AA==</diagram></mxfile>
|