Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 242 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
242
Dung lượng
13,82 MB
Nội dung
[...]... generated by hand prior to the system being computerized This format allowed each student’s performance to be easily compared across subjects, helping to determine honors’ boundaries 6 CHAPTER 1 ■ What Can Go Wrong Figure 1-6 Report required for students’ results A database table was designed to exactly match the report in Figure 1-6, with a field for each column The first year the database worked a treat... design couldn’t handle was students who failed and then reenrolled in a subject The complete academic record for a student needed to be recorded, and the design of the table made it impossible to record more than one mark if a student completed a subject several times That problem wasn’t noticed until the second year in operation (when the first students started failing) By then, a fair amount of effort... summarized here and illustrated in Figure 2-19 1 Express the problem in terms of what a user might want to achieve For a database problem, this will typically be in terms of the data to be stored and the information that needs to be retrieved Sketch some initial use cases and a data model 2 Think about other possible uses of the information and how the data might be usefully ordered or grouped Undertake... described in Chapter 2 First we need to make sure we really understand the problem This may sound obvious, but it is surprising how often people set about implementing a database before they understand the problem completely There are two things we need to do: understand what tasks need to be carried out by all the people who will use the system, and then figure out what data needs to be stored to support... time we wanted to find or count or report on all Eucalyptus plants The fact that our user has mentioned that grouping by genus would be useful means that it is important to get the genus data stored appropriately Our revised data model in Figure 2-12 shows how genus can be represented so that the data is kept accurately Figure 2-12 Revised data model for our plant problem 17 CHAPTER 2 ■ Guided Tour of... discovered, and this whole sorry mess would have been avoided Summary The first thoughts about how to design a database may be influenced by a particular report or by a particular method of input Sometimes the driver for a database is simply that some valuable information has come to hand and needs to be “put somewhere.” The hurried creation of a database or spreadsheet can lead to a design that cannot... and Uses expressed in database tables In UML, a relationship is represented by a line between two class rectangles, as shown in Figure 2-9 The line can be named to make it clear what the relationship is (e.g., “can be used for”), but it doesn’t need to have a name if the context is obvious The pair of numbers at each end of the line indicates how many objects of one class can be associated with a particular... Then we need to count up all the days missed to put on the child’s report The Department of Education needs the totals each term, too Recording the absence and being able to report it in several ways are clearly prime requirements However, what about the sports teams? Does the system need to differentiate those children on teams (and if so does it need to know which teams)? Does the system need to know... preceding tasks may involve entering data into the system, while the last task involves reporting on information already in the system What Data Are Involved? The tasks described in the previous section are very much stated from the users’ point of view and are what physically take place We need to step back a bit, put on our analysts’ hats, and think about what data, if any, need to be recorded or... whether there must be a related object) The second number is the greatest number of related objects It is usually 1 or many (denoted n), although other numbers are possible Collectively, these numbers can be referred to as the cardinality or the multiplicity of the relationship 14 CHAPTER 2 ■ Guided Tour of the Development Process One particular object of ClassA is associated with at least 1 and possibly . storing data before the perpetrator started to run into the problems I’ve just described. None of the databases is being maintained or used as envisioned. Repeated Information Another common problem. accumulated eects of each department’s inaccurate summary information may go unnoticed. ■ IntroduCtIon xxiv Problems with a database are not necessarily caused by a lack of knowledge about the database. individually. Producing a report of all hedging plants would require some logic along the lines of: “ IF use1 = ‘hedging’ OR use2 = ‘hedging’ OR use3=‘hedging’.” Also, the database table as it stands restricts