java development with the dynamo framework
TRANSCRIPT
![Page 1: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/1.jpg)
EINDHOVEN JAVA MEETUP18 May 2016
that spin your world!
![Page 2: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/2.jpg)
AGENDA
¢ 17:30 Welcome with diner¢ 18:00 Application development with
Dynamo¢ 19:10 Break¢ 19:20 Apache Spark¢ 20:20 Q&A¢ 21:00 Closing doors
![Page 3: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/3.jpg)
APPLICATION DEVELOPMENTWITH THE DYNAMO FRAMEWORKEindhoven, 18th of May 2016
that spin your world!
![Page 4: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/4.jpg)
SPEAKER INTRODUCTION
¢ Patrick Deenen� R&D Director @ Open Circle Solutions
¢ Roles� Software Architect� Consultant� Software Engineer
¢ Experience� 25 years experience with custom application development� Mostly administrative systems� Background in 4GL (before 1998)� and web technology (since 1998, Java)� Focused on productivity, custom apps and architecture
![Page 5: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/5.jpg)
JAVA SOFTWARE DEVELOPMENT
• Mature language• Backwards compatible• Large number of available libraries
• But….• Development of new features goes rather slowly• Lacks some of the cooler features of new languages• Rather verbose• Standard Java web framework (JSF) is impopular
![Page 6: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/6.jpg)
(DE FACTO) STANDARDS
¢ JPA (Hibernate/EclipseLink) is widely used for ORM¢ Several mature and viable application frameworks are
available:� Java EE 7� Spring� Blueprint
¢ Many different user interface technologies: JSP, JSF, Wicket, Tiles, Tapestry
![Page 7: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/7.jpg)
JAVASCRIPT AND RESTFUL SERVICES
¢ JavaScript and HTML(5) have come a long way (e.g. AngularJS)
¢ Representational State Transfer (REST) services offer aneasy way of communicating with a Java backend
¢ Well suited for consumer websites¢ Less suitable (we think) for complex business applications
![Page 8: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/8.jpg)
PRODUCTIVITY
• Java EE and many libraries typically provide a fairly low level of abstraction
• Java is a verbose language that lacks many advancedfeatures found in more modern languages
• Naive approach leads to lots of boilerplate, code duplication, and busywork
• Java 8 adds some very welcome improvements (but is itenough?)
![Page 9: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/9.jpg)
PRODUCTIVITY (2)
• Use (Open Source) libraries and products to increaseproductivity
• Use code generators to generate the scaffolding/boilerplate• Use fourth-generation languages (4GL)• Develop your own framework to increase abstraction level:
• Convention over configuration• Declarative programming• Don’t repeat yourself (DRY)
![Page 10: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/10.jpg)
INTRODUCING
• Open Source pure Java framework based on proven productive technologies
• Leverages power of JPA 2 and Spring Framework• Offers base classes for Data Access layer and Service layer• Uses Vaadin for building rich user interfaces• Uses an adaptable metadata model called the Entity Model
as the basis for powerful composite user interface components
![Page 11: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/11.jpg)
SUPPORTED USE CASES BY DYNAMO
• Search structured information (variable number of entities)• User can enter filter criteria• Results can be displayed and sorted
• Display specific information (exactly one entity)• After user selection in search result• After user selection of static hyper link• Supports master-detail
• Create, update and delete information (one or more entities)• Validate information before commit• Supports master-detail
• Most in several different presentation structures
![Page 12: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/12.jpg)
DYNAMO TECHNOLOGIES: JPA
• JPA 2.1 is the Java standard for ORM• Hibernate implementation• Powerful model with fairly high degree of abstraction• Convention over configuration, smart use of annotations
![Page 13: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/13.jpg)
DYNAMO TECHNOLOGIES: SPRING
• Spring 4.x is an application framework that we use to tie together the various parts of a Dynamo application
• XML-based and annotation-based configuration• Dependency injection, transaction support, Apache Camel
integration, aspect-oriented programming (AOP)• Lots and lots of utilities and convenience classes
![Page 14: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/14.jpg)
DYNAMO TECHNOLOGIES: VAADIN
• Rich Java user interface library (dialogs, trees, dragand drop, server push etc.) for building single page applications
• Component- and event driven (similar to Swing/Wicket)• Write almost exclusively in Java• Java code runs on the server but automatically
synchronizes with a Javascript client (100% ajax)• Browser-independent without the need to know any
Javascript
![Page 15: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/15.jpg)
VAADIN ARCHITECTURE
![Page 16: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/16.jpg)
DYNAMO TECHNOLOGIES: VAADIN (3)• Extensive component library• Easy styling due to built-in themes• Many add-ons an plugins available in the Vaadin
Marketplace• Support for multiple sessions in separate browser
windows
![Page 17: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/17.jpg)
CONCEPT: ENTITY MODEL
• The Entity Model describes how the user can search for or create/edit an Entity
• Based primarily on the metadata of the object:• Type of a property determines the type of the field (e.g text field,
combo box) that is used to edit the property• @NotNull annotation requires if a field is required• @Temporal determines if you get a date picker, a date picker with
time, or a time field• Etc..
• Convention over configuration• Default behaviour (of both entity and its properties) can be
modified by the programmer
![Page 18: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/18.jpg)
CONCEPT: ENTITY MODEL (2)@Entity@Table(name = "meetings")
@AttributeOrder(attributeNames = { "description", "desiredLocation", "meetingDate", "startTime",
"endTime", "attendees", "whiteboard", "videoConferencing", "phoneConferencing", "priority" })@Model(displayProperty = "description")
public class Meeting extends AbstractEntity<Integer> {
• Any JPA entity can be used in the Entity Model• @Model and @AttributeOrder can be used to override
default behaviour
![Page 19: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/19.jpg)
CONCEPT: ENTITY MODEL (3)• The Entity Model is constructed by the Entity Model
Factory singleton• Entity Models are constructed lazily when first requested,
and are effectively immutable singletons
public interface EntityModelFactory {<T> EntityModel<T> getModel(Class<T> entityClass);<T> EntityModel<T> getModel(String reference,
Class<T> entityClass);
![Page 20: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/20.jpg)
ATTRIBUTE SETTINGS
• More than 25 settings are supported• Where does the property show up: in search form, in table,
in edit form• Editable versus read-only• Description, tooltip, prompt, default value• Formatting: decimal precision, percentage signs, date
formatting, custom boolean formatting (Yes/No, On/Off)• Validation: required, min/max length, e-mail check• What edit component to use: text field versus text area,
combobox versus lookup field versus list box.• Control over searching (case sensitivity, substring
matching)
![Page 21: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/21.jpg)
ATTRIBUTE DEFINITIONS@Size(max = 200)@Attribute(searchable = true)private String description;
@Column(name = "meeting_date")private Date meetingDate;
private Boolean videoConferencing = Boolean.FALSE;
![Page 22: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/22.jpg)
EXAMPLE: CHANGE COMPONENT TYPE• selectMode = AttributeSelectMode.LIST
• selectMode = AttributeSelectMode.COMBO
• selectMode = AttributeSelectMode.LOOKUP
![Page 23: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/23.jpg)
MESSAGE BUNDLE OVERWRITES
• Message bundle entries can be used to provide localizationor to overwrite behaviour in special cases
SimulationProgramme.code.readOnly=trueSimulationProgramme.simulationMode.readOnly=trueSimulationProgramme.simulationMode.visible=trueSimulationProgramme.simulationDescription.visible=trueSimulationProgramme.salesOrganisation.readOnly=true
![Page 24: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/24.jpg)
COMPOSITE USER INTERFACECOMPONENTS
• Dynamo can generate search or edit screens based on the Entity Model and a single high level UI component.
• In a typical scenario, a couple of lines of code are enough todefine an entire screen
• Behaviour of the screen can be further customised usingparameters and callback methods• Custom components• Default filters• Filters to be applied to lookup components (combo boxes, popup
search screens)• Change listeners/interfield dependencies• Extra custom buttons
![Page 25: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/25.jpg)
EXAMPLE: SIMPLESEARCHLAYOUT
• Search screen, consisting of search form and results table• Search field is generated automatically for every property
that is defined as “searchable”.• Includes pop-up search fields, three-way booleans, range fields
for dates/numbers• Correct filters are automatically applied when the
“Search” button is clicked
![Page 26: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/26.jpg)
EXAMPLE: SIMPLESEARCHLAYOUT (2)• Component supports editing/adding of entities by
switching to separate detail screen• Parameters can be used to toggle addition/editing/deletion
functionality• Detail screen can be opened in edit mode or read-only
mode.
![Page 27: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/27.jpg)
EXAMPLE: SIMPLESEARCHLAYOUT (3)
FormOptions fo = new FormOptions();
fo.setShowRemoveButton(true);
SimpleSearchLayout<Integer, Meeting> searchLayout = new SimpleSearchLayout<>(meetingService, getModelFactory().getModel(Meeting.class), QueryType.ID_BASED, fo,new SortOrder("description", SortDirection.ASCENDING));mainLayout.addComponent(searchLayout);
![Page 28: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/28.jpg)
EXAMPLE: SPLITLAYOUT
• Screen consisting of a table (with limited search options) and an accompanying edit form
• Table can be displayed either above (VERTICAL) or to the left (HORIZONTAL) of the edit form
• Selecting an item in the table automatically loads the item in the edit view
• Standard buttons for adding, removing• Edit form can be switched between edit mode, read-only
mode, and custom view
![Page 29: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/29.jpg)
OTHER COMPONENTS
• SimpleEditLayout (edit form for editing a single entity)• TabularEditLayout (table that allows direct editing)• LazyTabLayout (tab panel component that loads the
contents of a tab only when needed)• Upload component with progress bar support• Data grid with pivot functionality• Generic functionality for exporting table content to Excel• Multi-level lazy editable tree table• MenuService for declaratively creating menu based on
message bundles• Declarative role-based security
![Page 30: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/30.jpg)
DATA ACCESS
• Components use Vaadin LazyQueryContainer whichprovides lazy loading of data
• Standard paging approach• ID-based querying (driving query pattern) allows efficient
fetching of entity hierarchies
![Page 31: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/31.jpg)
WARNING: NOT A CODE GENERATOR
• Dynamo framework automatically generates screens basedon metadata and declarations
• The metadata and declarations are (of course) defined at design time
• Actual screen generation happens at runtime – no code is generated up front
• Dynamo does provide a Maven archetype for quick project setup
![Page 32: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/32.jpg)
YOUR MILEAGE MAY VARY
• Dynamo is best suited for data entry/administrativeapplications
• Emphasis is on productivity• Not as suitable for end user websites or mostly read-only
systems• Dynamo currently only supports relational databases
(SQL) for storage• Current implementation relies on Spring framework (Java
EE support upcoming)
![Page 33: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/33.jpg)
CHECK OUT GITHUB
• The code of the Dynamo Framework is available in GitHub.• Check out https://github.com/opencirclesolutions/dynamo• Feel free to contribute!
![Page 34: Java development with the dynamo framework](https://reader031.vdocuments.mx/reader031/viewer/2022030313/58ecd4501a28ab97318b45dd/html5/thumbnails/34.jpg)
DEMO TIME!¢ Dynamo showcase