Note that numbers are stored in a column of typeVARCHAR. Won't this preclude queries such as"Find the average income of a registered user"?Not if you're using Oracle. Oracle is smart aboutautomatically casting between character stringsand numbers. It will work just fine toselect average(varchar_value)from users_extra_infowhere field_name = 'annual_income'One complication of this kind of data model is that itis tough to use simple built-in integrity constraintsto en<strong>for</strong>ce uniqueness if you're also going to usethe users_extra_info <strong>for</strong> many-to-onerelations.For example, it doesn't make sense to have tworows in the info table, both <strong>for</strong> the same user IDand both with a field name of "birthdate". A usercan only have one birthday. Maybe we shouldcreate unique indexusers_extra_info_user_id_field_idx onusers_extra_info (user_id, field_name);(Note that this will make it really fast to fetch a particular field <strong>for</strong> aparticular user as well as en<strong>for</strong>cing the unique constraint.)But what about "home_phone"? Nothing should prevent a user fromgetting two home phone numbers and listing them both. If we try toinsert two rows with the "home_phone" value in the field_namecolumn and 451 in the user_id column, the RDBMS will abort thetransactions due to violation of the unique constraint defined above.How to deal with this apparent problem? One way is to decide thatthe users_extra_info table will only be used <strong>for</strong> single-valuedproperties. Another approach would be to abandon the idea of usingthe RDBMS to en<strong>for</strong>ce integrity constraints and put logic into theapplication code to make sure that a user can only have onebirthdate. A complex but complete approach is to define RDBMS78If you're using afancycommercialRDBMS and wishto make querieslike this reallyfast, check outbitmap indices,oftendocumentedunder "DataWarehousing".These areintended <strong>for</strong>columns of lowcardinality, i.e.,not too manydistinct valuescompared to thenumber of rowsin the table.You'd build abitmap index onthefield_namecolumn.store the frequencies <strong>for</strong> weather in<strong>for</strong>mation, contactingother pilots (if non-towered) or the control tower (if towered),air traffic control <strong>for</strong> instrument flight clearances. We need torecord runway lengths and conditions. An airport may haveseveral runways, however, thus giving rise to a many-to-onerelation, which is why we model runways separately and linkthem to airports.<strong>for</strong> the runway typenumber (e.g., "09/27"), length, condition. Note that therunway number implies the magnetic orientation: 09 impliesa heading of 090 or landing facing magnetic east; if the windfavors a landing on the same strip of asphalt in the oppositedirection, you're on 27, which implies a heading of 270 ordue west (36 faces north; 18 faces south).<strong>for</strong> the navigation aid typeThe U.S. Federal Aviation Administration maintains anationwide network of Very High Frequency Omni Rangingbeacons (VORs). These transmit two signals, one of whichis constant in phase regardless of an airplane's bearing tothe VOR. The second signal varies in phase as one circles aVOR. Thus a VOR receiver in the airplane can compare thephase of the two signals and determine that an airplane is,<strong>for</strong> example, on the 123-degree radial from the VOR. If youdidn't have a Global Positioning System receiver in yourairplane, you'd determine your position on the chart byplotting radials out from two VORs. For a navaid we need tostore its type (could be an old non-directional beacon, whichsimply puts out an AM radio-style broadcast), frequency,position, and Morse code ID (you want to listen to the dotdashpattern to make sure that you're receiving the propernavaid).<strong>for</strong> the restaurant typemenu_excerpt, hours, distance_from_airport,phone_number, url, email, street_address<strong>for</strong> the hotel typeprice, distance_from_airport, phone_number, url, email,street_addressAn example of a running system along these lines, visithttp://www.airnav.com/airports/ and type in the name or code <strong>for</strong> yourfavorite airport.Back to Your Ontology ...Following the structure that you designed in the <strong>Software</strong> Modularitychapter, create a module called "km" (<strong>for</strong> "knowledge management")271
Example Ontology 2: FlyingWe want a system that will enable pilots to assist each other byrelating experience, e.g., "The autopilot in N123 is not to be trusted","Avoid the nachos at the airport cafe in Hopedale", with thecomments anchored by official U.S. government in<strong>for</strong>mationregarding airports, runways, and radio beacons <strong>for</strong> navigation.Object types include:270• person• publication• airplane design• airplane• airport• runway• navigation aid ("navaid")• restaurant• hotel• flight school• flight instructorIn addition to the housekeeping elements defined in Example 1, wedefine type-specific elements:<strong>for</strong> the airplane design typeFor each kind of airplane flying, there is one entry in thistable. An example might be "Cessna 172" or "Boeing 747".We need elements to specify per<strong>for</strong>mance such asstall_speed (how slow you can go be<strong>for</strong>e tumbling out of thesky), approach_speech (how fast you should go whencoming near the runway to land), and cruise_speed. Wewant elements such as date_certified, manufacturer_name,and manufacturer_address to describe the design.<strong>for</strong> the airplane typeAn entry in this table is a specific airplane, very likely arental machine belonging to a flight school. We wantelements such as date_manufactured, ifr_capable_p (legalto fly in the clouds?), and optional_equipment.<strong>for</strong> the airport typeWe want to know where the airport is: lat_long; elevation;relation_to_city (distance and direction from a named town).We want to know whether the airport is military-only, private,or public. We want to know whether or not the airport has arotating green/white beacon and runway lights. We want totriggers that runs a short procedural program inside the RDBMS--inOracle this would be a program in the PL/SQL or Java programminglanguages. This program can check that uniqueness is preserved <strong>for</strong>fields that indeed must be unique.5.2 Fat versus Skinny: the DecisionDeciding between fat-style and skinny-style is an engineeringjudgement call. You can certainly build a working system using eitherapproach but how much guidance does that give you? You know thatyou can build a computer program in any Turing-complete computerlanguage but that doesn't make Assembler as practical as Basic, C#,Eiffel, Java, Lisp, or ML.One argument in favor of fat-style is maintainability and selfdocumentation.Fat is the convention in the database world. A SQLprogrammer who takes over your work will expect fat. He or she willsit down and start to understand your system by querying the datadictionary, the RDBMS's internal representation of what tables aredefined. Here's how it looks with Oracle:select table_name from user_tables;describe users*** SQL*Plus lists the column names ***describe other_table_name*** SQL*Plus lists the column names ***describe other_table_name_2*** SQL*Plus lists the column names ***...Suppose that you were storing all of your application data in a singletable:create table my_data (key_id integer,field_name varchar,field_type varchar,field_value varchar);This is an adequate data model in the same sense that rawinstructions <strong>for</strong> a Turing machine is an adequate programminglanguage. Querying the data dictionary would be of no help towardunderstanding the purpose of the application. One would have tosample the contents of the rows of my_data to see what was being79
- Page 1 and 2:
SoftwareEngineering forInternetAppl
- Page 3 and 4:
Signature: ________________________
- Page 5 and 6:
end-users. We use every opportunity
- Page 7 and 8:
• availability of magnet content
- Page 9 and 10:
• we want to see if a student is
- Page 11 and 12:
you supply English-language queries
- Page 13 and 14:
What to do during lecturesWe try to
- Page 15 and 16:
The one-term cram courseWhen teachi
- Page 17 and 18:
332• spend a term learning how to
- Page 19 and 20:
Once we've taught students how to b
- Page 21 and 22:
has permission to perform each task
- Page 23 and 24:
UDDIUnixcustomer's credit card. If
- Page 25 and 26:
thousands of concurrent users. This
- Page 27 and 28: OraclePerlnamed XYZ" without the pr
- Page 29 and 30: LDAPLinuxbits per color, a vastly s
- Page 31 and 32: FilterFirewallFlat-fileGIF318functi
- Page 33 and 34: when there is an educational dimens
- Page 35 and 36: system. The authors of the core pro
- Page 37 and 38: Sign-OffsTry to schedule comprehens
- Page 39 and 40: scheduling goals that both you and
- Page 41 and 42: Client Tenure In Job (new, mid-term
- Page 43 and 44: ReferencesEngagement ManagementSQL*
- Page 45 and 46: Decision-makers often bring senior
- Page 47 and 48: presentation to a panel of outsider
- Page 49 and 50: 300always been written by programme
- Page 51 and 52: 17.3 Professionalism in the Softwar
- Page 53 and 54: Try to make sure that your audience
- Page 55 and 56: Chapter 17WriteupIf I am not for my
- Page 57 and 58: Suppose that an RDBMS failure were
- Page 59 and 60: analysis programs analyzing standar
- Page 61 and 62: at 9 hours 11 minutes 59 seconds pa
- Page 63 and 64: found" will result in an access log
- Page 65 and 66: 15.18 Time and MotionThe team shoul
- Page 67 and 68: select 227, 891, 'algorithm', curre
- Page 69 and 70: create table km_object_views (objec
- Page 71 and 72: • object-create• object-display
- Page 73 and 74: The trees chapter of SQL for Web Ne
- Page 75 and 76: );274-- ordering within a form, low
- Page 77: and start the high-level document f
- Page 81 and 82: systems. What would a knowledge man
- Page 83 and 84: spreadsheet". Other users can comme
- Page 85 and 86: Chapter 15Metadata (and Automatic C
- Page 87 and 88: {site url}{site description}en-usCo
- Page 89 and 90: drawing on the intermodule API that
- Page 91 and 92: At this point you have something of
- Page 93 and 94: • description• URL for a photo
- Page 95 and 96: Here's a raw SOAP request/response
- Page 97 and 98: Chapter 14Distributed Computing wit
- Page 99 and 100: conduct programmer job interviews h
- Page 101 and 102: Most admin pages can be excluded fr
- Page 103 and 104: content that should distinguish one
- Page 105 and 106: Chapter 13Planning ReduxA lot has c
- Page 107 and 108: the Internet-specific problem of no
- Page 109 and 110: wouldn't see these dirty tricks unl
- Page 111 and 112: 12.8 Exercise 4: Big BrotherGeneral
- Page 113 and 114: than one call to contains in the sa
- Page 115 and 116: A third argument against the split
- Page 117 and 118: way 1 1/16One might argue that this
- Page 119 and 120: absquatulate 612bedizen 36, 9211cry
- Page 121 and 122: What if the user typed multiple wor
- Page 123 and 124: Chapter 12S E A R C HRecall from th
- Page 125 and 126: long as it is much easier to remove
- Page 127 and 128: features that are helpful? What fea
- Page 129 and 130:
made it in 1938)? Upon reflection,
- Page 131 and 132:
environment, we identify users by t
- Page 133 and 134:
those updates by no more than 1 min
- Page 135 and 136:
Balancer and mod_backhand, a load b
- Page 137 and 138:
translation had elapsed--the site w
- Page 139 and 140:
It seems reasonable to expect that
- Page 141 and 142:
11.1.5 Transport-Layer EncryptionWh
- Page 143 and 144:
such as ticket bookings would colla
- Page 145 and 146:
give their site a unique look and f
- Page 147 and 148:
It isn't challenging to throw hardw
- Page 149 and 150:
Chapter 11Scaling GracefullyLet's l
- Page 151 and 152:
10.15 Beyond VoiceXML: Conversation
- Page 153 and 154:
Consider that if you're authenticat
- Page 155 and 156:
In this example, we:194• ask the
- Page 157 and 158:
As in any XML document, every openi
- Page 159 and 160:
(http://www.voicegenie.com). These
- Page 161 and 162:
Chapter 10Voice (VoiceXML)questions
- Page 163 and 164:
9.15 MoreStandards information:•
- Page 165 and 166:
9.14 The FutureIn most countries th
- Page 167 and 168:
9.10 Exercise 7: Build a Pulse Page
- Page 169 and 170:
9.6 Keypad HyperlinksLet's look at
- Page 171 and 172:
text/xml,application/xml,applicatio
- Page 173 and 174:
Protocol (IP) routing, a standard H