590 likes | 724 Views
OO Web Development. 2. Outline. IntroductionAranea Hello World!" and beyondApplying OO to webWith real-life examples taken from Aranea-based projectsBehind the scenesWhere's the catch?Uniting Web Frameworks. OO Web Development. 3. Motivation. At the moment web applications are barely reusable
E N D
1. Object-Oriented Web Development with Aranea Jevgeni Kabanov
R&D lead, Webmedia, Ltd.
JavaZone, Oslo, 13th September, 2006
Throughout this presentation I want to talk about Object-Oriented programming, with Aranea being just one of the possible web frameworks allowing it. So Aranea in this context is just An Object-Oriented web framework, with e.g. Wicket being another.Throughout this presentation I want to talk about Object-Oriented programming, with Aranea being just one of the possible web frameworks allowing it. So Aranea in this context is just An Object-Oriented web framework, with e.g. Wicket being another.
2. OO Web Development 2 Outline Introduction
Aranea Hello World! and beyond
Applying OO to web
With real-life examples taken from Aranea-based projects
Behind the scenes
Wheres the catch?
Uniting Web Frameworks We will start with a very simple example and use it to explain the OO concepts, and then we will show how the same concepts apply to real-life cases.We will start with a very simple example and use it to explain the OO concepts, and then we will show how the same concepts apply to real-life cases.
3. OO Web Development 3 Motivation At the moment web applications are barely reusable!
Existing code cannot be reused for similar requirements without inserting if-then-else-s everywhere
Legacy migration is very hard!
Integrating applications built on different platforms is hard and often visible to user
Object-Oriented Design to the rescue! OOD is all about structuring your application to make it more manageable and encapsulated.OOD is all about structuring your application to make it more manageable and encapsulated.
4. OO Web Development 4 Web is Procedural (Client calls server)
Synchronized (One window one request)
Decomposable into pages
Client is mostly stateless (Current state with result, cookies)
In general web is based around a concept of a page, which is combining data, behavior and presentation GUIs have been already for decades built using OO concepts. It is well understood how to GUIs have been already for decades built using OO concepts. It is well understood how to
5. OO Web Development 5 GUI applications are Mostly stateful
Mostly synchronized (one window one thread)
Decomposable into components
Comfortable to represent using OO concepts
Model-View-Controller pattern suggest to keep data, presentation and behavior separately
6. OO Web Development 6 Enter MVC Web Frameworks Request-based: Struts, Spring MVC
Page-based: JSF, Wicket, Tapestry
Continuation/flow-based: RIFE, Spring WebFlow
AJAX-based: Echo2, GWT
OO-based: Wicket, Aranea There are also other frameworks that support OO-style programming, but I know only of these two that actually enforce it and are built to use it.There are also other frameworks that support OO-style programming, but I know only of these two that actually enforce it and are built to use it.
7. OO Web Development 7 Problems with OO in Web Encapsulation & Abstraction (broken)
External state management (session)
Poor contracts among components
Polymorphism (broken)
XML mappings
Implicit component creation
Components, pages & flows are typically not first class objects! Most frameworks dont allow callbacks between components, which makes it hard to make components that need to notify the host about some user event, a typical example being user selecting or adding something.
Polymorphism is useful when we need to parametrize one component with an abstract other e.g. client selection might be realized as a full-blown search or just a dropdown list depending whether allowed clients are restricted by the context, so our general use case should be parametrized with an abstracted client selection component.
Controller and components are often represented separately in many web frameworks, and just because you have a controller, doesnt yet mean you can reuse it as a component. Most frameworks dont allow callbacks between components, which makes it hard to make components that need to notify the host about some user event, a typical example being user selecting or adding something.
Polymorphism is useful when we need to parametrize one component with an abstract other e.g. client selection might be realized as a full-blown search or just a dropdown list depending whether allowed clients are restricted by the context, so our general use case should be parametrized with an abstracted client selection component.
Controller and components are often represented separately in many web frameworks, and just because you have a controller, doesnt yet mean you can reuse it as a component.
8. OO Web Development 8 Enter Aranea An Object-Oriented Web Framework
Everything is an object (component)
Objects are created by the programmer
No (XML) mappings
State is in the object (no session)
Supports
Stateless request-based services
Stateful session-based widgets
Components, pages and flows are represented by widgets
9. OO Web Development 9 Hello World!