Flex Defined

来源:互联网 发布:决战武林弩炮进阶数据 编辑:程序博客网 时间:2024/06/10 06:25

Flex Defined

In this post we take a deeper look at what Flex is and what it can do. Our goal is to provide a clear picture of the environment in which you use Flex to create Rich Internet Applications (RIAs). First, let's have a quick discussion about the nature of RIAs so that we can understand why we would want to use Flex in the first place.

As you probably already know, a Rich Internet Application is a web-deployed application that contains much of the functionality of a traditional desktop application. Using the term "application" in the context of the internet implies that something more than a simple "site" is being referred to. Indeed, RIAs typically offer the user much more than a simple display of data; they are, in a word, "richer". A perfect example of this is the application I'm currently using to type this document: Buzzword. Buzzword is a very nice online word-processing application that was, by the way, built with Flex. One benefit of having your word-processing application online is that now more than one person can work on a document at the same time. Because all of my work exists on a server, my co-author, Adam Flater, can log in to this document and make any editorial changes he sees fit. They've taken what traditionally was a process that existed on a single machine, and made it accessible to many.

A key feature of RIAs is the way in which they transfer data from the server to the client. A traditional website is viewed on a page by page basis, with the client sending an HTTP/get request every time the user wants to change the data that is displayed. This is known as a "page-based metaphor". With an RIA, a larger chunk of data is sent right away, allowing for changes in state without the need to interact with the server. For this to happen, RIAs have some unique requirements.ᅠ

Many RIAs rely on a scripting language to execute. A scripting language is simply a programming language that controls an application. The "scripts" are interpreted by the underlying system instead of being natively handled by the operation system. The C/C++ programming languages are examples of compiled languages. In C and C++, source code is compiled into a native executable file that is executed at the operating system level. There are clear pros and cons to using interpreted languages versus using compiled languages. In the case of RIAs, the goal is to present them to several different users. With potentially very different local environments, the issue of cross-platform compatibility arises. This is one of the reasons a scripting language makes sense in an RIA platform.ᅠ

So what interprets the scripted code that we'll be writing in Flex? Enter the Flash Player. In the case of Flex, applications are deployed in the Flash player, providing a user with the same experience regardless of the operating system they are working with. Since the Flash player is available as a free plug-in for all major browsers, and considering also that it is nearly ubiquitous across all users of the internet, leveraging the Flash player to deploy an application makes perfect sense. By the way, the Flash Player is currently the single most installed piece of software in the world.ᅠ

Let's now focus more closely on Flex itself. Flex is a platform for developing Rich Internet Applications that are deployed in the Flash player. There are several pieces in the Flex platform including: the Flex SDK, (Software Development Kit), Flex Builder, the Flash player, and the programming languages of Flex; MXML and Actionscript 3.0.ᅠᅠ

The Flex SDK

The Flex software development kit (SDK), is a collection of all the necessary components to create Flex applications. Included are all of the compilers, the component library, utilities, basically everything you need to create something in Flex. You can build your entire Flex application by using many development environments, including a plain text editor, such as Notepad, combined with the compilers in the Flex SDK. Creating applications with just the Flex SDK lacks a graphical user interface, and everything must be entered on the command line. If typing everything from the command line isn't your thing, and you'd like a little assistance in the development of your application, you'll probably want to use the integrated development environment known as Flex Builder.ᅠ

Flex Builder

Currently in version 3, Flex Builder is a powerful authoring tool that is based on the popular Java development environment known as Eclipse. The Flex SDK is built right into Flex Builder, so everything you need to create applications is right there. The Flex Builder user interface includes two separate work environments known as source mode and design mode. In source mode you manually type in code using both MXML and ActionScript 3.0. One of the most helpful features of Flex Builder is what's known as "code hinting", or "code completion". Flex Builder will offer helpful suggestions as you type in your code For example, when you type "<mx: ", Flex Builder sees that you are entering an MXML tag, then digs through its library of possibilities to offer some choices for what to enter next. This feature drastically speeds up the process of getting your code into the application. In addition to entering code by hand, Flex builder allows you to work in a more visual way by using design mode. In this mode you drag and drop components onto the workspace and the underlying code gets written by Flex builder. This is what's known as a "WYSIWYG", or "what you see is what you get" development environment. In any case, changes made to the application in one mode are reflected in the other mode automatically.

ActionScript 3.0 and MXML

ᅠWhether you work in source mode, or design mode, all of the source code you will create in Flex Builder is either ActionScript 3.0, or MXML. Remember, a scripting language is a programming language that controls an application. ActionScript is the native scripting language in Flash, and therefore essential to Flex, considering that all Flex applications are deployed in the Flash player. MXML is simply a markup language used to organize the ActionScript components within a Flex application. Interestingly, Flex's compiler takes all of the MXML source code in an application and translates it into ActionScript source code before compiling the entire application, this time into a "SWF" file for deployment in the Flash player.ᅠ

Flex Data Services

Although this series is primarily focused on what happens on the client-side of a Flex application, it's worth noting that the Flex platform includes powerful server-side technologies that allow for richer applications in terms of their flow of data from client to server and back. Flex Data Services is an expansion of the client-side Flex framework that provides a developer with the tools to do such things as create messaging services, access large data sets, and share data from one client to another client or server. Adobe has recently released BlazeDS, a free, smaller scale version of Flex Data Services. You can download both of these technologies from the Adobe Labs web site.
ᅠᅠ
As you can see, Flex is a very powerful platform for the development of Rich Internet Applications. It's reliable in the sense that it uses the cross-platform runtime of the Flash player to deploy applications, and it's robust in that its framework includes several valuable tools for the creation of both client-side, and server-side applications. In the next installment, The Languages of Flex, we will start our discussion on object-oriented programming so that we may better understand of the power of using ActionScript 3.0 and MXML.
ᅠᅠᅠ
Flex Glossary

As an added feature to our series, we have started a glossary of terms that are relevant to learning Flex. As we progress through the installments, a new glossary will be created for each post.ᅠ

ActionScript 3.0 A powerful object-oriented programming language. ActionScript 3.0 is native to Flash, and therefore an integral part of Flex applications.

Blaze DS Adobe's free, smaller scale version of Flex Data Services.

Buzzword A very cool online word processing application that is also a great example of a Rich Internet Application that was built in Flex. http://www.buzzword.com

C/C++ Both C, and its successor, C++, are examples of compiled languages.

Client In the context of a client-server discussion, a client represents a user, or a system, that contacts a server over a network.

Compiler Software that translates one computer language into another computer language. Compilers allow different machines to run applications written in same language. The compiler takes the original language and translates it into machine code that the local computer can understand. E.g. Java.

Eclipse An open-source framework for the creation of software for Java developers.

Flash An Adobe application used to create multimedia content using ActionScript 3.0. Flash Player The nearly ubiquitous browser plug in that displays Flash content by reading a "shockwave flash", or swf file.

Flex A powerful platform originally created by Macromedia and now owned by Adobe for the creation of Rich Internet Applications.

Flex SDK The free "software development kit" created by Adobe that contains all of the necessary components for building Flex applications.

Flex Builder The integrated development environment created by Adobe for building Flex applications.

Flex Data Services The extension of the Flex framework that allows for the development of richer server-side applications.

Framework A collection of ideas, standards, or tools that work in concert to do a task.

HTTP/get A request sent from the client to the server when the client wishes to access a web page.

MXML An XML based markup language originally developed by Macromedia, and used for the layout of user interfaces.

Platform A collection of technologies used together to do a task. In the case of Flex, Flex Builder, ActionScript 3.0, and other components work together to create Rich Internet Applications.

Rich Internet Application A web-based application that displays the functionality that you'd expect to find in a desktop application.

Server In the context of a client-server discussion, the server is an application that provides services to the client upon request.

原创粉丝点击