introduction to rich internet applications

49
INTRODUCTION TO BUILDING RIA WITH ADOBE FLEX AND AIR By Abdelmonaim Remani Silicon Valley Code Camp 08

Upload: abdelmonaim-remani

Post on 14-May-2015

2.025 views

Category:

Documents


1 download

DESCRIPTION

Adobe Flex is the leading techonology for the development and deployment of cross platform Rich Internet applications. This session is an introduction to building RIA with Adobe Flex and AIR.

TRANSCRIPT

Page 1: Introduction To Rich Internet Applications

INTRODUCTION TO BUILDING RIA WITH ADOBE FLEX AND AIRBy Abdelmonaim Remani

Silicon Valley Code Camp 08

Page 2: Introduction To Rich Internet Applications

ONCE UPON A TIME

Page 3: Introduction To Rich Internet Applications

AT FIRST THERE WAS WEB 1.0 Page-Based Architecture: Static or Dynamic Technologies

Client Side (Rendering Presentation) HTML CSS JavaScript DOM DHTML

Server Side (Business Logic and Data) Dynamic Content

CGI Java Servlets and JSP .NET and ASP PHP Ruby on Rails Etc…

Data Databases XML JSON

Page 4: Introduction To Rich Internet Applications

THE WEB IS IN COMA

Web 1.0 was loosing to Desktop Applications Performance and Speed Responsiveness Visual Richness / Media Data-Driven vs. Event-Driven Availability (Online vs. Offline)

.COM bubble broke The Browser War

Page 5: Introduction To Rich Internet Applications

LA RENAISSANCE

– The community focused on developing standards– A second look at Web Application

• They have what Web applications have two very important characteristics that Desktop Applications don’t have– They are Centralized– The are Inherently safe

» Run in context the browser» Require no installation

– More powerful desktop machines are being made available (Moore’s Law)

Page 6: Introduction To Rich Internet Applications

THE RAISE OF WEB 2.0

New Technologies ???

The use features and technologies that we already have in a different way

The use of these features for something more powerful than what they were intended for

Page 7: Introduction To Rich Internet Applications

THE BLOODLESS REVOLUTION OFAJAX

• AJAX (Asynchronous JavaScript And XML)• As the acronym implies, AJAX is simply

JavaScript, and XML or any other data interchange format

• It is about exploiting the communication feature of the browser in a new different way

• The goal is to get data from the server without a invoking full-page refresh for a better user experience

• How?• AJAX is a Hack

Page 8: Introduction To Rich Internet Applications

THE GOLD RUSH• AJAX brought a better user experience to the

browser• AJAX adoption increased quickly• Web Applications’ complexity increased• Drastic Change of the architecture of Web

Applications is represented by– No page-based– A shift of programmatic logic from the server-side to

the client-side• Reduced the load on the server

– The sate is handled by the client instead of the server– Data is loaded only when necessary

• Took advantage of the local machine power– The Vision: One day the server is only going to used to

distribute the application

Page 9: Introduction To Rich Internet Applications

WAIT A MINUTE…

• It happened so fast– No developer tools– No libraries– No application or testing frameworks

• AJAX evolved from technologies that were never meat or designed to build applications– JavaScript

• is not OOP• No runtime-error handling• Cross-browser coding

• Scalability problems– Twitter please don’t die on me!!!

Page 10: Introduction To Rich Internet Applications

HOLD YOUR HORSES Three Camps

The Optimistics Let’s make it work Bullet-proof libraries and toolkits: DOJO, JQuery,

etc… http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks

The Pessimistics JavaScript development sucks… Forget AJAX! Focus on new tech

Rich Internet Applications: Adobe Flex, JavaFX, and Microsoft Silverlight

The Google Way GWT Shifts some of the focus from feature

richness to development and software engineering tools

We could allow developers to program in any programming language, and just translate or compile it into JavaScript

Page 11: Introduction To Rich Internet Applications

ANTHROPOLOGIA

Developers: Coders Build Applications

Functional Data Driven UGLY

Designers: Artists Build Applications

Event-Driven Beautiful

Devigners?

Page 12: Introduction To Rich Internet Applications

RICH INTERNET APPLICATIONS (RIA)

Page 13: Introduction To Rich Internet Applications

WHAT ARE RIAS

Application that combine the benefits of Web and Desktop applications User experience of the Desktop Applications

Responsive Data Driven Rich Media Online and Offline

Low cost of Deployment and reach of Web Applications

Page 14: Introduction To Rich Internet Applications

TECHNOLOGIES

RIA Technologies Adobe Flex JavaFX Microsoft SilverLight OpenLaszlo Etc…

Page 15: Introduction To Rich Internet Applications

ADOBE FLEX

Page 16: Introduction To Rich Internet Applications

WHAT IS FLEX

Adobe Flex is a platform for building Rich Internet Application and Desktop Applications SDK (Open Source)

Compiler, debugger, and other tools Libraries Provides a skeleton of Flex Application by extending

the Flex Framework Prebuilt Components Programming Languages (MXML and ActionScript 3.0)

Page 17: Introduction To Rich Internet Applications

WHAT IS FLEX

Flex Builder 3 IDE based on Eclipse Design tools

Server-Side Enterprise Messaging Support Data Services

Data sharing and communiction among clients Data push from server to clients Etc…

Options: Live Cycle Data Services, BlazeDS, etc… Adobe Flex Charting

Page 18: Introduction To Rich Internet Applications

FLEX APPLICATIONS

Delivered as SWF (Shockwave Flash) files in HTML Runs on Flash Player 9 or later On 99.3% of the browsers

Delivered as a Desktop application Runs on AIR (Adobe Integrated Environment)

Page 19: Introduction To Rich Internet Applications

RUN TIME

Flash Player 9 In the browser Tow virtual machines for backward Compatibility

New Virtual Machine: AVM2 Run time error reporting Compile time type checking

AIR On the desktop Application built in Flex, Flash, and HTML Seamless Install

Page 20: Introduction To Rich Internet Applications

PROGRAMMING LANGUAGESMXML

Page 21: Introduction To Rich Internet Applications

WHAT IS MXML

Adobe Flex’s Markup (Declarative) XML Based Used to Create visual and non-visual

component Compiles into ActionScript 3.0

Page 22: Introduction To Rich Internet Applications

THE ANATOMY OF MXML

XML Declaration <mx:Application> Tag

“mx” Namespace “Layout” Attribute

Page 23: Introduction To Rich Internet Applications

MXML CONTROLS Controls (Id, properties, and events) In absolute Layout

<mx:Label> <mx:TextInput> <mx:Button> <mx:Image>

Using Layout Controls <mx:VBox> <mxHBox>

Other

Page 24: Introduction To Rich Internet Applications

PROGRAMMING LANGUAGESACTIONSCRIPT 3.0

Page 25: Introduction To Rich Internet Applications

THE LANGUAGE FEATURES

Based on the ECMAScript Specification Object-Oriented

Runs on a new VM: AVM2 (ActionScript Virtual Machine 2)

Complete Access to Flash API and libraries

Page 26: Introduction To Rich Internet Applications

THE LANGUAGE FEATURES

ActionScript 3.0 vs. ActionScript 2.0 New Features

Packages Primitive Data Types (int and uint) Native XML types and E4X (ECMAscript for XML) Native Regular Expression support New event model 10 times faster

Strongly typed Sealed Classes: Dynamically adding methods is not

allowed Etc…

Page 27: Introduction To Rich Internet Applications

VARIABLES

Variable Declaration var <Variable Name> : <VariableType>;

Variable Assignment <Variable Name> = <Value>;

Page 28: Introduction To Rich Internet Applications

OPERATORS Arithmetic

+ Addition- Subtraction* Multiplication/ Division% Modulo++ Increment-- Decrement

Arithmetic Compound Assignment+= -= *= /=

Page 29: Introduction To Rich Internet Applications

OPERATORS

Bitwise& AND<< Left Shift~ NOT| OR>> Right Shift>>> Unsigned Right Shift^ XOR

Page 30: Introduction To Rich Internet Applications

OPERATORS Comparison

== Equality> Greater Than>= Greater Than or Equals != Inequality< Less Than<= Less Than or Equals=== Strict Equality!== Strict Inequality

Page 31: Introduction To Rich Internet Applications

OPERATORS

Logical&& AND! NOT|| OR

Other?: Conditional+ Concatenation+= Concatenation Assignment

Page 32: Introduction To Rich Internet Applications

CONTROL STRUCTURES

Conditional Statements If Statement

Page 33: Introduction To Rich Internet Applications

CONTROL STRUCTURES

Switch Statement

Page 34: Introduction To Rich Internet Applications

CONTROL STRUCTURES

Looping Statements While Loop

Page 35: Introduction To Rich Internet Applications

CONTROL STRUCTURES

Do-While Loop

Page 36: Introduction To Rich Internet Applications

CONTROL STRUCTURES

For-Each and For-In Loops

Page 37: Introduction To Rich Internet Applications

ARRAYS

Page 38: Introduction To Rich Internet Applications

METHODS

Page 39: Introduction To Rich Internet Applications

METHODS

Page 40: Introduction To Rich Internet Applications

CLASSES & INTERFACES

Page 41: Introduction To Rich Internet Applications

CLASSES & INTERFACES

Page 42: Introduction To Rich Internet Applications

CLASSES & INTERFACES

Page 43: Introduction To Rich Internet Applications

BUILDING FLEX APPS

Page 44: Introduction To Rich Internet Applications

THE PROCESS

Layout Visual component and style them Add event-handling Use data or communication services Build and run

Page 45: Introduction To Rich Internet Applications

FLEX & XML

Page 46: Introduction To Rich Internet Applications

E4X

Parse XML (Similar to XPath) Manipulate XML Data XML Classes in ActionScript 3.0

XML XMLList

Page 47: Introduction To Rich Internet Applications

PARSING XML USING E4X

xmlData.employee[2] xmlData..employee All nodes called node xmlData..employee.(firstName==‘Joe’) xmlData..employee.(@id > 1)

Page 48: Introduction To Rich Internet Applications

Q&A

Page 49: Introduction To Rich Internet Applications

THANK YOU