Background? </li></ul><li>Is there any “ magic bullet ”? </li></ul><li>That makes our team look like this... </li></ul>
Introduction III <ul><li>How can we improve the situation: </li><ul><li>Learn the various choices you can make so you can decide between them
Adapt your architecture to the web development world. </li></ul><li>So, we are here to: </li><ul><li>Showcase some technologies that can be used in the Java plattform.
Demonstrate that an architecture can be adaptable. </li></ul><li>The end goal is that the choice looks like... </li></ul>
Learning: why the JVM? <ul><li>Java is/was popular for a reason. Among other things </li><ul><li>Very good virtual machine
Tons of libraries, utilities, frameworks, API... </li></ul><li>So, should we start from scratch? </li><ul><li>Sometimes not possible (100% one-step migration)
Small steps help you move from a safe location to a closer safe location. </li></ul></ul>
Learning: how? <ul><li>The JVM is a bytecode interpreter/dynamic compiler so... </li><ul><li>Generate compatible bytecode from the new language. (ex. Scala)
Implement in bytecode an interpreter for the new language. (ex. BeanShell)
Combine both solutions. (ex. Groovy) </li></ul><li>The “interpreted” languages can be accessed </li><ul><li>Through a custom API
Through the Java Scripting API (JSR-232, Java >=6) </li></ul></ul>
Learning: Java Scripting API ScriptEngineManager theScriptEngineManager = new ScriptEngineManager (); ScriptEngine theSE = theScriptEngineManager .getEngineByExtension( extension ); Reader reader = ...; ... // To interpret the script directly theAnswer = theSE .eval( reader ); // If you call a function inside the script theSE .eval( reader ); Invocable inv = ( Invocable ) theSE ; theAnswer = inv .invokeFunction( functionName );
Architecture: How to be prepared? <ul><li>In order to be able to adapt to different requierements, we will use an architecture built around the Separation of Concerns (SoC) pattern.
The overall goal is to have an architecture where the different parts communicate through clearly defined interfaces, so the don't step into each other toes.
Using an “opinionated” artechitecture with tight integration brings other advantages and drawbacks. </li></ul>
Conclusions <ul><li>The JVM is not only Java and you don't have to abandon completely the Java platform.
There are many different languages with different styles that are more or less useful depending on your needs.
Learning different approaches to face all the different challenges is the way to be prepared.
SoC architectures are an option to facilitate having different approaches at hand, even though it's not the only one and it is not necessarily the best.
Implementing such an experiment is quite an experience and acts as a vaccine against language bigotry.
Next question is... is any of this really useful in real life? </li><ul><li>We have alredy used it to migrate the business logic from one option to another and reduce memory consumption and CPU load on the DB to move it to the application server so clustering of those elements is more effective.