2637c08_6677

 

pdf53 trang | Chia sẻ: oanh_nt | Lượt xem: 3013 | Lượt tải: 0download
Bạn đang xem trước 20 trang nội dung tài liệu 2637c08_6677, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
C hapter 8 Int i-NE CHA  Def app        Des ser the             Con    Des nonernet Development T+ EXAM OBJECTIVES COVERED IN THIS PTER: ine programming-related terms as they relate to Internet lications development. Content could include the following: API CGI SQL SAPI DLL—dynamic linking and static linking Client- and server-side scripting cribe the differences between popular client-side and ver-side programming languages. Examples could include following: Java JavaScript Perl C C++ Visual Basic VBScript JScript XML VRML ASP tent could include the following: When to use the languages When they are executed cribe the differences between a relational database and a -relational database.  Ide con  Dem       Ide foll       Des the                 ntify when to integrate a database with a Web site and the technologies used to nect the two. onstrate the ability to create HTML pages. Content could include the following: HTML document structure Coding simple tables, headings, forms Compatibility between different browsers Difference between text editors and GUI editors Importance of creating cross-browser coding in your HTML ntify popular multimedia extensions or plug-ins. Examples could include the owing: QTVR (QuickTime VR) Flash Shockwave RealPlayer Windows Media Player cribe the uses and benefits of various multimedia file formats. Examples could include following: GIF GIF89a JPEG PNG PDF RTF TIFF PostScript EPS BMP MOV MPEG AVI BinHex Streaming media Non-streaming media N The state of the art in Internet software development is a slip- pery thing. New technologies are always emerging; others fade away as they’re recognized as too weak, too complicated, or too expensive. Your job as an Internet professional is to stay familiar, in a broad way, with what’s new in software development. Then, when you’re called upon to solve a par- ticular problem, you should be able to consult books and Internet resources to figure out which technologies apply and how to use them. There are no authorities, only people willing to teach themselves quickly. This chapter endeavors to introduce you to some Internet software and media development concepts that seem built to last, at least for a while. Understanding these will help you grasp the new developments as they appear. etwork Software Concepts Sun Microsystems notes in its advertisements that “the network is the computer.” Increasingly, computation has more to do with sharing informa- tion among machines than with processing it on any given machine. Clients request data from servers; servers make requests of other servers; processing jobs are shared among many machines and therefore accomplished faster. This section has to do with the design of software systems that are meant to operate in networked environments. 340 Chapter 8  Internet Development Client-Server Architecture Client-server architecture describes a particular kind of relationship between two computers. It’s easy to assume that a server is a big, powerful computer and that a client is an everyday personal computer, but that’s not necessarily true. The server in a client-server relationship is simply a computer on which a particular resource—particular data—resides. The client is a computer that requests a copy of that information for its own use. Clients and servers don’t have to be thought of as items of hardware. They can be separate pieces of software, and indeed the two pieces of software in the equation can be running under the same processor. You can install a Web server—Apache, Personal Web Server, whatever—on your machine and request Web pages from it, using a Web browser that’s running as a separate process. For this reason, you’ll hear Web browsers referred to as “Web cli- ents,” just as programs like Apache are called “Web servers,” independent of the hardware they run on. When you surf the Web, you’re acting as the client in a series of client- server relationships. The computers that are identified by domain names— yahoo.com, amazon.com, and so on—contain collections of data. When you request a document that’s identified by a particular URL, a copy of that doc- ument is sent from the computer on which it resides (the server) to your com- puter (the client). Similarly, when you use your computer to send a query to a database server and receive a particular set of data in response, your machine is the client in a client-server relationship. Client-server transactions need not involve Web pages by any means. However, Web servers and Web clients illustrate many client-server concepts clearly, so we’ll focus on them for the present. Client Software In the case of Web surfing, a Web browser is the client software in a client- server relationship. People use their Web browsers to request information from other computers. The browsers then receive the requested information and are responsible for presenting it to their users properly. The process of interpreting and presenting information is not trivial because Web pages can consist of several different kinds of data:  Text with embedded markup information  Special, embedded content that browsers can interpret without out- side help Network Software Concepts 341  Code written in a scripting language, which must be interpreted and executed  Code written in Java or an ActiveX language  Content that must be interpreted by a plug-in Let’s explore these different kinds of content in greater detail. Text and Markup Languages The simplest Web pages are just text documents—sequences of characters, formatted as American Standard Code for Information Interchange (ASCII)—with special sequences of characters inserted here and there to indi- cate what the text means and how it should be displayed. You’re probably somewhat familiar with the most popular Web markup language—it’s called Hypertext Markup Language (HTML)—and we’ll cover some of its details later in this chapter. For now, just know that every Web browser incorporates an HTML interpreter that interprets the HTML tags in documents. There are other markup languages; eXtensible Markup Language (XML) isn’t as concerned with how text is displayed as with the meaning of individ- ual passages of text. XML is one way to share database information among machines. Native Embedded Content In addition to their ability to interpret and display HTML-formatted text, Web browsers can display certain other kinds of data that is referred to in HTML documents. Graphics fall into this category. All Web browsers can interpret JPEG and GIF graphics; various browsers can interpret other image formats as well (Microsoft Internet Explorer, for example, can display BMP images). The pieces of software that interpret these embedded files—the interpreters—are inseparable parts of the Web browsers. Scripting Languages Sometimes, the markup tags that define Web documents include passages of code in scripting languages like JavaScript or VBScript. You can use scripting languages to provide your Web pages with a certain level of interactivity and animation. The code that makes up programs—you’ll learn more about it later in this chapter—is never compiled. It always remains readable to human beings. Web browsers that are capable of running scripting-language programs interpret the code directly, without it first being compiled. 342 Chapter 8  Internet Development Java and ActiveX ContentThough they’re kind of like graphics in the sense that they’re assigned a rect- angular region and interpreted separately from the HTML document in which they’re embedded, Java applets and ActiveX controls deserve special mention. Java applets and ActiveX Controls are little pieces of software that occupy portions of the browser windows in which they run. Plug-In Content Although browsers can make sense of and display certain kinds of content natively, other kinds of files—such as those containing certain kinds of sounds, three-dimensional graphics, and other special media—fall outside the browser’s built-in capabilities. The most popular browsers, however, can take plug-ins, which are software modules that users add to their browsers to expand their capabilities. When a browser encounters a piece of embed- ded media that it can’t interpret natively, it checks its roster of plug-ins to see if one of them can handle the content. If so, the handling is seamless—it looks to the user as if the browser can handle the content by itself. The problem with plug-ins is that no one has all of them, and you’re asking a lot of a user if you ask her to download and install a particular plug-in just to view your content. The basic rule is to stick to media that browsers can inter- pret natively. If you need to use plug-in content to get an effect you need— chemists, for example, use special file formats to display images of complex molecules in three dimensions—make sure the benefits to users are great enough to warrant the trouble of downloading and installing the plug-in. Server Software In the client-server equation as it applies to Web publishing, the Web server is both a piece of software (the program that doles out pages in response to client requests) and a unit of hardware (the physical machine on which the server software runs). Popular Web server software includes:  Apache  Microsoft Internet Information Server (IIS)  Netscape Enterprise Server Network Software Concepts 343 Each handles requests for Web pages. They may also have capacities to work with server-side scripting languages, extensions, Java servlets, and inde- pendent server-side programs that provide some sort of processing service. Server Extensions A server extension is sort of like a plug-in for Web server software. A soft- ware module that expands the capabilities of the server software itself, server extension may be published by the same company that put out the server software or by another publisher. The Microsoft FrontPage Extensions are perhaps the most popular server extensions around. They allow servers to support some of the interactive features Microsoft FrontPage lets developers embed in their pages. Java Servlets Java servlets are special Java programs that expand the capabilities of Web server software. Similar to server extensions, the advantage of a Java servlet is that a single, properly designed servlet will run under any operating sys- tem for which there is a Java Virtual Machine (JVM)—the same as any Java program. Server-Side Scripting Languages Server-side scripting languages are programming languages designed for writing code that’s embedded in Web pages and interpreted before those pages are sent out to the client. Active Server Pages (ASP) and Hypertext Pre- processor (PHP), both covered later in this chapter, are two of the most pop- ular server-side scripting languages. Compiled Server-Side Programs and Other Servers In addition to exercising their native capabilities and those provided by add- in servlets and extensions, Web servers may also cooperate with other kinds of server software, such as a database server. When a program written in a server-side scripting language requests data from a database server, the Web server is capable of allowing the script to access the database server and retrieve the information it needs. 344 Chapter 8  Internet Development Communication between Client and Server If you’re going to have software that takes advantage of client-server archi- tecture, you must have mechanisms in place for transmitting information back and forth between the two elements in the equation. Forms As far as the Web is concerned, client-server communications rely upon forms in Web pages that collect information from the user. The data the user puts into those forms is then submitted (or posted) to the program on the server side. The form data is packaged and sent to the server in a format defined by the Common Gateway Interface (CGI) specification. Common Gateway Interface (CGI) The Common Gateway Interface (CGI) specification defines a way of pack- aging text data (such as the contents of a form) for transmission over a net- work. The CGI specification takes the contents of a form and the names of the form elements (as specified in HTML) and assembles them all into a long string of characters. That string can then be passed to a program on the server side for processing and a response. A CGI submission might tell a server-side database interface to search for something and return a results page, for example. Computers running Microsoft’s Internet Information Server (IIS) support the Internet Services Application Programming Inter- face (ISAPI), which can be used to carry out CGI-like tasks on IIS-equipped servers. Do not make the mistake of thinking CGI is a programming language. It is not. Although it is correct to speak of a “CGI program,” such programs are referred to that way because they accept CGI data as input (as from a Web form), not because they are written in a language called CGI. There is no such language (at least, there is none of any significance). Security The problem with CGI is that it involves the transmission of a text string— that is by default readable to anybody who cares to intercept it—across a network. If you’re using CGI to move data over the Internet, you’re exposing yourself and your client-side users to security risks. You shouldn’t ever enter Network Software Concepts 345 sensitive information such as credit card data into a form for CGI transmis- sion unless you’re sure the transmission will be protected. How are CGI submissions protected? Typically, Secure Sockets Layer (SSL) encrypts data transmitted between a client and a server. Read all about SSL and other encryption technologies in Chapter 7. Trends in Network Computing For many years, the trend in computing technology was toward more stor- age space, faster processors, more capable software, and lower prices on everything. Now it seems that, although “more, faster, and cheaper” will always be appealing, computer technology is getting to be “good enough” for many everyday applications. Personal computers spend most of their processor cycles idling, waiting for their human users to do something. The trends in computer technology have mainly to do with network computing, which is computing performed by multiple computers linked together on some kind of network. Whether the collaborative computing has to do with sharing information or sharing processor power, it seems that a network often provides more computing power than its component machines could if they were acting alone. You can distinguish the two main trends in networking by determining what is shared:  In enterprise computing, it’s typically the data that’s shared. One machine can access and operate upon information from another or from a central repository.  In distributed computing, the processing work is spread over several machines. Of course, there’s some overlap, and it’s not always easy to tell where pro- cessing begins and data-sharing ends. Let’s explore these trends further. Enterprise Computing Enterprise computing has to do with sharing information among the appli- cations with which an organization, such as a company or a unit of gov- ernment, does its business. This kind of sharing can help the company realize efficiencies in its overall process of buying, making, processing, and selling goods and services and in the accounting, finance, human resources, and management infrastructures it maintains to facilitate those processes. An Enterprise Resource Planning (ERP) system, because of its purchasing 346 Chapter 8  Internet Development features, might note that two different plants were buying the same part from different suppliers. Because of its integration with the manufacturing process, it might note that one supplier’s products had far fewer defects than the other’s did. The two purchasing agents at the plants might have had spotty communication without the ERP system, but the ERP system is much better able to spot situations like this and advise the buyer of the faulty parts to try the other plant’s supplier. SAP (pronounced as three distinct letters), a German company, is gener- ally recognized as the world leader in enterprise computing. Its flagship ERP product, SAP R/3, is standard equipment among very large organizations all over the world, and SAP consultants make very good coin planning, imple- menting, and expanding SAP R/3 installations. The trend is beginning to trickle down to smaller companies, as well, and some pundits expect that technologies like XML will make it easier to share information among small- business software products from many publishers. SAP has several Web sites, each of which highlights some aspect of its busi- ness. The main one, www.sap.com, will direct you to the information you need. Another site, www.mysap.com, focuses on SAP’s products and services for companies somewhat smaller than enormous. Distributed Computing Distributed computing has to do with spreading portions of a computing job over several machines. This is not parallel processing, in which an operating system divides the running of some program over several CPUs, but rather a system of sharing discrete business tasks over several machines. The dis- crete tasks might include the following:  Collecting data  Managing a database that stores the data  Analyzing the data  Performing financial operations (such as billing) based on the data Any given task might require work from several machines, each of which is responsible for one of the above. The load is spread, and therefore the job is completed more quickly. UUnderstanding Programming Languages 347 JavaBeansJavaBeans are the epitome of componentization in the Java language. It’s possible to build a Bean with an elaborate feature set and considerable power, then use it as a sort of “black box” that carries out some particular duty in various software systems of which it is a part. You can distribute your Beans to others as well, either freely or, because Beans are compiled and have no visible source code, commercially. Beans have found application in Sun’s own graphical user interface toolkit, as well as in other projects. Component Object Model (COM) The Component Object Model (COM) is Microsoft’s answer to JavaBeans. It’s a means of writing independent code modules and having them commu- nicate with one another. The idea is that you could have a single, specialized COM module that various other pieces of software (other COM modules and non-COM programs) refer to for different reasons. A single COM module might, for example, serve to perform queries on any specified database. One program might refer to that COM module to query an employee database; another COM module might refer to the query module for accessing a sales database. It’s an economy of scale: one COM module does double duty. Distributed Component Object Model (DCOM) Distributed Component Object Model (DCOM) components are really no different from COM components. DCOM is a subset of COM that includes COM modules running on different machines and referring to one another across a network. nderstanding Programming Languages A programming language is any system of syntax and grammar that, when used to generate sets of instructions called programs, can have an effect on the behavior of a computer. Programming languages broadly include everything from HTML to C++. Here, we’ll focus on highly capable, full- featured development languages and slightly less capable (but simpler) scripting languages. 348 Chapter 8  Internet Development Full-Featured Development Languages A full-featured development language is one that can be used to write stand- alone programs. You can use a full-featured development language to write an elaborate word processor, a Web browser, or a database front end. You could write a whole operating system with certain languages if you wanted to. Examples of such languages in the network software milieu include:  Java  Visual Basic  C and C++ These are compiled languages. When you have written source code, you must run it through a special processor called a compiler that translates the human-readable source code into machine code that processors and operat- ing systems can understand. An operating system makes its resources avail- able to programs running under it by means of an application programming interface (API). Java fans will tell you that their language is not really compiled, and that’s sort of true. When you write Java code, you must run it through a program that converts it to bytecodes, which are instructions that have meaning to an imaginary chip called the Java Virtual Machine (JVM). Java The prime attraction of Java is platform neutrality—a concept that requires some background. Other programming languages, such as C++, require that programmers write different programs for different operating environments. There’s one version of Microsoft Word for Windows 95, another version for Windows 3.x, and another version for MacOS. That’s not acceptable on the Internet, where a server might have to provide the same program to many different kinds of computers—and might not be able to determine what kind of computer needed the program at a given time. Plus, it’s a pain—an expen- sive pain—for software developers, who must multiply the effort required to write a program by the number of platforms they want to support. The single biggest attraction of Java is that, theoretically, you can write one Java program, compile it, and expect it to run similarly under Win- dows 95, MacOS, Solaris, and half a dozen other operating environ- ments—a feature called architecture neutrality. In practice, architecture Understanding Programming Languages 349 neutrality doesn’t work as well as many programmers would like, espe- cially with complicated graphical programs. But it works fine with simple programs, and future versions of Java will surely have even better archi- tecture neutrality. And, most important, other languages don’t even make attempts at architecture neutrality. Visual Basic Microsoft Corporation designed Visual Basic as a tool for fast development of programs for its Windows operating systems. The latest versions of Visual Basic incorporate a certain amount of sensitivity to network software devel- opment, but the primary use of Visual Basic is in writing software for use under Microsoft Windows 98 and Windows NT. A large portion of the work done with Visual Basic involves the creation of user interfaces for databases. Lately, Visual Basic has become more oriented toward network pro- gramming. You can use Visual Basic to create ActiveX controls for embed- ding in Web pages that will be interpreted by Microsoft Internet Explorer. You also can use Visual Basic to create Component Object Model (COM) components. You’ll find the latest Microsoft news about Visual Basic at msdn.microsoft .com/vbasic/. C and C++ Widely regarded as the top of the heap as far as general-purpose program- ming languages are concerned, C and C++ are the standards by which most other such languages are measured. You can do anything with C and C++, from manipulating the pixels on a video screen individually to reading the contents of memory one bit at a time. Programs written in the C languages are fast, too. What’s the difference between C and C++? The latter is object oriented, which means (to cite one important characteristic) it supports the creation of code modules that can inherit traits from other such modules. Say you’d cre- ated a module that performed a countdown operation. If you wrote that module generically enough, you could write other modules that exploited the countdown capability in different ways. You might, for example, write one program that displayed a countdown in Roman numerals and another that 350 Chapter 8  Internet Development used Thai numerals, both based on the same abstract underpinnings. You’ll often note that C and C++ programs consist of more than one file. There’s usually a primary executable, then several libraries. Windows uses dynamic link libraries (DLLs) most of the time; other platforms

Các file đính kèm theo tài liệu này:

  • pdf2637c08_6677.pdf
Tài liệu liên quan