Read an Excerpt
HTML for the Business Developer
With JavaServer Pages, PHP, ASP.NET, CGI, and JavaScript
By Kevin Forsythe, Laura Ubelhor MC Press
Copyright © 2008 MC Press Online, LP
All rights reserved.
ISBN: 978-1-58347-687-1
CHAPTER 1
An Introduction to Browser-Based Applications
This book is written for business programmers, by business programmers. Since HTML is the foundation language for all browser-based business applications, we'll start there. However, any browser-based application almost certainly involves languages or tools in addition to HTML. In later chapters, you'll see many examples of how those other languages and tools integrate with HTML.
What exactly is a browser-based application? Application development in the 21st century can be broken down into two categories: legacy and modern. (These terms are commonly used by business application developers, but they can be a bit misleading, as legacy applications are sometimes quite modern in their design, while some so-called modern applications have horribly archaic designs.) Modern application development splits further into two sub-categories: browser-based and client-based. Client-based applications are typically deployed as executable files loaded onto each computer that needs the application. This often involves one or more installation CDs or a lengthy download from a Web site. A browser-based application, the topic of this book, is quite different.
A Web browser is a program such as Microsoft's Internet Explorer or Mozilla's Firefox. It is designed as a generic Web page presenter, accepting complex streams of commands and data from remote Web servers and composing them into visually appealing Web pages. A browser can typically process instructions written in a number of different languages, but by far the most common is HTML, which stands for HyperText Markup Language.
HTML is one of many markup languages. All of them rely on small snippets of code called tags that are intermixed with the content being processed. In the case of HTML, a tag is recognized by the less-than and greater-than signs that surround it. For example, to create a large page heading, you might code MY PAGE HEADING
. The tag signals the browser that the text that follows appears very large, as shown in Figure 1.1.
The tag is called an end tag. The slash indicates that this tag ends the previous heading tag. Any text processed after the end tag appears in the default size and style. Most, but not all, HTML tags have corresponding end tags.
HTML is a relatively simple language. While it does have some quirks, it should not intimidate anyone. Generally, the most complex aspects of Web page design come from integrating other languages into the HTML code, such as JavaScript and cascading style sheets.
What Additional Languages?
Initially, you'll learn how to incorporate JavaScript and cascading style sheets (CSS) into your Web pages. Then, you'll see how to combine those pages with other languages, such as JSP, PHP, ASP.NET, and CGI, to provide database integration.
Each language has its own strengths and weaknesses. JavaScript is a powerful Java-based language modeled on C++, but simpler and with key design changes to make it easier to deploy on a variety of computers. PHP is a popular scripting language designed specifically for database integration. This HTML preprocessor runs on a Web server and creates dynamic HTML content that is returned to the remote user via the browser. ASP.NET is similar in concept to PHP, but the syntax is similar to VB.NET, the version of Microsoft's Visual Basic (VB) implemented on its .NET Framework. CGI programming is not actually a language, but a technique that involves the Common Gateway Interface protocol. CGI defines a standard method for a Web browser to interact with custom-written application programs on remote Web servers. Both PHP and ASP.NET rely on specialized CGI programs. CGI programs can be written in many languages and provide a powerful and flexible method for developing dynamic Web pages.
Which language you choose is up to you, and will be the product of a decision with many factors, such as your current skill sets, your coworkers' skill sets, executive mandates, existing applications, and personal preference. Our goal is to provide complete, clear, and functional examples of browser-based applications written with each of these methods, enabling you to be productive immediately upon completion of this book.
What Is a Client?
The client is the hardware device that will be used to access the Web application. The client is probably a laptop or desktop computer, but it might be a handheld device such as a PDA or even a cell phone. The devices that your application will need to support usually depends on who your application users are and what devices they use to access the Internet. These devices will also likely use a variety of operating systems. While the most common operating system is Microsoft Windows, there are many other possibilities, including the Mac OS, Linux, and the Palm OS.
Even if all of your Web site's visitors will be using Windows on PCs, they might be using different screen sizes and resolutions, which will affect the appearance of the site and applications. There might or might not be an impact on how applications are coded. For example, if your visitors are going to be using handheld devices, your application might need to be designed and coded to easily fit displayed data on a smaller screen. If your application has a lot of graphics, the need to consider performance and appearance will be more important. (Considerations based on device types, operating systems, screen sizes, and resolution are discussed in more detail in chapter 13.)
What Is a Browser?
A browser is software that acts as an interface between the user client and the Web. The browser is also sometimes referred to as a Web client. The browser sends requests for information, receives that information, and displays it on a user client.
You are probably already familiar with some of the browsers available. They include, but are not limited to, Internet Explorer, Firefox, Opera, and Netscape. The browsers used to access applications can affect appearance and impose other considerations for Web development. Browsers are free of charge and change in popularity. If your application provides access to the general Internet community, many different browsers will probably be used to access your site and applications. (Browsers are discussed in more detail in chapter 13.)
What Is HTML?
If you are creating a Web application, you almost certainly will use HTML. HTML has been around quite a while and will certainly be used for a long time to come. It is the language of the Web, so you definitely need to have at least a basic understanding of it. HTML has changed since its initial inception to include functions and features to make it more flexible and easier to use for Web application development. You will be introduced to HTML in the following chapters.
A document in pure HTML is static, meaning it exists in a constant state. Client-side scripting can be embedded within HTML to make a Web application dynamic. Most often, the language used for client-side scripting is JavaScript. You'll learn about JavaScript and client-side scripting in chapter 8.
HTML forms are often used as the means to incorporate CGI within a Web application. As mentioned earlier, CGI is a protocol for interfacing with applications on a Web server. This involves server-side scripting. You will learn about CGI and server-side scripting in later chapters.
What Is a Web Server?
The term Web server can refer to the program that is responsible for communicating with client browsers. A Web server accepts HTTP requests from client browsers and serves HTTP responses, including optional data content, which is usually in the form of an HTML document and linked objects. The term Web server can also refer to the system that runs Web server programs. There are really two components of a Web server: hardware and software.
Writing Web applications doesn't necessarily mean that you'll need to purchase new hardware. Many platforms can be used to serve Web sites. Some are more compatible and better suited to Web development than others, but most can accommodate Web development. Your organization probably already has a system that can be used for serving a Web site and Web applications.
A decision will need to be made whether additional hardware is required to serve your site and Web applications. Additional hardware may add another layer of security. Data and applications can reside on the same system, or you might want to separate data to add yet another layer of security. On the other hand, having additional hardware requires additional support and administration. Using a Web hosting service should also be considered.
What Database(s) Are Used?
Nearly any database could have been used for the examples in this book. Web programming is generally very inclusive, and most databases are supported. The examples in this book use primarily Microsoft Access databases and MySQL databases, but chapter 7 includes a brief discussion on connecting to a Microsoft SQL Server database. Chapters 10 and 12 use a MySQL database and include several examples of connections that can be used to incorporate dynamic database content within your Web applications.
Where Can I Find Sample Code?
The examples used in this book are available on MC Press's Web site (www.mcpressonline.com). Go to the forums tab and select the MC Press Product Downloads and Reviews forum. There you will find a list of titles arranged alphabetically. Select HTML for the Business Developer to find the download files. Feel free to download and use the examples. We hope this book and the examples included will help you develop your own Web-based applications as quickly and easily as possible. Corresponding code files can be found for all of the code examples provided within this book.
The Development Process
The tools and techniques may be different for Web development than for traditional business programming, but the process is very similar. Developing applications still requires analysis, design, coding, testing, documentation, implementation, and support. Web development also requires looking at the application life cycle and building flexibility into the design so it can adapt to business process changes.
Your organization's development standards should be updated to provide developers a structure and process to follow as a standardized guide. Like development with legacy code, having predefined standards for Web development keeps code consistent, organized, easily maintained, and manageable.
All environments have their own unique challenges, just as all programmers have their own unique methods of coding. You can ask a number of programmers to code the same solution, and none of the applications will be coded exactly the same. Having a defined development process minimizes the effects of development differences. This holds true for Web applications as well as other applications. Organizations may also have internal requirements, such as Sarbanes-Oxley compliance, that cannot be overlooked and need to be accounted for in the development process. Web applications may add another twist, as additional hardware is often introduced into the mix. For example, application databases and some of the application code might reside on one system, and the browser-based components and server on another.
Take the time to consider how Web development fits into the process and have a defined process to follow. This will be time well spent. When learning a new language, developers will try to stick to a comfortable coding style. If a process is not predefined, developers will also define their own. Having a defined process and coding style will result in more consistent code and a more organized application. This kind of application is much easier to support in the long term, whether you or someone else has to go back and change, maintain, or debug code.
Once a decision has been made on the tools, technology, and hardware infrastructure that will be used for Web development, and prior to actual beginning development, consider the development process. This process should be revisited periodically. Changes will be made as a result of business requirements, business needs, and technology changes, among other reasons. The development process, like any other, can be defined, revisited, and enhanced to fit your organization's environment. How informal and flexible the process is depends on your environment's specifics.
IT Staff
As with legacy applications, development tasks for Web applications may be the responsibility of several groups or departments. This holds true especially in larger organizations. One group might be responsible for the application design and graphics, another for database support, another for administration, and another for business application logic and development. Responsibility might also be structured by platform, as Web applications often involve more than one platform. This does not mean that Web development requires more staff than legacy development, but it does mean you must consider the components, tasks, and IT staff structure. Staff structure will be based in part on resource skill sets and project requirements. In smaller organizations, the developer may also be responsible for configuration, Web design, and coding. However, you'll often find that experts in design or coding are not necessarily expert in configuration or hardware infrastructure. Therefore, tasks are often spread among different staff members and departments.
The size of the organization and the skill sets of resources can have a great impact on the structure of an IT staff. As shown in Table 1.1, small organizations require individuals with very diverse skill sets and an understanding of the complete realm of requirements. One of the interesting challenges of Web development is that it enables business developers to try their hand at design. Often, developers with strong analytical skills, who are able to tackle complex business requirements and turn them into well-functioning applications, aren't nearly as intuitive at designing the look of an application. This might mean stepping outside of a comfort zone, but it does not mean a business developer cannot fulfill this role within an IT staff structure.
While this book focuses on business programming, it also includes other topics to provide insight into the many areas of Web development. Whether you will be responsible for many Web application tasks or programming only, an understanding of the related tasks will help you develop solid Web programming skills and make you better prepared to decide where you fit. Trying to be a jack of all trades may result in your being a master of none. Don't overwhelm yourself. We have intentionally focused on the business developer and on coding dynamic business applications so you will have an understanding of the technical skills required. You'll find, after gaining some experience, that there are often similarities in the languages and tools used for Web development. Learning HTML is valuable no matter what role you will fill as a developer. Learning common languages to create business applications is always beneficial.
So what does this mean to you as a developer? You can focus your effort on coding only, or you can decide to develop expanded Web skills to fulfill a role requiring a diverse skill set. Your personal goals, job status, and skill set will affect where you fit within your organization's IT staff structure. A developer with diverse skills will have more flexibility in the roles and organizations that are a good fit. If your desire is to learn other skills in addition to business application Web development, you might be more content within a small to medium organization. If you want to focus your skills on application coding and development, and not learn design, administration, or other related skills, a large organization will likely be a better fit.
Platforms
Creating Web applications does not necessarily mean an organization will need to change or add new platforms. Often, existing hardware can be used, if it is fit for Web development. Most organizations already have clients set up with Web browser support. Browser support is a necessity. The back-end hardware will probably not be the same as the client devices users have to access the Web. The configuration will also include a Web server. One of the most popular platforms for a Web server is a PC. This might be the same PC-based server used for the organization's intranet, or for security purposes, it might be a server dedicated to Web applications.
(Continues...)
Excerpted from HTML for the Business Developer by Kevin Forsythe, Laura Ubelhor. Copyright © 2008 MC Press Online, LP. Excerpted by permission of MC Press.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.