Free Programming Books
Free download ebooks on computer and programming

Free PHP/MySQL ebook "Beginning PHP 5 and MySQL E-Commerce: From Novice to Professional" Sample Chapter

PHP 5 and MySQL E-Commerce...
Free download Chapter 2: Laying Out the Foundations
Download chapter

Beginning PHP 5 E-Commerce: From Novice to Professional is an ideal reference for intermediate PHP 5 and MySQL developers, and programmers familiar with web development technologies. This book covers every step of the design and build process, and provides rich examples that will enable you to build high-quality, extendable e-commerce websites. Take a peek at an actual book example!

Furthermore, this book covers site building in three phases. Phase one results in a live website, with an attractive interface and fully searchable product catalog. Next, phase two explains adding facilities to increase sales through cross-selling, upselling, and enhancing customer service. Finally, phase three seeks to reduce costs through automated order processing and integrating with other systems via XML Web services.

 next > >

Laying Out the Foundations

Now that you've convinced the client that you can create a cool web site to complement his or her activity, it's time to stop celebrating and start thinking about how to put into practice all the promises you've made. As usual, when you lay down on paper the technical requirements you must meet, everything starts to seem a bit more complicated than initially anticipated. To ensure this project's success, you need to come up with a smart way to implement what you have signed the contract for. You want to develop the project smoothly and quickly, but the ultimate goal is to make sure the client is satisfied with your work. Consequently, you should aim to provide your site's increasing number of visitors with a positive web experience by creating a pleasant, functional, and responsive web site.

The requirements are high, but this is normal for an e-commerce site today. To maximize the chances of success, we'll analyze and anticipate as many of the technical requirements as possible, and implement solutions in a way that supports changes and additions with minimal effort.

This chapter lays down the foundations for the future TShirtShop web site. We will talk about the technologies and tools you'll use, and even more importantly, how you'll use them.

Your goals for this chapter are to

  • Analyze the project from a technical point of view
  • Analyze and choose an architecture for your application
  • Decide which technologies, programming languages, and tools to use
  • Discuss naming and coding conventions
  • Create the basic structure of the web site and set up the database

Designing for Growth

The word design in the context of a web application can mean many things. Its most popular usage probably refers to the visual and user interface design of a web site.

This aspect is crucial because, let's face it, the visitor is often more impressed with how a site looks and how easy it is to use than about which technologies and techniques are used behind the scenes, or what operating system the web server is running. If the site is slow, hard to use, or easy to forget, it just doesn't matter what rocket science was used to create it. Unfortunately, this truth makes many inexperienced programmers underestimate the importance of the way the invisible part of the site is implemented-the code, the database, and so on. The visual part of a site gets visitors interested to begin with, but its functionality makes them come back. A web site can sometimes be implemented very quickly based on certain initial requirements, but if not properly architected, it can become difficult, if not impossible, to change.

For any project of any size, some preparation must be done before starting to code. Still, no matter how much preparation and design work is done, the unexpected does happen and hidden catches, new requirements, and changing rules always seem to work against deadlines. Even without these unexpected factors, site designers are often asked to change or add new functionality many times after the project is finished and deployed. This will also be the case for TShirtShop, which will be implemented in three separate stages, as discussed in Chapter 1.

You will learn how to create the web site so that the site (or you) will not fall apart when functionality is extended or updates are made. Because this is a programming book, instead of focusing on how to design the user interface or on marketing techniques, we'll pay close attention to designing the code that makes them work.

The phrase, designing the code, can have different meanings; for example, we'll need to have a short talk about naming conventions. Still, the most important aspect that we need to take a look at is the application architecture. The architecture refers to the way you split the code for a simple piece of functionality (for example, the product search feature) into smaller components. Although it might be easier to implement that functionality as quickly and as simply as possible, in a single component, you gain great long-term advantages by creating more components that work together to achieve the desired result.

Before talking about the architecture itself, you must determine what you want from this architecture.