Chapter 1
IN THIS CHAPTER
The components of any database system
The System Development Life Cycle
SQL is the international standard language used by practically everybody to communicate with relational databases. This book is about SQL, but in order for you to truly understand SQL, it must be placed in the proper context — in the world of relational databases. In this minibook, I cover the ground necessary to prepare you to exercise the full power of SQL.
Databases don’t exist in isolation. They are part of a system designed to perform some needed function. To create a useful and reliable database system, you must be aware of all the parts of the system and how they work together. You must also follow a disciplined approach to system development if you’re to have any hope at all of delivering an effective and reliable product on time and on budget. In this chapter, I lay out the component parts of such a system, and then break down the steps you must go through to successfully complete a database system development project.
A database containing absolutely critical information would not be of much use if there was no way to operate on the data or retrieve the particular information that you wanted. That’s why several intermediate components (the database engine, DBMS front end, and database application) take their place between the database and the user in order to do these two things:
Figure 1-1 shows the information flow from the user to the database and back again, through the intermediate components.
I examine each of these components one by one, starting with the database itself.
The core component of a database system is — no surprise here — the database itself. The salient features of a database are as follows:
The database engine, also called the back end of a database management system (DBMS), is where the processing power of the database system resides. The database engine is that part of the system that acts upon the database. It responds to commands in the form of SQL statements and performs the requested operations on the database.
In addition to its processing functions, the database engine functions as a two-way communications channel, accepting commands from the DBMS front end (see the next section) and translating them into actions on the database. Results of those actions are then passed back to the front end for further processing by the database application and ultimate presentation to the user.
Whereas the back end is that portion of a DBMS that interfaces directly with the database, the front end is the portion that communicates with the database application or directly with the user. It translates instructions it receives from the user or the user’s application into a form that the back end can understand. On the return path, it translates the results it receives from the back end into a form the user or the user’s application can understand.
The front end is what you see after you click an icon to launch a DBMS such as Access, SQL Server, or Oracle. Despite appearances, what you see is not the database. It is not even the database management system. It is just a translator, designed to make it easier for you to communicate with the database.
Although it is possible for a person to interact directly with the DBMS front end, this is not the way database systems are normally used. Most people deal with databases indirectly through an application. An application is a program, written in a combination of a host language such as C or Java, and SQL, which performs actions that are required on a repeating basis. The database application provides a friendly environment for the user, with helpful screens, menus, command buttons, and instructive text, to make the job of dealing with the database more understandable and easier.
Although it may take significant time and effort to build a database application, after it’s built, it can be used multiple times. It also makes the user’s job much easier, so that high-level understanding of the database is not needed in order to effectively maintain and use it.
The user is a human being, but one who is typically not you, dear reader. Because you are reading this book, I assume that your goal is to learn to use SQL effectively. The user in a database system typically does not use SQL at all and may be unaware that it even exists. The user deals with the screens, menus, and command buttons of the database applications that you write. Your applications shield the user from the complexities of SQL. The user may interact directly with the application you write or, if your application is web-based, may deal with it through a browser.
It is possible for a user, in interactive SQL mode, to enter SQL statements directly into a DBMS and receive result sets or other feedback from the DBMS. This, however, is not the normal case. Usually a database application developer such as you operates in this manner, rather than the typical user.
Producing both a reliable database and an easy-to-use application that fills a real need is a complex task. If you take the task too lightly and build a system without careful preparation, you’re likely to produce something that is neither reliable nor adequately functional.
The best way to accomplish a large, complex task is to break it down into steps, each one of which you can do and do well. To develop a robust and reliable database system, you must go through the seven phases of the System Development Life Cycle (SDLC):
Each one of these phases is important. Sometimes schedule pressure may tempt you to shortchange or even skip one of the phases. To do so invites costly errors or a final product that does not meet the needs of the users.
With that last word to the wise out of the way, read on to find out more about each phase of the System Development Life Cycle.
At the beginning of a project, the person who assigns you the task of building a system — the client — has some idea of what is needed. That idea may be very specific, sharp, and concise, or it may be vague, nebulous, and ill-defined. Your first task is to generate and put into writing a detailed description of exactly what the end result of the project, called the deliverables, should be. This is the primary task of the Definition phase, but this phase also includes the following tasks:
In the Definition phase, you talk with the client. This is the person who has the authority to hire you or, if you are already an employee, assign you to this development task. This person is not, however, the only one with an interest in the project. Chances are, someone other than the client will use the system on a daily basis. Even more people may depend on the results generated by the system. It is important to find out what these people need and what they prefer because your primary client may not have a complete understanding of what would serve them best.
The amount of work you must do in the Requirements phase depends on the client. It can be quick and easy if you are dealing with a client who has prior experience with similar database development projects. Such a client has a clear idea of what he wants and, equally important, what is feasible within the time and budget constraints that apply.
On the other hand, this phase can be difficult and drawn-out if the client has no experience with this kind of development, only a vague idea of what he wants, and an even vaguer idea of what can reasonably be done within the allotted time and budget.
As I mention previously, aside from your primary client — the one who hired you — other stakeholders in the project, such as various users, managers, executives, and board members, also have ideas of what they need. These ideas often conflict with each other. Your job at this point is to come up with a set of requirements that everyone can agree on. This will probably not meet everyone’s needs completely. It will represent a compromise between conflicting desires, but will be the solution that gives the most important functions to the people who need them.
After you have consensus among the stakeholders, you can use their requirements to construct a users’ data model, which includes all the items of interest and how they relate to each other. It also incorporates any business rules that you may have been able to infer from people’s comments. Business rules place restrictions on the items that can be included in a database and on what can be done with those items. See Chapter 2 of Book 1 for a fuller description of the users’ data model.
After you have constructed the users’ data model and verified its accuracy with your client, you can write a formal Statement of Requirements, which is an explicit statement of the database application’s display, update, and control mechanisms. It will answer such questions as
Here’s a summary of what you must do in the Requirements phase:
Upon completion of the Requirements phase (see the preceding section), it’s a good idea to do some serious thinking about what you’ll need to do in order to meet the requirements. This thinking is the main task of the Evaluation phase, in which you address the issues of scope and feasibility more carefully than you have up to this point.
Here are some important considerations for the Evaluation phase:
Now that you know what you need to do, it’s time to decide on exactly how you’re going to do it. First and foremost, you’ll have to choose what development tools you’ll use. In other words, decide on the best DBMS to accomplish this particular project. To determine this, you need to consider these several factors:
Another consideration is the language that you’ll use to develop the application. You can develop some database applications without writing a single line of program code. These tend to be simple applications that are useful in small organizations. More complex applications require at least some programming. For those more complex applications, you must choose the computer language in which you’ll write it. Some of the same considerations that apply to the selection of a DBMS apply here, including the following:
With a clear idea of your task and the tools you’ll use to perform it, you can now write detailed job descriptions for everyone who will have a part in the development effort. This important step eliminates any confusion and finger-pointing about who is responsible for what.
At this stage in the process, you probably have a clearer idea than ever of the assigned task and what it will take to accomplish it. This is a good time to reassess the feasibility of the project. Is it really doable, or are both you and your client too optimistic in thinking that you can achieve everything in the Statement of Requirements, given the DBMS, language, team, budget, and time that you have decided upon?
If the job is not really feasible, it is much better to speak up now than to plunge ahead, burn through your budget and your scheduled time, only to fail to deliver a satisfactory product. At this point, when not much has been invested, you still have some flexibility. You may be able to reduce the scope of the project by deferring until later or even eliminating elements of the project that are not crucial. You may be able to negotiate for a schedule that is not quite so tight, or for a larger budget. You may even decide that the best course for all concerned would be to abandon the project.
At this point, you can bow out relatively gracefully. It will not cost either you or the client very much. If instead, you push ahead with a project that is doomed from the start, you could both suffer substantial loss, both monetarily and in terms of reputation. Making the correct decision here is of critical importance.
As you should do for every phase, document the steps you took in evaluating development tools such as DBMSs and languages. Place the job descriptions you wrote up with the documentation. Document the feasibility analysis, the conclusions you came to, and the adjustments to the task scope, budget, and schedule that you made, if any.
Up until this point, the project has primarily been analysis. Now you can make the transition from analysis to design. You most likely know everything you need to know about the problem and can now start designing the solution.
Here’s an overview of what you do in the Design phase:
Database design is all about models. Right now, you have the users’ data model, which captures the users’ concept of the structure of the database. It includes all the major types of objects, as well as the characteristics of those objects, and how the objects are related to one another. This is great as far as it goes. However, it’s not sufficiently structured to be the basis for a database design. For that, you need to convert the users’ data model into a model that conforms to one of the formal database modeling systems that have been developed over the past few decades.
The most popular of the formal modeling systems is the entity-relationship model, commonly referred to as the ER model, which I introduced in Book 1, Chapter 2. In the next chapter of this minibook, I describe the ER model in greater detail. With this model, you can capture what the users have told you into a well-defined form that you can then easily translate into a relational database.
As you convert the users’ data model into an ER model, you need to make decisions that affect how that conversion is made. Make sure you document your reasoning for why you do things the way you do. At some later time, someone is going to have to modify, update, or add to the database you’re building. That person will need all possible information about why the system is designed the way it is. Take the time to document your reasoning as well as documenting the model itself.
After you have the system in the form of an ER model, it’s easy to convert into a relational model. The relational model is something that your DBMS understands, and you can create the database directly from it.
After you have designed the database, the design task is only half done. You have a structure that you can now fill with data, but you do not yet have a tool for operating on that data. The tool you must design now is the database application.
The database application is the part of the total system that interacts with the user. It creates everything that the user sees on the screen. It senses and responds to every time the user presses a key or uses the mouse. It prints every report that is read by the user’s coworkers. From the standpoint of the user, the database application is the system.
In designing the database application, you must ensure that it enables the users to do everything that the Statement of Requirements promises that they’ll be able to do. It must also present a user interface that is understandable and easy to use. The functions of the system must appear in logical positions on the screen, and the user must easily grasp how to perform all the functions that the application provides.
What functions must the application perform, pray tell? Using the DBMS and language that you chose — or that was chosen for you by the client — how will you implement those functions? At this point, you must conceive of and map out the logical flow of the application. Make sure you know exactly how each function will be performed.
The final part of the Design phase is — you guessed it — to document everything carefully and completely. The documentation should be so complete that a new development team could come in and implement the system without asking you a single question about the analysis and design efforts that you have just completed. Take the completed design document to the client and get him to sign it, signifying that he understands your design and authorizes you to build it.
Many nondevelopers believe that developing a database and application is synonymous with writing the code to implement them. By now, you should realize that there is much more to developing a database system than that. In fact, writing the code is only a minor fraction of the total effort. However, it is a very important minor fraction! The best planning and design in the world would not be of much use if they did not lead to the building of an actual database and its associated application.
In the Implementation phase, you
Documenting the database is relatively easy because most DBMS products do it for you. You can retrieve the documentation that the DBMS creates at any time, or print it out to add to the project records. You definitely need to print at least one copy for that purpose.
Documenting a database application calls for some real work on your part. Application documentation comes in two forms, aimed at two potential audiences:
The testing and documentation phase includes the following tasks:
After you have built and documented a database system, it may seem like you are finished and you can enjoy a well-deserved vacation. I’m all in favor of vacations, but you’re not quite finished yet. The system needs to be rigorously tested, and that testing needs to be done by someone who does not think the same way you do. After the system becomes operational, users are sure to do things to it that you never imagined, including making combinations of selections that you didn’t foresee, entering values into fields that make no sense, and doing things backward and upside down. There is no telling what they will do. Whatever unexpected thing the user does, you want the system to respond in a way that protects the database and guides the user into making appropriate input actions.
It is hard to build into a system protections against problems that you can’t foresee. For that reason, before you turn the system over to your client, you must have an independent tester try to make it fail. The tester performs a functional test to see that the system does everything it is supposed to do. Also, the tester runs it on all the types of computers and all the operating systems that it is supposed to run on. If it is a web-based application, it needs to be tested for compatibility with all popular browsers. In addition, the tester needs to do illogical things that a user might do to see how the system reacts. If it crashes, or responds in some other unhelpful way, you’ll have to modify your implementation so it will prompt the user with helpful responses.
Quite often, when you modify a database or application to fix a problem, the modification will cause another problem. So after such a modification, the entire system must be retested to make sure that no new problems have been introduced. You might have to go through several iterations of testing and modification before you have a system that you can be very confident will operate properly under all possible conditions.
While the independent tester is trying everything conceivable (and several things inconceivable) to make your product fail, you and your team still aren’t ready to take that well-deserved vacation. Now is the time for you to put your documentation into final form. You have been carefully documenting every step along the way of every phase. At this time, you need to organize all that documentation because it is an important part of what you’ll deliver to the client.
User documentation will probably consist of both context-sensitive help that is part of the application and a printed user’s manual. The context-sensitive help is best for answers to quick questions that arise when a person is in the middle of trying to perform a function. The printed manual is best as a general reference and as an overview of the entire system. Both are important and deserve your full attention.
When the testing and documentation phase is complete, all that is left to do is formally deliver the system, complete with full documentation, to your client. This usually triggers the client’s final payment to you if you are an independent contractor. If you are an employee, it will most likely result in a favorable entry in your personnel file that may help you get a raise at your next review.
Now you and your team can celebrate!
Just because you’ve delivered the system on time and on budget, have celebrated, and have collected your final payment for the job does not mean that your responsibilities are over. Even if the independent tester has done a fantastic job of trying to make the system fail, after delivery it may still harbor latent bugs that show up weeks, months, or even years later. You may be obligated to fix those bugs at no charge, depending on your contractual agreement with the client.
Even if no bugs are found, you may still have some ongoing responsibility. After all, no one understands the system as well as you do. As time goes on, your client’s needs will change. Perhaps she’ll need additional functions. Perhaps she’ll want to migrate to newer, more powerful hardware. Perhaps she’ll want to upgrade to a newer operating system. All of these possibilities may require modifications to the database application, and you’re in the best position to do those modifications, based on your prior knowledge.
This kind of maintenance can be good because it is revenue that you don’t have to go out hunting for. It can also be bad because it ties you down to technology that, over time, you may consider obsolete and no longer of interest. Be aware that you may have at least an ethical obligation to provide this kind of ongoing support.
Every software development project that gets delivered has a Maintenance phase. You may be required to provide the following services during that phase:
18.217.116.183