"Computer, draw a robot!" said my young cousin to the first computer he had ever seen. (Since I
had instructed it not to listen to strangers, the computer wasn't receptive to this command.) If
you're like me, your first thought would be "how silly" or "how funny"—but this is a mistake. Our
educated and modeled brains have learned how to work with computers to a certain degree. People
are being educated to accommodate computers, to compensate for the lack of ability of computers
to understand humans. (On the other hand, humans can't accommodate very well themselves, but
that's another story.)
This little story is relevant to the way people instinctively work with computers. In an ideal world,
that spoken command should have been enough to have the computer please my cousin. The
ability of technology to be user-friendly has evolved very much in the past years, but there's still a
long way till we have real intelligent computers. Until then, people need to learn how to work with
computers—some to the extent that they end up loving a black screen with a tiny command
prompt on it.
Not incidentally, the computer-working habits of many are driven by software with user interfaces
that allow for intuitive (and enjoyable) human interaction. This probably explains the popularity of
the right mouse button, the wonder of fancy features such as drag and drop, or that simple text box
that searches content all over the Internet for you in just 0.1 seconds (or so it says). The software
industry (or the profitable part of it, anyway) has seen, analyzed, and learned. Now the market is
full of programs with shiny buttons, icons, windows, and wizards, and people are paying a lot of
money for them.
What the software industry has learned is that the equivalent of a powerful engine in a red sports
car is usability and accessibility for software. And it's wonderful when what is good from the
business point of view is also good from a human point of view, because the business profits are
more or less proportional to customers' satisfaction.
We plan to be very practical and concise in this book, but before getting back to your favorite
mission (writing code) it's worth taking a little step back, just to remember what we are doing and
why we are doing it. We love technology to the sound made by each key stroke, so it's very easy
to forget that the very reason technology exists is to serve people and make their lives at home
more entertaining, and at work more efficient.
Understanding the way people's brains work would be the key to building the ultimate software
applications. While we're far from that point, what we do understand is that end users need
intuitive user interfaces; they don't really care what operating system they're running as long as the
functionality they get is what they expect. This is a very important detail to keep in mind, as many
programmers tend to think and speak in technical terms even when working with end users
(although in a typical development team the programmer doesn't interact directly with the end
user). If you disagree, try to remember how many times you've said the word database when
talking to a non-technical person.
By observing people's needs and habits while working with computer systems, the term software
usability was born—referring to the art of meeting users' interface expectations, understanding
the nature of their work, and building software applications accordingly.
Historically, usability techniques were applied mainly to desktop applications, simply because
the required tools weren't available for web applications. However, as the Internet gets more
mature, the technologies it enables are increasingly potent.
Modern Internet technologies not only enable you to build a better online presence, but also allow
building better intranet/dedicated applications. Having friendly websites is crucial for online
business, because the Internet never sleeps, and customers frequently migrate to the next "big
thing" that looks better or feels to move faster. At the same time, being able to build friendly web
interfaces gives alternative options for intranet software solutions, which were previously built
mainly as desktop applications.
Building user-friendly software has always been easier with desktop applications than with web
applications, simply because the Web was designed as a means for delivering text and images, and
not complex functionality. This problem has gotten significantly more painful in the last few
years, when more and more software services and functionality are delivered via the Web.
Consequently, many technologies have been developed (and are still being developed) to add flashy
lights, accessibility, and power to web applications. Notable examples include Java applets and
Macromedia Flash, which require the users to install separate libraries into their web browsers.
Delivering Functionality via the Web
Web applications are applications whose functionality is processed on a web server, and is
delivered to the end users over a network such as the Internet or an intranet. The end users use a
thin client (web browser) to run web applications, which knows how to display and execute the
data received from the server. In contrast, desktop applications are based on a thick client (also
called a rich client or a fat client), which does most of the processing.
Web applications evolve dreaming that one day they'll look and behave like their mature (and
powerful) relatives, the desktop applications. The behavior of any computer software that interacts
with humans is now even more important than it used to be, because nowadays the computer user
base varies much more than in the past, when the users were technically sound as well. Now you
need to display good looking reports to Cindy, the sales department manager, and you need to
provide easy-to-use data entry forms to Dave, the sales person.
Because end-user satisfaction is all that matters, the software application you build must be
satisfactory to all the users that interact with it. As far as web applications are concerned, their
evolution-to-maturity process will be complete when the application's interface and behavior will
not reveal whether the functionality is delivered by the local desktop or comes through fiber or air.
Delivering usable interfaces via the Web used to be problematic simply because features that
people use with their desktop application, such as drag and drop, and performing multiple tasks on
the same window at the same time, were not possible.
Another problem with building web applications is standardization. Today, everything
web-accessible must be verified with at least two or three browsers to ensure that all your visitors
will get the full benefit of your site.
Advantages of Web Applications
Yes, there are lots of headaches when trying to deliver functionality via the Web. But why bother
trying to do that in the first place, instead of building plain desktop applications? Well, even with
the current problems that web applications have with being user-friendly, they have acquired
extraordinary popularity because they offer a number of major technological advantages over
desktop applications.
• Web applications are easy and inexpensive to deliver. With web applications, a
company can reduce the costs of the IT department that is in charge of installing the
software on the users' machines. With web applications, all that users need is a
computer with a working web browser and an Internet or intranet connection.
• Web applications are easy and inexpensive to upgrade. Maintenance costs for
software have always been significant. Because upgrading an existing piece of
software is similar to installing a new one, the web applications' advantages
mentioned above apply here as well. As soon as the application on the server
machine is upgraded, everyone gets the new version.
• Web applications have flexible requirements for the end users. Just have your
web application installed on a server—any modern operating system will do—and
you'll be able to use it over the Internet/Intranet on any Mac, Windows, or Linux
machine and so on. If the application is properly built, it will run equally well on any
modern web browser, such as Internet Explorer, Mozilla Firefox, Opera, or Safari.
• Web applications make it easier to have a central data store. When you have
several locations that need access to the same data, having all that data stored in one
place is much easier than having separate databases in each location. This way you
avoid potential data synchronization operations and lower security risks.
In this book we'll further investigate how to use modern web technologies to build better web
applications, to make the most out of the possibilities offered by the Web. But before getting into
the details, let's take a short history lesson.
HTTP and HTML
HTTP is supported by all web browsers, and it does very well the job it was conceived for—
retrieving simple web content. Whenever you request a web page using your favorite web
browser, the HTTP protocol is assumed. So, for example, when you type www.mozilla.org in the
location bar of Firefox, it will assume by default that you meant http://www.mozilla.org.
The standard document type of the Internet is HyperText Markup Language (HTML), and it is
built of markup that web browsers understand, parse, and display. HTML is a language that
describes documents' formatting and content, which is basically composed of static text and
images. HTML wasn't designed for building complex web applications with interactive content or
user-friendly interfaces. When you need to get to another HTML page via HTTP, you need to
initiate a full page reload, and the HTML page you requested must exist at the mentioned location,
as a static document, prior to the request. It's obvious that these restrictions don't really encourage
building anything interesting.
Sure thing, the HTTP-HTML combination is very limited in what it can do—it only enables users
to retrieve static content (HTML pages) from the Internet. To complement the lack of features,
several technologies have been developed.
While all web requests we'll talk about from now on still use the HTTP protocol for transferring
the data, the data itself can be built dynamically on the web server (say, using information from a
database), and this data can contain more than plain HTML allowing the client to perform some
functionality rather than simply display static pages.
The technologies that enable the Web to act smarter are grouped in the following two main categories:
• Client-side technologies enable the web client to do more interesting things than
displaying static documents. Usually these technologies are extensions of HTML,
and don't replace it entirely.
• Server-side technologies are those that enable the server to store logic to build web
pages on the fly.
PHP and Other Server-Side Technologies
Server-side web technologies enable the web server to do much more than simply returning the
requested HTML files, such as performing complex calculations, doing object-oriented
programming, working with databases, and much more.
Just imagine how much data processing Amazon must do to calculate personalized product
recommendations for each visitor, or Google when it searches its enormous database to serve your
request. Yes, server-side processing is the engine that caused the web revolution, and the reason
for which Internet is so useful nowadays.
The important thing to remember is that no matter what happens on the server side, the response
received by the client must be a language that the client understands (obviously)—such as HTML,
which has many limits, as mentioned earlier.
PHP is one of the technologies used to implement server-side logic. Chapter 3 will serve an
introduction to PHP, and we'll use PHP in this book when building the AJAX case studies. It's
good to know, though, that PHP has many competitors, such as ASP.NET (Active Server Pages,
the web development technology from Microsoft), Java Server Pages (JSP), Perl, ColdFusion,
Ruby on Rails, and others. Each of these has its own way of allowing programmers to build
server-side functionality.
JavaScript and Other Client-Side Technologies
The various client-side technologies differ in many ways, starting with the way they get loaded
and executed by the web client. JavaScript is a scripting language, whose code is written in plain
text and can be embedded into HTML pages to empower them. When a client requests an HTML
page, that HTML page can contain JavaScript. JavaScript is supported by all modern web
browsers without requiring users to install new components on the system.
JavaScript is a language in its own right (theoretically it isn't tied to web development), it's
supported by most web clients under any platform, and it has some object-oriented capabilities.
JavaScript is not a compiled language so it's not suited for intensive calculations or writing device
drivers and it must arrive in one piece at the client browser to be interpreted so it is not secure
either, but it does a good job when used in web pages
With JavaScript, developers could finally build web pages with snow falling over them, with
client-side form validation so that the user won't cause a whole page reload (incidentally losing all
typed data) if he or she forgot to supply all the details (such as password, or credit card number),
or if the email address had an incorrect format. However, despite its potential, JavaScript was
never used consistently to make the web experience truly user friendly, similar to that of users of
desktop applications.
Other popular technologies to perform functionality at the client side are Java applets and
Macromedia Flash. Java applets are written in the popular and powerful Java language, and are
executed through a Java Virtual Machine that needs to be installed separately on the system.
Java applets are certainly the way to go for more complex projects, but they have lost the
popularity they once had over web applications because they consume many system resources.
Sometimes they even need long startup times, and are generally too heavy and powerful for the
small requirements of simple web applications.
Macromedia Flash has very powerful tools for creating animations and graphical effects, and it's
the de-facto standard for delivering such kind of programs via the Web. Flash also requires the
client to install a browser plug-in. Flash-based technologies become increasingly powerful, and
new ones keep appearing.
Combining HTML with a server-side technology and a client-side technology, one can end up
building very powerful web solutions.
Tidak ada komentar:
Posting Komentar