Chapter 2 -- Developing an Application

A Visual FoxPro application typically includes one or more databases, a main program that sets up the application s system environment, and a user interface comprised of forms, toolbars, and menus. Queries and reports allow users to retrieve information from their data.

This chapter discusses:

  • Planning the Application
  • Creating Databases
  • Creating Classes
  • Providing Access to Functionality
  • Providing Access to Information
  • Testing and Debugging

  • For information on developing applications using the Application Builder and the enhanced Application Framework, see Developing Applications Using the Applications Framework.

Planning the Application

Careful planning saves time, effort, money, and sanity. The more you involve your end users in the planning process, the better. No matter how carefully you plan, though, you ll probably end up refining the specifications as you progress through the project and your end users provide feedback.

Some of the design decisions you make will impact how you create elements of the application. Who will be using the application? What is the center of user activity? How large a data set will you conceivably be working with? Will back-end data servers be used or will the data be exclusively local to a single user or multiple users over a network? Consider these factors before getting too far into the project.

Common User Activities

Even if your end users are working with customers, orders, and parts, how they are working with this information will determine how your application should deal with the data. An order entry form, like the one in Tastraded.app (in the Visual Studio \Samples\Vfp98\Tastrade directory), might be necessary for some applications, but wouldn t be a good tool for managing inventory or tracking sales, for example.

Database Size

You ll want to think more about performance if you are dealing with large sets of data. Chapter 15, Optimizing Applications, explains methods of optimizing performance. You may also want to adjust the way you allow users to move through the data. If you have twenty or thirty records in a table, it's okay to let users move the record pointer in a table one record at a time. If you have twenty or thirty thousand records, you ll have to provide other ways of getting to the desired data: adding search lists or dialogs, filters, custom queries, and so on. Chapter 10, Using Controls, explains how to use a list to select specific table records. Chapter 8, Creating Views, discusses creating parameterized queries.

Single User vs. Multiple Users

It s a good idea to create your application with the assumption that multiple users will be accessing the database at the same time. Visual FoxPro makes it easy to program for shared access. Chapter 17, Programming for Shared Access, describes techniques for allowing multiple users to simultaneously access your database.

International Considerations

If you know your application will be used only in a single-language environment, you don t have to worry about internationalization. If, on the other hand, you want to expand your market, or if your users could be dealing with international data or environment settings, you ll want to take these factors into account as you create the application. Chapter 18, Developing International Applications, discusses the issues you ll need to deal with as you develop applications for international use.

Local vs. Remote Data

If your application deals with remote data, you ll manage it differently than you would manage native Visual FoxPro data. Chapter 8, Creating Views, explains how to create views to local or remote data. Part 6 of the Programmer s Guide, Creating Client/Server Solutions, discusses how to design applications that work seamlessly with remote data.

Overview of the Process

The process of creating an application is largely iterative. Since no two applications are exactly the same, you ll probably develop prototypes and refine some components several times before achieving a finished product. End-user expectations or commitments can also change, requiring you to redefine aspects of the application. And nobody writes bug-free code all the time, so testing and debugging usually lead to some redesigning or rewriting.

The process of creating an application

In addition to taking the big picture into account in your planning stage, you ll need to decide what functionality is required, what data is involved, and how the database should be structured. You ll need to design an interface to give users access to the functionality in the application. You can create reports and queries so that users can extract useful information from their data.

Starting Development

After you have planned which components you need in your application, you might want to set up a directory framework and project to organize the component files you want to create for your application. You can make the framework yourself in the Windows Explorer and the project in the Project Manager, or use the Application Wizard to set up both at one time. This new  Application Wizard opens the Application Builder so you can further customize a project and components you start in the wizard. For backward compatibility, you can still choose the earlier Application Wizard (5.0).

Using the Project Manager

The Project Manager allows you to compile your completed application, but in the development phase of the application, the Project Manager makes it easy to design, modify, and run the individual components of your application.

The Project Manager

When you use the Project Manager, you can:

  • Modify and run pieces of your application (forms, menus, programs) with just a few clicks.
  • Drag classes, tables, and fields from the Project Manager to the Form Designer or Class Designer.
  • Drag classes between class libraries.
  • View and modify your tables and databases easily.
  • Add descriptions for the components in your application.
  • Drag-and-drop elements between projects.

For detailed information about how to use the Project Manager, see Chapter 1, Getting Started, in the User s Guide. For information about compiling applications, see Chapter 13, Compiling an Application, in this book.

Creating Databases

Because a database application is so dependent on the underlying data, the best way to begin designing your application is to start with the data. You can set up your database and determine what the relationships are between tables, what business rules you want to enforce, and so on, before you design any interface or data manipulation components. A sound database foundation makes development work much easier.

Chapter 5, Designing Databases, Chapter 6, Creating Databases, and Chapter 7, Working with Tables, discuss design issues and explain how to use Visual FoxPro to design effective and efficient tables and databases.

Creating Classes

You can create a robust, object-oriented, event-driven application using only the Visual FoxPro base classes. You might not ever have to create a class, but you'll want to. In addition to making code more manageable and easier to maintain, a solid class library allows you to rapidly create prototypes and quickly plug functionality into an application. You can create classes in a program file, in the Form Designer (using the Save As Class command on the File menu), or in the Class Designer.

Chapter 3, Object-Oriented Programming, discusses some of the benefits of creating classes and details how to create them either with the Class Designer or programmatically.

Providing Access to Functionality

User satisfaction will be strongly influenced by the interface you provide for the functionality of your application. You can have a very clean class model, elegant code, and clever solutions to difficult problems in your application, but these are almost always hidden from your customers. What they see is the interface you provide. Fortunately, the Visual FoxPro design tools make it easy to create attractive, feature-rich interfaces.

The user interface consists primarily of forms, toolbars, and menus. You can associate all the functionality in your application with controls or menu commands in the interface. Chapter 9, Creating Forms, describes how to create forms and form sets. Utilizing Visual FoxPro controls in your forms is discussed in Chapter 10, Using Controls. See Chapter 11, Designing Menus and Toolbars, to put the finishing touches on your application.

Providing Access to Information

You ll probably display some information for your users in forms, but you ll also want to give your users the ability to specify exactly what information they want to see and the option to print it out in reports or labels. Queries, especially queries that accept user-defined parameters, allow users to have greater control over their data. Reports allow users to print full, partial, or summary pictures of their data. ActiveX controls and automation allow your application to share information and functionality with other applications.

The Query Designer and the Report Designer are discussed in chapters 4 through 7 of the User s Guide. Chapter 12 of this book, Adding Queries and Reports, discusses integrating queries and reports into an application. Chapter 16, Adding OLE, describes integrating OLE in an application.

Testing and Debugging

Testing and debugging is something most developers do at each step in the development process. It's a good idea to test and debug as you go. If you create a form, you ll want to make sure it does what you want it to do before moving on to other elements of your application.

Chapter 14, Testing and Debugging Applications, explains how to use the Visual FoxPro debugging tools to debug your applications and provides tips on how to make the debugging process easier.



Microsoft Visual FoxPro 6. 0 Programmer's Guide 1998
Microsoft Visual FoxPro 6. 0 Programmer's Guide 1998
ISBN: 1930919042
EAN: N/A
Year: 2004
Pages: 58

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net