### Zest™ in 2 minutes

### Tip

Theses tutorials are based on actual code found in the `tutorials/` directory of the Zest™ SDK sources. You should start your favorite editor and find the code related to this tutorial, run it and play with it.

To show that Zest™ is not necessarily complex, not hard to get going with and easy to deploy, we are first showing the classic HelloWorld, as small as it can get and still be Composite Oriented Programming and not only standard OOP.

If you want to reproduce what’s explained in this tutorial, remember to depend on the Core Runtime artifact that depends on Core API, Core SPI, Core Bootstrap and Core Functional & I/O APIs:

Table 1. Artifact

Group ID | Artifact ID | Version
--- | --- | ---
org.qi4j.core | org.qi4j.core.runtime | 2.1

See the Depend on Zest™ in your build tutorial for details.

Ready, Set, Go!

Let’s say we want to do the common HelloWorld example, but with a more domain-oriented setting. We have a Speaker interface that does the talking. But we also need an implementation for Speaker, which we declare here via the `@Mixins( SpeakerMixin.class )`.

    @Mixins( SpeakerMixin.class )
    public interface Speaker
    {
        String sayHello();
    }

And of course, the simple implementation of the Speaker interface. In this case, return a String with the content "Hello, World!".

    public class SpeakerMixin
        implements Speaker
    {
        @Override
        public String sayHello()
        {
            return "Hello, World!";
        }
    }

So far so good. We now need to make this into something that can run. This can be done like this;

    public class Main
    {
        public static void main( String[] args )
            throws Exception
        {
            SingletonAssembler assembler = new SingletonAssembler() // <1>
            {
                @Override
                public void assemble( ModuleAssembly assembly )
                    throws AssemblyException
                {
                    assembly.transients( Speaker.class );           // <2>
                }
            };
            Speaker speaker = assembler.module().newTransient( Speaker.class ); // <3>
            System.out.println( speaker.sayHello() );
        }
    }

1. The SingletonAssembler is a convenience class that creates a Zest™ Runtime instance and an application with one layer and one module in it.
2. We declare a TransientComposite of type `Speaker`.
3. We create the Composite instance from the Module.

Done!