1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP and MySQL Web Development - P94 ppt

5 95 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 65,85 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

V Building Practical PHP and MySQL Projects 22 Using PHP and MySQL for Large Projects 23 Debugging 24 Building User Authentication and Personalization 25 Building a Shopping Cart 26 Buil

Trang 1

V Building Practical PHP and

MySQL Projects

22 Using PHP and MySQL for Large Projects

23 Debugging

24 Building User Authentication and Personalization

25 Building a Shopping Cart

26 Building a Content Management System

27 Building a Web-Based Email Service

28 Building a Mailing List Manager

29 Building Web Forums

30 Generating Personalized Documents in Portable Format (PDF)

31 Connecting to Web Services with XML and SOAP

Trang 3

22 Using PHP and MySQL

for Large Projects

IN THE EARLIER PARTS OF THIS BOOK, we’ve discussed various components of and uses for PHP and MySQL Although we’ve tried to make all our examples interesting and relevant, they have been pretty simple, consisting of one or two scripts of up to 100 or so lines of code

When you are building real world Web applications, things are rarely this simple There was a time a few years ago when an “interactive”Web site had form mail and that was it However, these days,Web sites have become Web applications—that is, a regular piece of software delivered over the Web.This change in focus means a change in scale Web sites grow from a handful of scripts to thousands and thousands of lines of code Projects of this size require planning and management like any other software develop-ment

Before we move on to look at the projects in this section of the book, we’ll look at some of the techniques you can use to manage sizable Web projects.This is an emerging art and it’s obviously difficult to get it right:You can see this by observation in the mar-ketplace

In this chapter, we’ll look at

n Applying software engineering to Web development

n Planning and running a Web application project

n Re-using code

n Writing maintainable code

n Implementing version control

n Choosing a development environment Documenting your project

Trang 4

Optimizing code

Applying Software Engineering to Web Development

As you probably already know, software engineering is the application of a systematic, quantifiable approach to software development.That is, it is the application of engineer-ing principles to software development

It is also an approach that is noticeably lacking in many Web projects.This is for two main reasons

The first reason is that Web development is often managed in the same way as the development of written reports It is an exercise in document structure, graphic design, and production.This is a document-oriented paradigm.This is all well and good for

stat-ic sites of small to medium size, but as we increase the amount of dynamstat-ic content in Web sites to the level in which Web sites offer services rather than documents, this para-digm no longer fits Many people do not think to use software engineering practices for

a web project at all

The second reason software engineering practices are not used is that Web application development is different from normal application development in many ways.We deal

with much shorter lead times, a constant pressure to have the site built now Software

engineering is all about doing things in an orderly, planned manner, and spending time

on planning.With Web projects, often the perception is that we don’t have the time to plan

When we fail to plan Web projects, we end up with the same problems as if we fail to plan any software project: buggy applications, missed deadlines, and unreadable code The trick, then, is in finding the parts of software engineering that work in this new discipline of Web application development, and discarding the parts that don’t

Planning and Running a Web Application Project

There is no best methodology or project lifecycle for Web projects.There are, however, a number of things you should consider doing for your project.We’ll list them here, and talk about some of them in more detail in the following sections.These considerations are in a specific order, but you don’t have to follow this order if it doesn’t suit your proj-ect.The emphasis here is on being aware of the issues and choosing techniques that will work for you

Trang 5

441 Reusing Code

n Before you begin, think about what you are trying to build.Think about the end goal.Think about who is going to use your Web application; that is, your targeted audience Many Web projects that are technically perfect fail because nobody checked that there were interested users for such an application

n Try and break your application down in to components.What parts or process steps does your application have? How will each of those components work? How will they fit together? Drawing up scenarios, storyboards, or even use cases can be useful for figuring this out

n After you have a list of components, see which of these already exist If a prewrit-ten module has that functionality, look at using it Don’t forget to look inside and outside your organization for existing code Particularly in the Open Source com-munity, many preexisting code components are freely available for use Decide what code you have to write from scratch and roughly how big of a job that is

n Make decisions about process issues.This is ignored too often in Web projects By process issues, I mean things such as coding standards, directory structures, manage-ment of version control, developmanage-ment environmanage-ment, documanage-mentation level and stan-dards, and task allocations to team members

n Build a prototype, based on all the previous information Show it to users Iterate

n Remember that, in all of this, it is important and useful to separate content and logic in your application.We’ll explain this idea in more detail in a minute

n Make any optimizations you think are necessary

n As you go, test, as thoroughly as you would with any software development project

Reusing Code

Programmers often make the mistake of rewriting code that already exists.When you know what application components you need, or on a smaller scale, what functions you need, check what’s available before beginning development

One of the strengths of PHP as a language is its large built-in function library Always check to see if a function exists that does what you are trying to do It usually isn’t too hard to find the one you want A good way to do this is to browse the manual by func-tion group

Sometimes programmers rewrite functions accidentally because they haven’t looked

in the manual to see if an existing function supplies the functionality they need Always keep the manual bookmarked if you are online, or download the current version and browse it locally.Take note, however, that the online manual gets updated quite

frequent-ly, and you also have the advantage of being able to browse the annotated manual.The annotated manual is a fantastic resource as it contains comments, suggestions, and sample

Ngày đăng: 07/07/2014, 03:20

TỪ KHÓA LIÊN QUAN