DIF Tutorial - Application Structure

Back to Application definition - What will we build?

Before we start to code the application it's a good idea to look briefly on how DIF sees your application.

DIF uses an entity hierarchy to promote modularity and resource reusing. An entity inherit several characteristics from its parent and several entities of the same kind can be aggregated under the same parent, presenting a logical organization to the application. Since this entity hierarchy provides a frame for application structure abstraction it acts as a metamodel. As such it was aptly named DEM (DIF Entity Metamodel) TODO: Add link to User Guide Metamodel chapter.

Below is a description of each entity:

  • Provider: This is the top-level entity. There must be exactly one provider on your web application. It aggregates a set of applications (not web applications, mind you...keep reading).
  • Application: Aggregates a set of services and is associated with a given provider.
  • Service: Aggregates a set of runnable stages and is associated with a given application.
  • Stage: This is the finest grained entity that will contain the business logic. It's the stage that will be executed by the framework.

As was told before, you can reuse several resource such as messages, parameters, etc. Due to the inheritance properties, any of these resources defined on a higher-level entity will be made available on its children. But what if you have a resource defined on a higher-level entity and need to use a specific resource on a given children? No problem! The DEM inheritance mechanism is pretty much the same as the Java one: you just override the resource on the child entity and DIF will do the rest for you.

The Stage entity acts as the controller on the traditional MVC model. As such, it should contain the business logic (application behavior) and might present view redirecting capabilities based on the application state. So, a Stage can have zero (you can have your stage redirecting the execution flow to another stage!), one or many views associated. As for the "M" in the MVC pattern, the model, well, forget it by now. You will learn how to integrate your DIF-based web app with a data model on another tutorial. Here we are concerned in getting you moving on DIF, so we are keeping it simple.

Keep in mind that there some other details about the DEM, but this is a start-up tutorial, so they will not be covered here.

Advance to Building the Application