2017 Northern Virginia Software Symposium

Introduction

The 2017 Northern Virginia Software Symposium is an event in the No Fluff Just Stuff (NFJS) conference series for JVM software architects and developers. Started in 2001, NFJS has delivered over 475 events, with over 75,000 attendees. NFJS hosts events in Reston, NYC, Boston, Denver, Seattle, and many more cities across the nation. This was a two and ½ day conference with sessions on web technologies like JavaScript and Angular, Java 8 and 9, new technologies like Akka, JShell, and RxJava and many others. The conference was complete with full course meals having entrees like salmon and roasted chicken and desserts like red velvet cake and tropical fruit tarts. This is an overview of the sessions I found the most interesting.

Web Apps With Angular presented by Raju Gandhi

I didn't have any prior experience with Angular so everything I learned in this session was new to me. This session was on Angular version 4. The entire framework has changed from Angular 1. The Angular folks are planning a major release every 6 months so if you get more than one release behind, Raju said it could be very difficult to upgrade. To develop Angular, Raju suggested using TypeScript instead of JavaScript, Visual Studio, and the Angular CLI build tool. To get started, set your code up according to the Angular Style Guide.

Angular is implemented as a hierarchy of components. This diagram exhibits an Angular component hierarchy.

Components are declared in a module and assigned an HTML tag. To use the component, place the tag inside a HTML document. You may use the CLI build tool to generate the scaffolding for a component. Raju said the Chrome browser plugin Augury has the best support for debugging Angular. Angular has import statements, classes, modules, support for the new Observable API, sophisticated routing and so much more. I see why it’s so popular these days.

Refactoring to Java 8 presented by Kenneth Kousen

This session consisted of a few tips to take advantage of some of the new constructs in Java 8. Kenneth identified four principles to keep in mind when refactoring to Java 8:

  • From imperative to declarative
  • Don't iterate -- transform
  • Favor immutability
  • Functional style

There are four main programming paradigms: imperative, declarative, functional (which is considered a subset of the declarative paradigm) and object-oriented. Declarative programming: is a programming paradigm that expresses the logic of a computation ("what to do") without describing its control flow ("how to do it"). Java is inherently imperative. With Java 8, you may use Lambdas to implement declarative programming.

Use streams to transform data versus iterating over data. With streams, it’s much easier to parallelize computations. But, Kenneth said, even though it may be easier, a performance increase depends on the volume of data; if the data can be partitioned; and how much time you have to spend on each partition. He suggested using the JMH benchmark tool to benchmark performance.

Kenneth said Java now supports underscores in numeric literals to improve readability. For example, you may say:

long socialSecurityNum = 999_99_9999L;

The rules are you may place underscores only between digits; you cannot place underscores in the following places:

  • At the beginning or end of a number
  • Adjacent to a decimal point in a floating point literal
  • Prior to an F or L suffix
  • In positions where a string of digits is expected

Reactive Programming in Java presented by Venkat Subramaniam

Use RxJava to implement reactive programming in Java. This is a diagram of the features of Reactive Programming

Reactive Programming is push versus pull technology. Here’s a diagram showing the difference between interactive and reactive programming:

This session was very technical with lots of coding examples so for details on RxJava see Venkat’s You Tube video

Bulletproof JavaScript presented by Nathaniel Schutta

This session listed some tools to “bulletproof” your JavaScript code. JavaScript now has testing, code coverage, build, and code analysis tools. Here are the tools discussed in the session:

JSHint

  • Does static code analysis
  • May catch common mistakes and defects automatically.
  • Highly configurable. Dozens and dozens of options. Configuration is in JSON and may be done in inline, via file or in package.json
  • Tune via ‘enforcing’ and ‘relaxing’ options. Enforcing makes JSHint more strict. Relaxing does the opposite.
  • Few programs pass on first run. Tune options to rules that best fit your team.
    Plato
  • Source code visualizer, complexity analyzer
  • Leverages JSHint
  • Cyclomatic complexity, line count, param count. Cyclomatic complexity is a software metric (measurement), used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code.
  • Halstead metrics, maintainability index.
  • You may point Plato to a JSHint option file or you may turn off JSHint

Here’s an example of a Plato report:
Jasmine

  • Behavior Driven Development (BDD) JavaScript testing framework
  • Doesn’t require the DOM or other libraries.
  • Includes beforeEach and afterEach for setup/teardown.
  • Can mock out the JavaScript clock.
  • Includes a waitFor to test asynchronous cases.
  • Runs in any JavaScript environment.

Karma

  • A JavaScript test runner
  • Works with several testing frameworks
  • Works with continuous integration servers like Jenkins
  • Change a file, Karma runs the tests
  • Karma spawns a web server
  • Ships with Chrome and PhantomJS.
  • Plugins for all major browsers.

Istanbul

  • JavaScript code coverage tool.
  • Use to identify what has been tested and what has not.
  • Computes statement, line, function and branch coverage
  • Can run at the command line or as part of build
  • HTML and LCOV reports.

Here’s a sample Istanbul report:

Java 9 - The Jigsaw Module System presented by Kirk Knoernschild

Kirk said the primary new feature in Java 9 is the introduction of modules. With standard Java, any public class in any JAR on the classpath may be seen by any other classes on the classpath! With a module system, you have control over who sees what!

These are some features of a module:

  • Published Interface - Make a module’s published interface well known.
  • External Configuration – Modules should be externally configurable.
  • Default Implementation - Provide modules with a default implementation.
  • Module Facade – Create a facade serving as a coarse-grained entry point to another fine-grained module’s underlying implementation.

Each module has a module-info.java file. In that file, you identify any external modules the module requires and the full path of classes the module exposes. Other modules may only interface with the exported classes. Here’s a diagram showing the relationship between two modules:

Since all classes on the classpath will no longer be globally available, dependency injection and Java’s Class.forName(...) may no longer work.

You may use the Java Dependency Analysis tool JDEPS, to help identify all of your program’s interdependecies so you may start preparing for Java 9 modules.

JShell: The REPL for Java presented by Venkat Subramaniam

Groovy, Scala, Haskell and other languages already have a REPL (Read Eval Print Loop). Now in Java 9, Java will have a REPL. A REPL may be good to do prototyping, experimenting with new constructs in the language, or as a learning/teaching tool. To access help in JShell, use /help. The “/” prefix indicates to JShell you’re executing a JShell command versus a command to the JVM. Use control D or /exit to quit JShell. Here’s a short video showing a demo of JShell.

Summary

The 2017 Northern Virginia Software Symposium is a good way to get exposure to language updates and new technologies. It's local, informative, industry leading speakers, and only around $1000 so you get a lot of information with only a small impact to your training budget. There's another one coming in October so if you still have money available in your training budget, be sure to check it out.