Code Monkey home page Code Monkey logo

demo-jigsaw-advent-calendar's Introduction

Jigsaw Advent Calendar 🎄

This demo project contains the code for a post for the Java Advent Calendar (which I published in on my blog as well). It showcases a couple of features of Project Jigsaw.

The code is released into the public domain via CC0 so it can be used without any limitations.

😴 This demo project is no longer maintained. It is superseeded by a simpler "Hello World" example and the more well-rounded ServiceMonitor application. 😴

The Advent Calendar

Even though I do my best to ignore the whole christmas kerfuffle, it seemed prudent to have the demo uphold "the spirit of the season". So it models an advent calendar:

  • There is a Calendar, which has 24 CalendarSheets.
  • Each sheet knows its day of the month and contains a Surprise.
  • The death march towards Christmas is symbolized by printing the sheets (and thus the surprises) to the console.

Of course the calendar needs to be created first. It can do that by itself but it needs the means to create surprises. To this end it requires a List<SurpriseFactory>.

Sections

The demo consists of several sections, each building on the previous ones. There is a branch for each section.

  • 0️⃣ Before Jigsaw: describes the application's organization before Jigsaw
  • 1️⃣ Creating A Module: moves the application into Jigsaw land by moving it into a single module
  • 2️⃣ Splitting Into Modules: explores more of Jigsaw's core features by splitting the application into several modules
  • 3️⃣ Services: introduces services and the ServiceLocator for loose coupling between modules
  • 4️⃣ Automatic Modules: shows how modules can depend on non-modularized JARs
  • 5️⃣ Optional Dependencies: demonstrates dependencies that are mandatory at compile time but are not required at run time

Setup

This demo (obviously) requires Java 9. For it to work the Java 9 variants of javac, jar, and java must be available on the command line via javac9, jar9, and java9, e.g. by symlinking them.

The root directory contains a compileAndRun.sh, which - surprise - compiles and runs the example.

demo-jigsaw-advent-calendar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.