Introducing Tapestry
6
1.2.1 Object-orientation
In object-oriented (OO) programming, objects have two fundamental characteristics: they
are stateful and have behavior. In Java, an object stores its state in fields and exposes
its behavior through methods. Because web-applications are multi-threaded, you have to
unlearn object-oriented programming. An application server could be handling thousands
of requests from individual users, each in their own thread, and each sharing the exact
same objects. You can't store data inside a shared singleton objects, for example a servlet,
because this data is shared between multiple threads. Any value stored in an instance
field for one client will almost immediately be overwritten with a value for another client.
Frequently such errors only appear in production as there's usually only a single client
during development time.
Tapestry shields you from the multi-threaded aspects of web application development.
Tapestry manages the life-cycle of your page and component objects, reserving particular
objects to particular threads so you never have to think twice about threading issues. In
Tapestry you still can program in terms of object-orientation without caring about the
environment your objects are living in.
1.2.2 Developer friendliness
Tapestry is a Java framework, so its ambition is to make life of Java web developers easier.
To get started with Tapestry, you only need a Java IDE for writing Java code and a text
or WYSIWYG editor for templates. The competing frameworks are praising the existing
graphical tools which simplify development and deployment of web applications. These
tools are reputed to enable managers to create web applications without any programming
skills, just by clicking buttons and using drag-and-drop functionality. Tapestry's approach
is different. The framework was designed to make people who possess programming skills
highly effective and efficient. Because of this, there is much less of a need and dependence
on framework specific development tools and graphical editors.
Everybody is speaking about the Separation of Concerns principle, but only few
technologies provide you the capability to enforce it. With Tapestry you can work
on a specific aspect of your application without significantly impacting other parts of
the application. For example, a HTML designer can create templates for pages and
components because they are so close to ordinary HTML, without all the cruft and
confusion seen in JavaServer Pages. Java developers can focus on application logic,
relying on their HTML gurus for the design.
1.2.3 Avoiding XML configuration
Many Java frameworks make extensively use of XML to configure applications. Probably
the most prominent examples are Struts, JavaServer Faces and Spring. The main problem