blob: f3465b8ecfc87e909d209781bd95bb37a1cbeda4 [file] [log] [blame]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<body>
<h1>Tutorial 1 - Interface refactoring</h1>
<p>
In this tutorial we start with a basic Java class, which when invoked will concatenate
the two properties "phrase" and "name". If invoked with the properties set to "Hello"
and "World" respectively it will hence return "Hello World".
</p>
<p>
Zestâ„¢ relies heavily on the use of interfaces. This makes it possible for an object
to externally implement a number of interfaces which internally is backed by a number
of Mixins, some of which you may have written yourself, and some of which may have been
reused. This also makes it easy to introduce Modifiers (aka "interceptors", aka "advice"),
which are Fragments which execute before and/or after the method on the Mixin is invoked.
</p>
<p>
The first task is therefore to refactor the code so that the method is implemented from an
interface instead. We should then also separate the state into one interface and the behaviour
into another. This will make things easier for us later when state and behaviour becomes
implemented by separate Mixins.
</p>
<p>
Steps for this tutorial:
</p>
<ol>
<li>Refactor the class into interface and implementation.</li>
<li>Refactor the interface so that it extends one interface called HelloWorldBehaviour with behaviour and one called
HelloWorldState with state (get/set methods).
</li>
</ol>
</body>