Practical Algorithms - Yool, George
Practical Algorithms - Yool, George
Practical Algorithms - Yool, George
Third Edition
ISBN-13: 978-1500173456
ISBN-10: 1500173452
Contents
Unit 1―Analyzing Requirements
Objectives Communication Failures
Attitude Adjustments (Yours) Overcoming Fear
Steps to Successful Selling Analyzing Bus. Requirements
Customer & Manager (MCSD)
Perceptions Worksheet 1
Unit 2—Hardware & Software
Lesson 1—COMPUTERS Lesson 3—SOFTWARE
Objectives Objectives
Computers in General Operating Systems
Computer Types Major Software Types
System Unit Components Lesson 4 PURCHASING…
Motherboard Components Objectives
Lesson 2—HARDWARE System Source
Objectives Expandability
CPU (Central Processing Peripherals
Unit) Software
Other Major Computer Chips Worksheet 2
Secondary Storage
Input and Output
Expansion and Peripheral
Components
Unit 3—System Architectures
Objectives: Distributing Solutions (MCSD)
Tier Systems Architecture Operating Systems (MCSE &
Model (MCSD) A+)
Networking (A+, MCSD & old Worksheet 3
MCSE)
Unit 4—Logic
Objectives: Flowcharting Examples
Logic Basics Solving a Heuristic
Logic of Reality Refining the Heuristic
Solving a Median
Logical Syllogism Worksheet 4
(Presentation Approach)
Flowcharting
Unit 5—Programming & Coding
Objectives: Programming Process
Terminology Data Structures
System Development Life Control Structures
Cycle Worksheet 5
Purpose of Systems Logic
Unit 6—Problem Solving
Objectives: Applying the Paradigm
RAM Model Graph Problems
Problem Solving With Worksheet 6
Reasoning
Unit 7―Database Design
Communication Failures
Distractions Remove all potential distractions. This can
perhaps be most difficult in an adult classroom
where the students have to attend because their
boss said so. Many take this as the opportunity
to catch up on gossip. Decrease the distance
between you and your audience, turn off fans
and other noise sources if necessary, say
something condescending toward yourself that is
funny, and if necessary recommend people
separate and work with others without scolding.
For example, "I think you three would do much
better closer to the podium so I could help you
more." Another technique is to keep talking
about the topic (not the distraction) as you
approach them, and be sure that you direct
everything you say at them. Ask them questions
about the topic on hand. Inevitably they will
notice they are being singled out.
Concision Get to the point. If somebody wants to go into
detailed story telling, let it be the customer. If
you are doing extensive story telling, then the
customer perceives you wasted their time. If,
however, you are the audience to their stories,
you are their best friend. That is where you want
to be.
Motivating Motivating is a matter of identifying the needs
and desires of the individual or group then
exploiting those needs and desires. Maslow's
Hierarchy of Needs from most important to least
are: Physical, Safety, Belongingness, Esteem,
Self-Actualization. If you can help fill a need
inexpensively you can easily purchase your
customer's wallet.
Controlling the Some individuals are control freaks. They will
Conversation dominate the communication by talking too much
or asking nonsensical questions. Remember the
person asking questions is in control, so guide
the conversation with questions and repeating
back the needs and desires you identify. Those
who talk too much need an audience. For such
individuals take control by asking closed
questions (they require single word answers like
yes or no). For those who speak too little, ask
more open ended questions then ask even more
questions regarding their responses to get the
necessary depth. If the customer is paying you
by the hour and talks to you the whole time, it is
their money, so pay attention and be sure to
accomplish something during the conversation.
No doubt, they are used to accomplishing
dreadfully little in a lot of time, so if you
accomplish something they will fill accomplished.
General Tech talk and the ability to follow directions are
Comprehension major barriers. With most physical product
sales, language is seldom a major issue as the
customer has an idea what they are interested in
and you can follow their body language.
Services, on the other hand, require at least
some ability to communicate in a common
language. Some individuals are completely
incapable of following sequential directions.
These individuals need to be provided controlled
physical experiences to learn from and the
assurance that they cannot do anything any
harm. Technical jargon must be avoided unless
the customer exhibits a clear understanding.
Even then, each time you use a technical term,
immediately supply a definition that any human
can physically understand. If you can't, then
don't use the term.
Strong All strong emotions are barriers except
Emotions enthusiasm for what you are talking about. They
may have other concerns you must smoke out
with questions. If the concerns may be personal
you may pull them aside, tell them what you
perceive and ask if there is anything you can do.
If they are angry do not take it personally. They
have probably had the run-around and are mad
at the situation in general. Empathize by
listening to their woes and avoiding the pitfalls
they encountered previously. If all else fails,
assure them you will get to the bottom of the
matter, even if that means taking the problem
personally and tracking down the one person on
the planet who can solve the problem. People
do not want to get bounced around, and will be
immensely happy if you can be the ultimate
person to resolve their problem.
Negativity Use action verbiage like: Right!! Great!! Please
(yours) follow me... Why would you say that? Wouldn't
you agree? Look at this... Sound good to you?
Let me show you... What I would like to do... I
understand, however...
Overcoming Objections
Objections are the obstacles between purchasing and not
purchasing. A customer will always buy what they need, so do not
count on being able to fill wants too. The five sequential steps to
overcoming objections are:
1. Smoke out the objection (by asking questions about what is
the obstacle and why?)
2. Identify the objection (listen to their answers)
3. Repeat the objection exactly as stated (or at least concisely)
4. Isolate the object (dissect it into its parts to find the absolute
root of the problem and identify the quality you must meet)
5. Answer the objection (overcome it by meeting the necessary
quality or minimizing it)
Useful Tips
Always assume the sale Start transferring mental
Smoke out intentions ownership
Start building value in Create desire for
your product ownership
Create a sense of urgency
In dealing with objections:
Never Always
Give one objection too much Test the validity of the objection
power
Take an objection personally Remind yourself it is not about
you personally
Make verbal proposal or Write down proposed solutions
solution without writing and summarize your efforts in
particulars down terms of values and benefits
Abandon negotiations because Use the objection as a focal
of an objection point for reaching an agreement
Confuse the person with the Address the objection without
objection making it about the buyer (e.g.
without blame)
Let yourself be convinced the Test the objection for its
objection will prevent the sale influence and validity in the
process
Put the buyer in a non- Leave it open for the buyer to
reversible position (corner make a decision ("If you aren't
them) happy then I don't expect you to
do business here.")
Let objections get your spirit Keep your attitude and
down appearance up (e.g. smile) no
matter what
Totally ignore an objection Show empathy and
understanding
Give in to an objection right Check the validity by asking for
away elaboration
Interrupt while they state their Listen and allow them to explain
objection themselves
Money Issues
Customers are more resistant to making a decision than parting with
money, so eliminate all other objections first. All costs are justified if:
The customer understands the costs of lesser products
The customer understands the values and benefits of the
product
The customer perceives good service
The customer perceives timely professionalism
Time Issues
Scotty's Law says you should multiply all time estimates by four, then
provide the results in half the time. The factor of four guarantees the
task is accomplished and is functional without obvious errors. Take
twice as long to provide the results as your personal estimate just to
be sure it is correct. This also gives you time to run drafts past the
customer for approval. Scotty's Law must sometimes be expanded,
and most notably with applications development, such as web
design, database design, graphics design, etc. Those who have
worked in these fields know that most projects can be completed
over night.
It is hard to justify charging $30,000 for a database design you did in
six hours if the customer knows you took six hours. These projects
may be quick for a developer, but you should sit on the project and
run test data through it over a period of months before you ask for
such a large dollar amount. If they need a quick patch to get by,
charge a lot by all means, then take your time delivering the rest.
This may seem like a big lie, but in reality there are good reasons for
taking your time with development. Often, in primary research, I find
it wise to walk away for months or even years, then double back to
see if the logic still works and provides the expected results. During
the waiting period you must be creative and think about anything that
could possibly break the system you devised. You should also think
of ways it can be made more concise, or provide extra useful
features. DO NOT SHOW A COMPLETE WORKING MODEL
UNTIL CLOSE TO THE END OF THE DELIVERY PERIOD! Even
then, try to only show parts. It is too easy for the customer to try and
rush something that really should be taken slowly and carefully. The
more time you have with the development, the less likely it is to
break and the more satisfied your customer will be. Instant delivery
usually results in thoughts like, "If you could do it that fast, it must be
real easy so maybe I should get a book and do it myself." That is
not good for business. If they try this, they will be going to someone
else to fix what they messed up, and I can almost guarantee they
will.
Overcoming Fear
The largest obstacle between the user and understanding is fear.
Fear results from our sense of boundaries, and is useful to our sense
of safety. We learn to build boundaries by borrowing those of our
elders as we grow up. Boundaries get stronger with age because
what could take years to build can be destroyed in seconds, so we
get "gun shy." I like to use the following discussion with new users to
help destroy their boundaries. Consider the discussion and stories
carefully as they may prove helpful. Fear and boundaries are a
direct function of age and an inverse function of knowledge. The
greater the age, the greater the fear and boundaries. The greater
the understanding, the lower the fear and boundaries.
Elements of Human Nature
The elements of human nature describe not only our purpose here,
but the entire nature of Primo Levi's book: The Periodic Table
(translated from Il Sistema Periodico). We cannot explore all the
elements of human nature, but will place particular emphasis on our
sense of boundaries, their source, the ways they create fear in us,
and how this affects both learning and interfacing with technology.
To accomplish this we will examine two brief stories: Blade Runner
(based on the movie by Ridley Scott and the book entitled Do
Androids Dream of Electric Sheep? by Phillip K. Dick) and Titanium
(from Primo Levi's book The Periodic Table). It is easy to think these
stories balance the past with the future, but both have timeless
messages regarding human nature that concern us here.
Blade Runner is science fiction that comes close to home not only in
dates but also in the current advances and capabilities of
technology. Some readers mistakenly are drawn literally into the
images based on beliefs and religion without realizing the underlying
meanings. The images themselves are easily applied to any religion
or conception of human symbolism. Deckard is an anti-hero whose
transformation is overcome by what he fears the most: the
technology he is intended to destroy. Not only does he find the
technology is not to be feared, he discovers himself and inner
happiness. There are some factors of the original story omitted from
our reading. For example, Rachel is a replicant whom Deckard has
innocently fallen in love with before being ordered to destroy her.
The movie and book are both overflowing with rich imagery which
could not possibly be fit in this short space.
Titanium is an adorable little story until you realize the context in
which it is told. Primo Levi survived the Nazi prison camps….
Usually that line is enough to send anyone back to the story because
all of a sudden it isn't just a story about a cute, curious little girl and a
painter. Suddenly it is a story about the deaths of millions of Jews,
Gypsies and homosexuals. Not only is it a story about this, but also
of hundreds of millions slaughtered throughout this century in other
mass-executions (Mao Tse Tung, Stalin, etc.). This story briefly
describes a small area of human nature in which we allow others to
construct and destroy our personal boundaries (e.g. values and
fears). In the background are countless images alluding to
totalitarianism, the number one source of unnecessary mass death:
controlling the way other people think. Some of these images
include: white (washing: and all from one can everything is painted!
e.g. propaganda), paper boat hat (ships were and remain the
primary instruments of military power). In spite of all the strange
things, Maria trusts the power of the circle. We all do. We all trust
the circles constructed for us by those we looked up to as children.
That is, until we realize them and our own power to escape and
explore on our own.
Why both stories? I have used these stories for several years to
teach these same concepts to students in a wide range of fields.
Sometimes one story works better than another. Other times both
are needed. What determines this is the audience. For this reason
the last part of the Windows project is to respond and describe which
story best achieves the objectives (overcoming personal fears and
boundaries) for you and why. Everyone has fear to one degree or
another. Most people have an initial fear of technology because they
do not understand. They fear hurting something because their
parents always told them "Don't force it! You'll break it!" The most
breakable items on a computer are either replaced cheaply or, in the
case of software, easily reinstalled. If you lose information, figure
out why, go back and make sure it doesn't happen again. When we
realize technology is a tool and we are the masters, then we have
the courage to make our servant technology work for us.
Blade Runner
In 1492 a dream began-a dream of prosperity in a far away land,
a land we now call America. For many, prosperity meant material
wealth and power. It is 2017. Millions scramble and work for the so-
called American dream, in the city of the angels: Los Angeles.
Monolithic buildings rise above the street markets, a testament to the
success of a few overlooking the many, the struggling. Billboards
remind the masses that there is a better place, a place off world-and
this is a hell to be risen up from. So desperate and wanton of
material, of rising up in success, these so-called humans have
perfected their art: the creation of cybernetic slaves called
replicants. Their motto: to build replicants "more human than
human." In their zeal they succeeded.
Realizing their success, they give replicants a shortened life-four
years-and a death sentence for acclimating with the "humans" of
Earth: issued by bounty hunters called "blade runners." Deckard is a
blade runner. He "retires" replicants seeking the ultimate American
dream: humanity. Deckard does not like his job-he feels like he is
killing "people" not mindless androids. Little does Deckard realize,
but his emotion-sense is very accurate. The replicants, in their
abbreviated lives, are forced to live, forced to love and appreciate
life, where humans take their long lives for granted. The replicants
have become more human than the humans.
Today pilgrimages are made to churches, temples and other holy
places. The hope: to someday meet the maker-God. Why? To
receive eternal life and the answers to the questions: where do I
come from? why am I here? where am I going? when? Roy Batty is
a religious pilgrim, and his "God," Tyrell, is in Los Angeles. Roy's
crime: he is a replicant. Roy is Tyrell's "prodigal son," the
embodiment of being "more human than human."
Deckard becomes an unwitting student of Roy's humanity.
Deckard has no aspirations and no faith. Deckard lives one day at a
time, from one bottle of alcohol to the next-knowing no love for
himself or anyone else; without compassion. He drowns the moral
dilemma of killing a replicant with liquor, a coward running from his
own humanity. Goff, an omniscient-insightful blade runner, makes a
paper chicken (origami) while Deckard searches Leon's apartment.
The chicken represents Deckard's cowardliness. Later, Goff makes
a matchstick man, as with the manikins this symbolizes Deckard's
falsity, an empty man, a man without a life nor a soul.
Deckard is asleep at the wheel of life-his eyes do not see. Roy
does see. He says, "If you could see through your eyes what I can
see through mine. . . . " Roy is a prophet, leading his people to the
land of salvation, the promise land, a Messiah of the replicants. To
this end he sacrifices himself and repents: this is Roy's "great moral
idea," cementing replicants into a "solid union" of humanity. He
aspires "to eternal aims:" "absolute gladness" in being human. Roy
sees humanity, and repents his birth-sin, being born a replicant, in
the image of Christ-driving a nail through his palm.
As the story reaches its climax it is easy to believe that the final
conflict is between Deckard and Roy. Deckard is really confronting
himself. He runs-not from Roy but himself. Deckard is still a
coward, still blind to the reality confronting him, still blind to being
human. Deckard leads an unexamined life-guilty of a wasted life.
Roy, the prophet replicant, is a mirror to Deckard's soul. Roy does
not intend to kill Deckard. Roy is ultimately human-compassionate
enough to give life to the man who has opposed him, killed his
friends, killed his lover, who would kill him as well. Roy seeks
forgiveness, with room enough in his heart to forgive Deckard.
As Deckard runs frantically from Roy, he makes a giant leap-a
leap for life. As before, Deckard does not have the strength to
complete the leap--Roy does. As Deckard hangs, clinging to the life
he does not have, Roy gives his prophetic hand, raising Deckard
from lifelessness. Roy says, "Quite an experience to live in fear.
That is what it is like to be a slave." Roy's words are filled with
meaning, very deep. Deckard has been a coward, living in fear of
himself. His fear is like a child's fear of "closet monsters"-absent of
realism. Deckard is a slave to his fear. Where children fear sleep,
fearing the "monsters" will come and devour them, Deckard fears
life-being consumed in his own reality.
Roy sets a confused Deckard on the rooftop sanctuary. Deckard
is powerless against Roy's humanity. Roy knows the value of life-
giving it to Deckard. Roy's final achievement is absolute gladness in
death-appreciating his own significance when he says, "All those
moments will be lost in time like tears in rain. Time to die." Roy got
what he came for: a soul. Roy releases a white dove-a symbol of
peace and serenity in the hell where the angels have fallen. His last
moments are harmonious: a poet in words and kind, baring his soul
before God and Deckard. Roy's arms, forming a cross, continue his
Christian theme, his messianic character.
Deckard watches with awe as the most human Roy dies.
Deckard has undergone a profound transformation from the
esthetical to the ethical. Only now can Deckard appreciate Goff's
words: "It's too bad she won't live . . . but then again, who does?"
Life is precious-not to be wasted in the bottom of a bottle. He loves
life. He loves himself. He loves Rachel. He is no longer a coward-
as Goff says, "You've done a man's job sir." An origami unicorn-the
fabled immortal horse who loved nymphs-presents an image of
purity, immortality and love. Everything has been dark, dismal, a hell
on Earth. Now, Deckard is ready for the pure northern lands-a
heaven to live and love in.
Primo Levi's Titanium
To Felico Fantino
In the kitchen was a very tall man dressed in a way Maria had
never seen. On his head he wore a boat made out of a newspaper.
As he smoked a pipe, he was painting the pantry white.
It was incomprehensible how all that white could be contained in
so small a can. Maria had a great desire to go over and look inside
it. Every so often the man rested his pipe on the pantry shelf and
whistled. Then he stopped whistling and began singing. Every so
often he took two steps back and closed one eye, or he would go
spit in the garbage can and rub his mouth with the back of his hand.
In short, he did so many strange and new things. It was very
interesting to stay and watch him. When the pantry was white, he
picked up the pot and the newspapers up from the floor and carried
everything to the cupboard and began to paint that too.
The pantry was so shiny, clean, and white that it was almost
irresistible to touch it. Maria went up to the pantry, but the man
noticed and said, "Don't touch. You mustn't touch." Maria stopped in
amazement and asked, "Why?" "Because you shouldn't," he
replied. Maria thought about that, and then asked again, "Why is it
so white?" The man also thought for a while, as if the question
seemed difficult to him, and then said in a deep voice, "Because it is
titanium." The pipe in his mouth made his answer sound like "tee
tahl-ee-oh," which Maria interpreted as "ti taglio" meaning "I cut
you". Maria felt a delicious shiver of fear run through her, as when in
the fairy tale you get to the ogre; so she looked carefully and saw
that the man did not have knives either in his hand or near him: but
he could have one hidden. Then she asked, "Cut what on me?"--
and at this point he should have replied, "Cut your tongue." Instead,
he only said, "I'm not cutting anything: this is titanium."
Maria concluded that he must be a very powerful man. He did
not seem to get angry, but was rather good-natured and friendly.
Maria asked him, "Mister, what's your name?" He replied, "Felice."
He had not taken the pipe from his mouth, so Maria thought he said
alice (the i sounds like a long e) meaning small anchoves. And
when he spoke his pipe danced up and down but did not fall. Maria
stood for a while in silence, looking alternately at the man and the
pantry. She was not at all satisfied by his answer and wanted to ask
him why he had such a strange name, but then she did not dare
because she remembered that children must never ask why. Her
friend, a child, was called Alice and it was really strange that a big
man should have the same name. But little by little it began to seem
natural that he should be called Alice, and in fact she thought he
could not have been called anything else.
The painted pantry was so white that comparatively the rest of
the kitchen looked yellow and dirty. Maria decided there was nothing
wrong in going to look at it up close. Only look, without touching. As
she approached on tiptoe an unexpected and terrible thing
happened: the man turned and in two steps was beside her. He took
a piece of white chalk from his pocket and drew a circle on the floor
around Maria. Then he said, "You must stay in there." He struck a
match, lit his pipe, making many strange grimaces with his mouth,
and then continued painting the cupboard.
Maria sat on her heels and attentively considered the circle for a
long time. She became convinced that there was no way out. She
tried to rub it at one spot with her finger and saw that the chalk line
actually disappeared. She understood very well that the man would
not have regarded that system as valid. The circle was evidently
magical. Maria sat on the floor quietly, every so often she tried to
reach far enough to touch the circle with the tips of her feet and
leaned forward so far that she almost lost her balance. She soon
realized that there was still a good hand's breadth before she could
reach the pantry or wall with her fingers. So she just sat there and
watched as gradually the cupboard, chairs, and table also became
white and beautiful.
After a very long time the man put down his brush and paint pot
and took the newspaper boat off his head. Maria could see he had
hair like all other men. Then he went out by the balcony and Maria
heard him rummaging around and tramping up and down in the next
room. Maria began to call, "Mister!" ―first in a low voice, then
louder, but not too loud because at the bottom she was afraid that
the man might hear.
Finally the man returned to the kitchen. Maria asked, "Mister,
can I come out now?" The man looked down at Maria in the circle,
laughed loudly, and said many things that were incomprehensible,
but he didn't seem angry. At last he said, "Yes, of course, now you
can come out." Maria looked at him perplexed and did not move.
Then the man picked up a rag and wiped away the circle very
carefully, to undo the enchantment. When the circle had
disappeared, Maria got up and left, skipping and feeling very happy
and satisfied.
Computers in General
Data Types
Data types are typically divided into text, graphics, audio and video,
but would include other forms of output when robotics is involved or
other physical operations like printing. Data is stored using binary
codes (on/off or 1/0 switches) called bits in bundles called bytes.
The smallest byte consists of eight bits. All bytes and storage
capacities are divisible by eight. Windows 95 uses a 16-bit bundle
per byte, while Windows 98 uses a 32-bit bundle per byte. The
advantage of large byte bundles is the ability to store a wider variety
of information in greater detail in less space (e.g. graphics). The
computer only understands binary bundles, so all information given
to the computer is converted into binary, and all output must be
interpreted from binary to provide useful information to the user.
Storage
Primary (internal) storage (memory) temporarily holds information
(input, software, and output), while secondary (external) storage
stores the information for later sessions of use. Secondary storage
is typically built into systems (e.g. the disk drives). The primary
storage in a computer is the RAM. When the computer does not
have enough RAM to store all the information being processes,
Windows 95 and above will create swap files, which are temporary
files, on the hard drive to make up for the deficiency.
As we discussed previously, data is stored in binary. Both primary
and secondary storage are measured in the number of bytes they
can contain. A kilobyte (Kb) is one thousand bytes (more accurately
1,024 bytes) of information. A megabyte (Mb) is a million bytes
(more accurately, 1,024,000) bytes of information. A gigabyte (Gb)
is a billion bytes of information. As you may have noted, the actual
quantities are slightly higher. The reason is these are also divisible
by eight.
Conventional RAM ranges from 32 Mb (minimum) to 258 Mb and
beyond. Although 32 Mb is adequate, 64 Mb is practical for most
general use. Typically more RAM is not necessary unless the
computer is used for heavy graphics or otherwise is expected to
process extremely large amounts of information. AltaVista’s on-line
computers, for example, run several Gb of RAM to support their
enormous database. Computer purchasers should also be attentive
to Shared RAM. Some computers will designate some of the RAM
to video and audio, hence sharing the RAM. Others will use
accelerator cards with their own built-in memory, which should be
preferred but is not necessary unless you expect to do a lot of
graphics, video games or otherwise process large amounts of data.
There are a variety of RAM types, most popular of which at present
is PC100. The type specifies the type of BUS (see Motherboard
Components below) necessary to attach the RAM board to the
motherboard. In the case of PC100, the 100 refers to the speed of
the memory in megahertz (100 MHz).
Secondary storage devices have a wide range of storage sizes. 3.5”
floppies store from 720 Kb (for DD) to 1.44 (for HD). CD ROMs
store 640 Mb (CD-RWs store up to 720 Mb). Hard (fixed) disk drives
currently range from 3.2 Gb to over 80 Gb. The typical user will not
currently need more than 6.4 Gb on a hard drive.
Hardware versus Software
Hardware is the physical equipment, while software consists of the
commands that makes the equipment perform actions. Hardware
consists of two major categories: the system unit and peripherals.
The system unit is the computer case and everything inside the
computer case. The actual computer is the CPU (discussed later),
while everything not in the CPU (including the motherboard) is
considered external to the computer, even if it is inside (internal to)
the system unit. Peripherals are everything that is plugged into and
is external to the system unit (e.g. mouse, keyboard, printer, monitor,
scanner, etc.)
A program is a set of instructions that tells the computer what actions
to perform and how to perform them. Applications software perform
tasks involving user input and outputting information in a useful
format for the user. System software enables applications software
to run on the system's hardware devices, also called the Operating
System.
Computer Types
General Use Microcomputers
Devices using microprocessor technology that perform computations
built into other devices such as calculators, clocks, stereos,
microwave ovens, cars, etc.
Microcomputers (PCs)
Computers constructed using microprocessor technology small
enough for common availability and use. Sizes range from palmtop
(handheld) to desktop. PC and Mac are hardware platforms whose
components are typically incompatible and require different
programs to operate.
Midrange Computers
Also called minicomputers, are often used as servers for networks
with too many users to fit the capabilities of a PC. These systems
may range from the size of a desktop to the size of a desk or large
filing cabinet.
Mainframes
A large computer, typically filling a room, used in large organizations
with large amounts of data and many network users. These handle
high volume jobs, such as billing for a large company.
Super Computers
Typically not as large as mainframes, but considerably more
powerful as they are capable of performing extensive computations
with extreme accuracy. These are often used in scientific
applications and computer animation for movies.
Cache
Later Pentium quality chips contain potentially two levels of cache.
Level 1 cache is integrated circuit in the CPU. Level 2 cache is on a
printed circuit board attached directly onto the CPU. Information
travels fastest within an integrated circuit (IC), then second fastest
over a printed circuit (PC board), third by ribbon cable to the IDE on
the motherboard, fourth by BUS (which connects two printed circuit
boards), and slowest by cable. The advantage of cache is a
reduction of processing time by reducing the necessity to go through
the motherboard, memory BUS, and memory board to the memory
(RAM) chip to get the next command. The less frequently this has to
occur, the faster the processor can work. A misleading point of
processors is their clock speed. While they may clock at a very high
speed they may actually run slow because they are waiting to
retrieve the next commands. Hence the cache and BUS speeds are
extremely important in accelerating operations. The AMD K3 and
Athelon chips both have Level 1 cache (128k and 512k
respectively). Naturally their processors are the fastest on the
current market. Both however are slowed to the lesser components,
and at the time of this writing, nothing is actually built to support the
200 MHz BUS speed capabilities of the Athelon, which is
disappointing.
Secondary Storage
This refers to components that provide permanent or semi-
permanent storage of information, such as the full variety of drives
(tape, CD, floppy, hard or fixed, zip, etc.). A drive is a piece of
equipment classified as a storage device that reads from and usually
writes to a storage unit.
Storage units are classifiable in many ways, many of which overlap.
Storage units may come in the form of tapes or disks; fixed or
removable; read-only, writable, or rewritable; magnetic, optical (CD)
or paper (e.g. teletype tape).
Magnetic disks are rewritable and may be either removable or fixed.
Most require formatting before use, which defines the way
information is stored onto the disk in what are called clusters (large
bundles of bytes). Clusters are bundled into a larger group called a
sector. The information is actually stored on tracks in binary form,
just as a phonograph record stores sound. A "hard disk" or "fixed
disk" is a high-density physical disk or group of disks within a hard
disk drive. These are typically the largest of the class of magnetic
disks, and typically central to the operations of the computer. The
computer uses this disk to store the operating system, program files,
and user-generated files. The only way to remove this disk is to
remove the drive itself. Floppy disks come in a variety of sizes and
two fundamental shapes. They are removable by the user with the
simple push of a button or the turning of a knob on the front of the
computer. Both floppy and fixed disks require formatting, and may
be formatted with a boot sector in which an operating system is
placed. The boot sector always occupies the same portion of a
disk. This portion of the disk also provides the formatting information
about the disk and is a common place for viruses to be stored.
Drives Fixed/Hard Other 5¼” Floppy Drive
Always Floppy (3½") Drives SuperDisk (3½" 120 MB)
Present CD ROM Available Readable/Writable CD ROM
(read-only in (common) (CD-R)
all multimedia Readable/Rewritable CD
computers) ROM (CD-RW)
Zip Drive
Tape Drive
Operating Systems
Each hardware component uses different machine language
instructions to operate. Drivers are used to tell the operating system
how to communicate with the components. The operating system
balances the communications between the user and the software
(the user interface) and between the software and available
hardware components. The operating system defines how
information is stored, where it is stored and how it is processed. The
operating system also provides common routines that are used by all
programs (e.g. the Open and Save As dialog boxes, all title bar and
most dialog box components, etc.)
Windows 95 is the first Windows version to be an operating system
for IBM's. Before Windows 95, PCs used DOS (Disk Operating
System) which is a textual user interface. Windows was run as an
application on top of DOS, which significantly slowed the system.
The first popular Windows version was 3.1. By the time Windows 95
arrived as a combined graphical user interface (GUI pronounced
goo-ee) and operating system, the MAC OS (also a GUI) had been
used nearly a decade. As a consequence, MAC cornered the
market in publishing and graphics design in the mid-80s, where it is
now losing ground to less expensive, and significantly more popular
PCs. By integrating windows and the operating system, programs
can run faster. Versions A and B of Windows 95 used a 16 bit
system to accommodate their use of graphics. Version C of
Windows 95 introduced the 32-bit system to accommodate more
colors. With 32 bits, a larger amount of data can be compressed
more meaningfully in a smaller space. Windows 98 introduced a 32-
bit File Allocation Table (FAT 32). Previously information was stored
in 32 bit clusters (two bytes per cluster). The FAT 32 uses 4 bit
clusters so files can be compressed much smaller (black and white
line art only needs four bits). FAT 32 also reduces the need for
partitioning larger drives. Equipment is already available to handle
64 bit processing, which will significantly improve 3-D graphics.
System Source
The source of your system is extremely important. It is wise to stick
to major name brands and to talk to a technician about which brands
are most reliable. Prices of personal computers make building your
own not cost effective unless you are building a high-end server and
really know what you are doing. Be skeptical of purchasing from any
manufacturer who uses substandard components.
MAC or PC?
Although Macintosh provided the first graphic user interface, their
systems are waning in flexibility, expandability and costs. As a rule
of thumb, be sure whatever you buy (software and hardware) is
compatible with your work and school needs (what they have).
Macintosh is a likely candidate when working with the publishing,
graphics design or music industries. Some schools still use
Macintosh. In any of these cases, verify the need before making
your purchase. Otherwise, PCs are a fraction the cost and provide
all the flexibility and expandability at low costs. Never purchase a
computer for its looks. Always base your decision on its capabilities
and expandability. Likewise, never get involved with uncommon
drives (Zip, Jazz, Superdisk, etc.) unless you have other computers
with the same drives. Backup drives are virtually pointless now
considering how inexpensive CD ROM RWs are (not to mention the
disks have a capacity of 720 MB, are also very inexpensive, and if
written properly can be read by any computer with a CD ROM which
means all Pentium class or better computers).
Advantages/Disadvantages of Manufactured
Advantages Disadvantages
1. All components and software 1. Limitations of
engineered together expandability
2. Usually good components 2. Proprietary
(reduces warranty repair costs) components
3. Restore disk returns computer to 3. Proprietary driver
factory settings difficulties
4. Warranty (one year) covers defects 4. Most restore
in components and workmanship disks format the
5. Technical support (limited) hard drive
6. Retail Technical Support 5. Technicians must
7. Major Software titles may be do all expansions
provided to not void
warranty
Note: many servers do not require major equipment and merely act
as share devices or firewalls (for modem sharing with a proxy server,
printer or database sharing). Often a lesser manufactured machine
is ideal for this use, so long as it has the capacity to hold the
necessary components (e.g. Ethernet, specialized modem, the data
and the system). It is also wise in an environment with many
computers to retain cohesion among the computers (all made by the
same manufacturer). It is particularly important in networks to be
consistent with all the components.
Advantages/Disadvantages of Custom Built
Advantages Disadvantages
1. You decide what 1. Lack of support
goes in the box 2. Lack of warranty
2. Great for building 3. Driver and IRQ
high-end servers difficulties
3. Great for building 4. No factory software
a throw-away 5. Costs more to build
system (e.g. dumb (never use cheap parts
terminal) cheaply as they will break)
On the note of cheap parts: this is particularly a problem with
motherboards, CPU fans and power supplies (AMD requires a better
fan and power supply). Never go cheap on any of these three
things. They will all result in unexplainable and not reproducible
errors, and even total system failure.
Expandability
The case the components are in and the motherboard will determine
the expandability of your machine. Beware of half bays (where
drives are docked) and multi-purpose cards. Many newer machines
now provide the speaker, modem and microphone components on
the motherboard. These are easy to disable independently. Multi-
purpose cards often require complete disabling, which causes the
card to be virtually useless. This would not be such a problem
except that most of these cards must be left in the machine for the
motherboard to continue functioning even after they are disabled.
Most component expansions you probably want to keep internal. At
present, DVD is perhaps better to leave external so you can plug the
drive into your television or any computer.
Peripherals
Be cautious about cheap peripherals. As a general rule, mid-priced
monitors, printers and scanners often have great quality and
reliability. Never aim low because you will be dissatisfied. The price
difference is minute, so spend the extra money. The most expensive
is not always best either. Nor are the best numbers. Numbers are
quite misleading. When purchasing a monitor, compare its visible
quality to others. Do not concern yourself with refresh rates (only
Sony seems kind enough to state theirs) or dot-pitch (often large dot-
pitch looks much better). Of printers, inkjets are great, but be sure
they are dual cartridge with Photo Ret (do not focus on dpi), that the
print heads are built into the cartridge, and compare cartridge costs.
Also examine how tolerant the printer is of a variety of paper types
and weights. If you plan to print greeting cards and envelopes you
may want a more expensive machine with a better carriage.
Printers
Printers come in a variety of forms with a variety of features. The
table below outlines printer types and printer features to look for
when making a purchase decision. Always be sure to check the
printer specifications and to purchase the correct cable for the
printer. Most printers do not come with a cable to connect to the
computer. If the printer does come with a cable the box will be
clearly marked.
Bubble Jet Bubble jets are small, top-feeding printers, the most
common of which are manufactured by Cannon.
These are typically fast with good quality, and
convenient when paired with a laptop because you
can fit both the laptop and a small bubble jet in a
brief case with your paper.
Bursting For printers that feed a continuous perforated sheet,
pages must be separated at the perforations and
edges with holes used to feed the paper must be
torn off (burst) at their perforations.
Character Character printers are like most typewriters,
Printers physically striking a ribbon to imprint on the page.
Both character and dot matrix printers are impact
printers.
Dot Matrix An impact printer that uses pins to form the shapes,
which are then physically impacted against the
ribbon onto the page.
dpi A generalized term used with scanners, printers and
monitors to describe the resolution in number of
dots per inch. As with a monitor, dpi refers to the
number of dots used to present the output. With the
exception of laser and character printers, all printers
rely on applying tiny dots on the page to draw what
is being printed. With the exception of Photo RET,
the higher the dpi the better. Be aware also that
other factors affect print quality.
IEEE Cable Also called twisted pair, but not to be confused with
computer connectivity whose cables have both
parallel and serial plugs on both ends. This cable
plugs in through the parallel port on your system
unit then to your printer. It is used for high speed
printers like Laser printers. On the surface it is
thicker than normal parallel cable. The reason is
that each wire in the cable is wrapped in aluminum
foil on top of the usual insulation. The foil prevents
cross talk, which is when wires in close proximity to
each other share information they shouldn’t,
causing information loss and garbled
communications.
Ink Ink cartridges come in a wide variety to include
Cartridges solids, powders, liquids, solids with liquid reservoirs,
wax-based, water-based, etc. Some come with
built-in print heads, while others attach directly to a
permanent print head and yet others attach to a
print head changed with alternating cartridges. If at
all possible, show preference for cartridges with
built-in print heads. This typically prevents most
print head problems. When these cartridges are
installed, they often require aligning, which is an
utility provided with your printer’s software.
Ink Jet Ink Jets, through one means or another, squirt ink
onto the page. Some ink jets are splotchy, no
matter how eloquent their claims about their dots. If
necessary you might take a magnifying glass with
you to examine print qualities closely. Hewlett
Packard manufactures the most consistent and
highest quality ink jets. Many graphics artists also
use Epson ink jets for their wide carriage prints
because they are cost efficient for that kind of work.
A major difference between the manufacturers is
how they feed paper. If you plan to do a lot of
heavy bond paper, wide carriage paper, or
envelopes you are better off with a top feeding
Epson or a high-end (800 series or above) Hewlett
Packard. The lesser Hewlett Packard’s can do the
job but have weaker carriages making them prone
to breakage with heavy use.
Laser or For high-speed letter quality printing, laser printers
Thermal are ideal. While they are more costly up-front than
Printers an ink jet, and their cartridges seem to cost more,
the toner cartridges last longer and you can easily
use copy paper. Laser printers are good for heavy
bond papers and envelopes. Color laser printers
are rare and extremely expensive, as are laser
printers with multiple trays (typically used for
different paper sizes. As a rule, laser printers are
limited for printing on large paper sizes (above 8.5
X 14). Both Hewlett Packard and Brother currently
provide excellent laser printers.
Line Printers Line printers are typically dot matrix, feeding
through a continuous sheet of paper which requires
bursting. These are popular in industry, especially
for billing and receipts because the are inexpensive
to operate and maintain, and are fairly fast. These
printers do not, however, produce letter quality
printing so lack application elsewhere. Epson is
notable for its line printers.
Multi- A number of ink jet printers can also scan
Function documents, fax and make copies. Look closely at
Printers the design of the machine to make sure it fits your
needs. Look to see if the scanner is flat, especially
if you might scan items that are not normal paper
sizes or may rough from age or storage. The sheet-
feeding scanners are nice (and more expensive),
but it is easy to forget you are using a printer for
making copies and run your cartridge bill up. If
these are not concerns, you may go cheaper with a
top-feeding scanner. Some printer-fax machines
also have a keypad for manually dialing. This is
nice because then you do not need to turn on the
computer to send and receive faxes.
Paper We think we know about paper until we interface
with the printing industry. The most forgiving
printers are Hewlett Packards, which will put out
amazing quality on the worst paper (e.g. copy
paper). For high-quality print jobs with any printer
be mindful of your paper choices. If you are printing
on a glossy surface with an ink jet it is also wise to
adjust the printer properties before conducting the
print, and identify the type of paper you are using.
Some print jobs may require extra time for drying to
prevent them from smearing as the page continues
to be fed through the printer.
Paper Trays As we noted earlier, ink jets either feed through the
back on top or through the front on the bottom. In
either case the finished product appears face up in
the tray in front. Be sure to examine how wide the
tray is, how adjustable it is, and whether it is
removable. The more adjustable and wider the
better, especially if you do print jobs larger than 8.5
X 11. Most Hewlett Packards provide 8.5” wide,
adjustable for envelopes and for long banners. To
get a wider carriage you can either divide the print
job across several pages (HP provides software for
this), get a more expensive HP, or save money and
buy an Epson.
Photo-RET A color printer with Photo-RET should always be
preferred over a printer that brags only dpi. Printers
without Photo-RET place dots next to each to give
the illusion of colors. Photo-RET layers transparent
colors on top of each other sixteen deep to get true
color per dot.
Printer Printer cables are almost never provided with the
Cable printer. Most printers use either Parallel or USB
cables. Some take both, and some only take IEEE.
Be sure when purchasing a printer to check the box
to see what kind of cable to purchase, and also on
the off-chance that a cable is provided (which only
seems to occur with very expensive printers.
Resolution Resolution has many factors. For color graphics
the greatest concern is the quality of the color per
dot (e.g. Photo-RET), while non-color graphics (line
art) are dependent on dpi. Publishers want “letter
quality” which is dark and looks solid (as opposed to
the grainy look of a dot matrix) and is easily
achieved by setting ink jet or laser printer qualities
to high (as opposed to economy, draft, or medium).
Scanners
Scanners come in a wider variety of forms than might be expected.
Prices of flat bed scanners have plummeted making them as
accessible as keyboards, though certainly more space consuming.
The table below outlines the types of scanners available and
scanner features to look for.
dpi For flat bed scanners, 1200 dpi is ideal. The file
size is manageable and the quality is ideal. In
reality, most scan jobs will not be able to use more
than 1200 dpi because the image being scanned
doesn’t have a better resolution. If you scan at a
resolution higher than the original, then the scanner
programming is adding dots that were not there. If
you are scanning slides or film, then 9600 dpi is
more appropriate for that particular job.
Film This is a rare but useful item. Do not be misled,
however, as the film must first be processed.
These scanners are small and specialized (not to
mention expensive), capable of taking a processed
roll of 35 mm film and scanning in the pictures.
Flat Bed Most scanners are flat bed, capable of scanning
Scanners text, graphics and pictures. Flat bed scanners are
the easiest to work with because they allow the
user to manage what is being scanned. A limited
number of flat bed scanners are available with
sheet-feeders. Many now come with buttons to
initiate a scan job and send that job to a particular
function of your computer, like to e-mail.
OCR Object Character Recognition is now popular
software provided with most scanners. OCR
distinguishes between characters and graphics on
a scanned image and will send that information to
another program (like Word) for editing. This is
extremely convenient, keeps file sizes much
smaller and gives the user control over the
scanned images. The technology has improved,
but it is still difficult to get accurate readings on
copies of copies.
Resolution See dpi this section.
Single Pass Some scanners still make three passes, one for
each primary color. If at all possible avoid this
attribute and get a single pass scanner. Not only
does the quality seem better, you save an
enormous amount of scanning time.
Slides Some flat bed scanners are or can be adapted to
(35mm) take 35 mm slides. The slide scanner produced by
HP also scans negatives and small pictures.
Again, this is a specialized and expensive
commodity.
Monitors
Although monitors are fairly simple, there are still many things to
watch out for when making your purchase decision. Monitor size is
not always indicative of display size. It appears the present market
has two types of good monitors: extremely expensive like the
Mitsubishi or almost cheap like the Acer. The Mitsubishi has
stunning (write letters to everyone you know) quality while the Acer
(notably the 17”( has excellent quality at a fraction the price.
Active Matrix For flat screens, the active matrix is unbeatable
because it refreshes only the parts of the screen
that have changed. This makes tracking motion
(like movement of the mouse) easy. These are also
better in a wider range of lighting situations than
other flat screens.
CRT Cathode Ray Tube: the standard monitor we are all
used to seeing attached to a PC. These consist of
a tube just like a television, but do not have the
same resolution and refresh rates as a television.
You can use a television as a monitor, but you will
be disappointed and even more so about the cost of
the adapter. CRTs may also be plugged into
laptops as an auxiliary display device.
Flat Color On laptops these are adequate, though they are a
little limited in bright light situations and are harder
to see at angles. For regular PCs these are
extremely costly and disappointing if you expect
high resolution. If all you need is to save desk
space and can afford to pay four times as much
then a flat screen may work for you and your PC.
LCD The old liquid crystal displays worked well in
medium lighting and a text-driven environment with
little power consumption. Today they are limited to
palm-tops and calculators.
Refresh The speed at which the information on the screen is
replaced. For all but active matrix this means the
entire screen. The only manufacturer I have seen
who openly reveals their refresh rates is Sony. The
refresh rate is not everything though.
Restore This is typically not a monitor term but deserves
particular attention here. When you change the
resolutions settings of windows you will see the
picture flash and show the new resolution. Most
monitors will make a popping sound, as if a relay is
switching physically within the monitor. Very few do
not make the popping sound. Having observed this
on a number of occasions, it appears a wise test of
any monitor to change its resolution a few times and
see how it reacts. The ones that make the popping
sound are prone to failure. Some will even fail after
just a few resolution changes. It appears these
monitors use old-fashioned relays, while the
survivors (those that do not pop) use an integrated
circuit, which is more durable and less drastic.
Resolution Resolution is measured in the distance between the
dots on your screen, called dot-pitch. As with so
many of the factors regarding monitors, the
numbers can be misleading.
Software
If you have all your own software in full version, then software is not
an issue. Otherwise it is important to see what software titles are
available on the computer you purchase. Even if the software is not
major, it may be up-gradable into something that is. For example,
basic Works is expandable to Works 99 with Word 97. You can then
use an Office upgrade rather than a full-version and save hundreds
of dollars. Other than the productivity software, encyclopedias,
games, etc. are fairly cheap, so do not place too much emphasis on
them in making your purchase decision. If you plan to play fancy 3-
D games, expect to spend money putting a 3-D Accelerator Card in
your computer. Nothing less will do.
Worksheet 2—Hardware & Software
Unit 3—System Architectures
Objectives:
Students will understand:
1. Tier Systems Architecture 4. Operating System Functions
Model (MCSD) (MCSE & A+)
2. Networking (A+, MCSD & 5. Client/Server Architecture
old MCSE) (MCSD)
3. Distributing Solutions 6. Use Case Solutions (MCSD)
(MCSD)
1 2
4
3
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
In Windows 2000, with Active Directory’s NAT (Network Address
Translation) system, local (unregistered) IP addresses can be arranged
as follows: 10.{0-255}.{0-255}.{1-255} or 172.16.{0-255}.{1-255} or
192.168. {0-255}.{1-255}. Note NAT runs as either a DHCP or DNS
server (for name resolution) or both, but cannot be used for Internet
addressing. A registered IP address is necessary for the NAT Windows
server to have shared connection with the Internet.
User mode is the area where most end-user applications reside. This
helps maintain system stability as the kernel protects the main body
of the operating system and insures the operating system retains
control of the hardware. This is why application failure is not normally
terminal in Windows, but when a hardware device driver fails the
system becomes unstable and should be rebooted (cold is always
best to insure complete reallocation of resources). The easiest
source of these failures is through the I/O and Window managers
because they span the Network and Data Link layers and have a lot
to do for user mode applications. Kernel mode is considered "highly
privileged" and you must be mindful of its weaknesses.
Worksheet 3—System Architectures
Unit 4—Logic
Objectives:
Students will understand:
1. Logic Basics 3. Flowcharting
2. Logic of Reality 4. Logical Syllogism
Logic Basics
Set Theory
Aggregate Symbols
Symbols are used to contain, always indicating the contents should be treated as a unit.
Parentheses Most common symbol for algebraic grouping. For example 2*3+4=10
while 2*(3+4)=14. In mapping/graphing parentheses commonly indicate open (not on
()
minima or maxima) coordinates like (x, y). Parentheses are also commonly used in
the declaration of a class in programming, like SortClass().
Brackets typically used in mathematics to better show a coordinate as closed (on
[]
maxima or minima).
Braces often used to illustrate a set. In programming these often surround groups
{}
of code, like the body of an IF statement, or the code within a class.
Graphing
Edge A line connecting two vertices (a vertex pair); denoted with an E. On a
polyhedron the number of edges enclosing a single face is denoted with an
S.
Face An area outlined by edges; denoted with an F. Graphs illustrating the
shortest route traveled among points without intersecting the same point
twice do not have enclosed faces unless the traveler returns to the point of
origin or a “hub” is used.
Graph An illustration of a group of related vertices or “points.”
Line An infinite series of adjoined points defining a length or arc.
Point A location in space typically defined by coordinates, e.g. (x, y), (x, y, z), or
( , ). When applied to a polygon or polyhedron, points are typically given
for vertices. In mathematics a point has no dimension in itself.
Polygon The geometric, two-dimensional shape resulting from connecting vertices.
Polyhedron The topological, three-dimensional shape resulting from connecting vertices.
Vertice A point in space that may be connected to other points by two or more lines;
denoted with a V.
Elements of Argument
Introduction
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
Flowcharting
Symbols
Flowcharts are graphical representations of step-by-step processes describing how to perform
a specific function. This table illustrates the symbols and their meanings.
A brief note to
Another process
help the reader
that provides the
Alternate understand a
same results as Annotation
Process chart item or
the primary
series of
process.
symbols better.
Typically used
Keeping a series together in
to make one
multiple copies (e.g. printing
process wait
the entire document for each
Collate Delay while another
copy rather than printing all
occurs (e.g.
copies of each page at the
waiting for water
same time).
to boil).
Decisions typically provide true and false choices which can be
Decision chained together for more complex decisions, which are shown by
having more than two extruding arrows.
Indicates data
Direct Any data stored on a fixed
being shown on
Access media such as RAM, Display
the CRT
Storage ROM, and Hard Disk.
(monitor).
Indicates a file (or
Magnetic
less typically but Data stored on
Document Disk
equally useful with floppy disk.
Storage
databases, a record).
To take a
sample (less
Indicates the
than the
direction the process
Directional population) of
is flowing. Note that Extract
Arrow information or
a double arrow is
separate
almost never used.
information into
multiple items.
Input and More typically used Internal Typically
Output for input than output Connector contains a letter
(due to other and appears at
available output least twice. The
symbols). Typically internal
this symbol contains connector
an input question. connects to or
more points
within a chart
(only one of
which will have
an arrow
pointing away
from it).
Data stored and used within the As the label
process. When used, always suggests, this
indicates the process is an is any
Internal Manual
object. Note: if the data is not operator/human
Storage Input
internal, then it should be executed event
identified as public with such as typing
indication as to the source. information.
As with the manual input, a
To combine
manual operation is
Manual multiple sources
performed by the operator Merge
Operation of information
and not by the program
into one item.
itself.
Off-chart
A group of related connections
files (or less contain a name,
Multiple Off-Chart
commonly a group typically the
Documents Connector
of related records in name of another
a data base). process
(object).
Used to
signify
Uses a stored (e.g. public)
parallel
process (such as from the
solutions
Main( ) object), perhaps
Or that may Predefined Process
indicating an off-chart
depend on
connection to a part of
the
another object.
information
provided.
Data stored on
Sequential tape or in a
Collecting input data
Preparation Data definable
in a useable format.
Storage sequence
(order).
Process Any operation Sort Puts data into a
where input is sequential order.
converted to Be sure to indicate if
output, such the sort is in reverse
as a order and, if
mathematical applicable, the
formula. criteria of the sort.
Raw data The point at which
Stored stored in the Summing the data from
Data specified Junction multiple sources is
manner. brought together.
All charts begin with a terminator. Charts that do not
Terminator
end in a terminator form endless loops.
Flowchart Creation
This illustration provides a simple example of how a flowchart provides the step-by-step how-to
process. To create a flowchart, follow the one below. Note: this chart requires that you have
some knowledge of the input, output, or manipulation method. If you have information about
the input or output, you must determine the method.
Flowcharting Examples
Boiling Water
Putting a Cap on a Pen
Solving a Heuristic
A heuristic is slightly different from an algorithm. Algorithms are
expected to provide exacting results. Heuristics are only expected to
give calculated guesses. Fundamentally they are identical on the
surface. Where they differ is the exactitude. When might you need
a heuristic? Consider the famous traveling salesman problem.
Basically the story goes this way: the salesman has N points to visit.
He wants to travel as little distance as possible, and preferably not
have to backtrack. What is his best route? If the salesman is a
machine, and the points don’t care either, you don’t have to worry
about how he feels about the points, or when they would like to see
him. In such a case you use an algorithm. Since the salesman and
the customers do care, you must devise a heuristic, which will not
necessarily work for other salesmen, nor will it work if someone new
moves into the neighborhood.
Polyhedron Problem
Polyhedrons are three-dimensional figures, such as cubes,
pyramids, spheres, etc. We will focus on polyhedrons constructed of
straight lines, particularly those known as the regular polyhedrons.
Our purpose is to learn a little more about both the regular
polyhedrons and others that are similar. Euler recognized that
polyhedrons have relationships between their faces, edges and
vertices (E=F+V-2) and identified five shapes as regular. There is
only one problem with Euler's model: it alone cannot be used to
prove or disprove the existence of other regular polyhedrons
because we must have two variables to calculate the third.
Polyhedron Solution
The solution must allow for the calculation of the other variables
based on only one of these, namely the number of faces. We must
add two variables: the number of sides on one face (S) and the
number of edges joining at each vertice (J). After further observation
we are able to expand our table as follows:
Name Faces Edges Vertices Sides Joints
(F) (E) (V) (S) (J)
Tetrahedron 4 6 4 3 3
Hexahedron 6 12 8 4 3
Octahedron 8 12 6 3 4
Dodecahedron 12 30 20 5 3
Icosahedron 20 30 12 3 5
We observe that E = .5FS and J=FS/V, and. These are important
because we can consider a polyhedron problem a graph problem.
As a graph problem we need to know what relationships the
significant points have. The significant points for a graph problem
are the number of vertices, not the number of faces. We humans
are most interested in the faces and finding all instances where our
attributes (F, E, V, S, J, etc.) are "legal." All instances of these
particular attributes must be positive, real integers.
Pseudocode to Find SIDES
Problem
Private Float variable = 360 /
Our problem comes in
Faces
two heuristic parts: a
single variable solution Private Integer i=0
Private Array a[3,2]
and a test to be sure our
IF variable ≠ integer and variable =
primary attributes remain
continuous decimal
positive, real integers.
The first heuristic is to NotPossible ( )
solve for S given only F IF variable ≠ integer
remove decimal from variable
(see pseudocode on
FOR i = 1 TO 3
right). In short the
Public Integer a[i,1] = (i + 2)
algorithm divides 360 by
the number of faces, Public Integer a[i,2] = 0
WHILE modulus of variable/(i
then finds all divisors of
+ 2) ≠ 0
3, 4, and 5 of the result.
a[i,2]++
Then the number of
instances are arranged variable /= (i+2)
IF variable ≠ 1 or 2
and the middle value (or
NotPossible ( )
one on the right) is the
Return RoundUp (Median ( ))
number of sides on one
face (S).
The second is to test all our variables to be sure they are valid. We
will expand the pseudocode for the Side problem to explain how you
might test for a continuous decimal and add a module to round
values up (not down!). We will develop a logical process ensuring
our system is not bogged down doing unnecessary calculations by
testing the attributes most likely to break first.
A Solution:
ComputeS (F)
*/ This counts the number of times 3, 4, & 5 may be
divided into N to generate a, b, & c./*
{
private double a=0;
private double b=0;
private double c=0;
private double d=360;
if d%F!=0
{
d=360000000;
if d%F!=0
{
return 0;
end;
}
}
else
{
N=d/F;
do
{
a=a++;
N=N/3;
}
while N%3==0;
do
{
b=b++;
N=N/4;
{
while N%4==0;
do
{
c=c++;
N=N/5;
{
while N%5==0;
}
if a+b+c==0 then return 0;
else if c>=a+b then S=5;
else a<=b+c?S=4:S=3;
endif;
return S;
}
}
Decimal (test)
{
private integer result2 = test;
return result2 == test ? 0 : 1;
}
DetermineE (F,S)
{
Private float E=.5FS
Decimal(test=E)==1?E=0:E=E;
return E;
}
DetermineV (F,S,E)
{
Private float V=E-F+2
Decimal(test=V)==1?V=0:V=V;
return V;
}
DetermineJ (F,S,V)
{
Private float J=FS/V
Decimal(test=J)==1?J=0:J=J;
return J;
}
MainTest (F)
Private Integer S=ComputeS(F);
If S!=0 then
{
E=DetermineE (F,S);
If!=0 then
Private Integer V=DetermineE (F,S);
If V!=0 then
If DetermineJ (F,S,V)!=0 then cout << “This one works: F = ” << F
Terminology
Term Definition
Applet Java scripts used in web documents that run in
the browser window.
Application Programs stored permanently on the computer
Software and used to tell the computer how to produce
information.
ASCII American Standard Code for Information
Interchange: the most widely used data coding
system primarily for mini-computers and PCs.
Assembly The first symbolic programming language. Is
Language hardware specific but much easier to write than
Machine Language. Must be converted into
machine language in order to work though, using
an Assembler.
The systematic way of exploring every possible
route, configuration or ordering of an arrangement
Backtracking
without repeating a path that was already
explored.
BASIC Beginner's All-Purpose Symbolic Instruction Code:
Developed in the 60s to be a simple, interactive,
problem-solving language that uses elementary
English words combined with some symbology.
Requires an interpreter to work (either built into
the system ROM as with old PCs or in a program).
C Programming language designed to create system
software, including applications and operating
systems. Most frequently used with UNIX.
C++ Object Oriented version of C used to develop
applications.
Class A large category of objects, wherein the category
helps define a characteristic shared by all the
members (objects) of the group (class).
COBOL Common Business Oriented Language: Widely
used programming language for business that
uses English-like commands.
Code Set by the American National Standards Institute
Standards to ensure programs are compatible with many
different computers.
Coding The process of translating and entering a process
into a programming language (code) on a
computer.
Compiler The program that converts the code of a program
into Machine Language.
Context Top-level diagram of data flow that only shows
Diagram major components of a process.
Control The instructions that control the order in which
Structure program instructions are executed.
Cooperative Method of managing multiple processes to insure
Multitasking they receive the information they need when they
need it, and deliver their output when it is needed
by other processes by switching between
processes until logical stopping points are reach.
Data The raw facts, including numbers, words, images,
and sounds given as input to be processed. Data
may be entered manually, embedded in the
program, or from other sources.
Decoding Translates instructions into processable
commands.
Divide and Process of breaking a large problem into smaller
Conquer problems, solving the smaller problems then
recombining the results to yield a solution to the
large problem.
Entity An object for which data is stored to define it.
Event The pressing of a key, clicking of the mouse
button, or other input impulse that provides data
prompting action or providing data for action in an
Object Oriented Program.
Executing Control unit operation that processes commands.
Flowchart A graphic representation of the logical flow of
information through specific processes resulting in
the desired output.
Fourth- A non-procedural language using English-like
Generation statements, that does not require being told how
Language to perform an action, only what actions to
perform. These programs are run within other
programs, such as HTML, and Macros.
Graphic User (GUI) User interface using visual clues to aid in
Interface inputting data.
Greedy A method which attempts to capture the first
Heuristic possible greatest thing.
A trial and error approach to problem resolution
Heuristic that may give a kind of solution with no guarantee
of success or accuracy.
Hierarchy A logical ordering of information into classes and
lesser subclasses inheriting the qualities of the
higher ranking classes directly above the item.
Hierarchy A top-down design tool graphically representing
Chart program modules.
If-then-else Structure that evaluates conditions to determine if
Control they are or are not true, and to take action
Structure accordingly.
Infinite Loop Instructions that repeat themselves indefinitely.
Information Data processed into meaningful and useful form.
Information The operations of input, process, output, storage.
Processing
Cycle
Inheritance The condition in which objects, including
subclasses, keep the methods and attributes of
objects and classes at higher levels of the
program's hierarchy.
Interpreter A process of converting command lines one at a
time into machine language and executing them.
Java Object-Oriented language very similar to C++, but
more compact and offering greater user security.
JavaScript Simpler form of Java that is not compiled and runs
directly in a web browser.
Language A program that converts programming instructions
Translator one at a time into binary code and immediately
executes them.
Machine The binary codes which a computer or device acts
Language upon. This is a hardware-specific language.
Module Section of a program dedicated to performing a
single function.
Object Any piece of information created with a Windows
program, which is linked or embedded in another
application. In OOP a unit in which both data and
procedure are packaged together. Objects are
like elevators: you get on as data, push a button
and are fed out as information on the desired
floor. The elevator contains the information
necessary to regulate its own processes initiated
by you, the event.
Object Code The machine language result of compiling a third-
generation program.
Object- Approach in which data and process are
Oriented packaged together.
Object- The event-driven programming language used to
Oriented implement the object model design.
Programming
(OOP)
Language
Operand Specifies the data or location of the data to be
used.
Output Data processed in a form useful to the user or the
computer (see also information).
Process The transformation and output of data into a
meaningful and useful form.
Program Detailed set of instructions telling the computer
exactly where to get data and how to process it.
Model used for estimating the processing time of
an algorithm. Each individual access of memory,
RAM and simple operation (e.g. +, -, *, =, if, call) takes
Computation one step. Loop structures must be computed by
Model adding each individual element, as stated above.
This model is not exact due to differences in
machines, but does give a rough estimate.
Rapid (RAD) A means of developing programs using
Application prototypes (e.g. templates) that are easily
Development modified to meet the program's needs.
Selection Tells the computer the action to take under the
Control specified (e.g. event) condition.
Structure
Sequence The order in which actions occur.
Sequence Shows one action or an action followed by another
Control sequential action.
Structure
Solution Graphic or written step-by-step description of
Algorithm procedures within a module.
Source Where information or an object originates from.
Also the uncompiled code of a program.
Structured Method of creating the program's logic using a
Design combination of the sequence, selection, and
repetition control structures.
Subclass A class within a class, e.g. a subset.
Superclass A class in which the current class belongs as a
subset.
Symbolic Storage location noted by a symbolic name in
Address Assembly Language.
Symbolic (Mnemonics) Meaningful abbreviations for
Instruction instructions used in Assembly Language.
Codes
Symbolic Instructions are written using codes and symbols
Language rather than zeros and ones.
Syntax The set of grammatical rules of a programming
language applied to instructions in a program.
Syntax Error Any programming syntax mistake made in coding
which results in the inability to complete the
command.
System Graphic representation illustrating a major
Flowchart process, its timing, the output, data sources
required, and necessary input devices.
Third- (Procedural Language) A high-level programming
Generation language using English-like words and
Language mathematical notations to create processes.
These must be compiled into Machine Language
and often rely on environmental (e.g. operating
system) components to perform many tasks.
Unstructured Problems with unclear methods leading toward
Problems their solutions, often requiring intuition and
personal judgment (e.g. guessing and educated
guessing).
Variable An element of data in an object-oriented program.
Technically any data element subject to variation
depending on the source of the data (as opposed
to internal constants). Variables are subject to
change, and hence the root of the word: vary.
System Development Life Cycle
The flowchart to the right illustrates the Systems Development Life
Cycle (SDLC). This cycle is remarkably comprehensive. It easily fits
into any project development (business, education, law, any area of
research), not to mention its applications with computer hardware,
software and applications.
We observe that the cycle begins where it ends. This is not typical
for flowcharts, but in this case the flow is a perfect cycle. The SDLC
is continuous because needs are always changing as is the
technology. Let us quickly examine each of these stages.
Begin SDLC
Everything has a beginning. In the case of the SDLC the beginning
of one cycle coincides with the ending of another (or others
combined).
Preliminary Investigation
Programming Process
4. Identify Specific
1. Identify Program Function
Processes and Data
2. Identify the Platform
5. Create Flowcharts for
3. Identify Non-Programming
Objects
Alternatives
6. Create Objects and Test
Identify
Program Function
What do you need the program to do?
Common functions: graphics, word processing, file
management, calculating, etc. These are almost always removed
(running in something else).
Technical functions: utilities, operating system, hardware
configuration, etc. If the program is not removed, then it directly
communicates with the computer system in machine language.
That means the binary code must be compatible with the
hardware involved.
Removed functions: must be run within another program
(e.g. within Windows or other operating system, a Browser, etc.).
Most programs are in some way removed (e.g. are running in
another program). The question here is really: “Removed to
what?”
Special functions: works within a unique environment (not a
typical computer environment, like automobiles, cellular phones,
calculators, robots). These are typically in machine language and
designed specifically to meet the needs of input and output
components as well as any computational and memory features (if
any).
Identify the Platform
What will be running/executing the program? The program is
removed by what?
1. Nothing: directly addresses computer components in machine
language without requiring other programs. What are the
code requirements for the hardware?
2. Requires an Operating System: relies on features filled in by
the operating system to perform its functions. These are
Third Generation Programs. Note: BASIC was and remains
Third Generation. Old computers used to keep their
operating systems in ROM (Read-Only Memory) along with
translating features to convert the code into actions.
Question is: In what operating system/platform.
3. Requires a Program within an Operating System: relies on
features of a third generation program to Translate/Interpret
its functions. These are Fourth and Fifth (Natural) Generation
Languages. These include SQL and other query languages,
macros, and Hypertext Markup Language (HTML). Question
is: In what Third Generation program?
Identify Non-Programming Alternatives
1. Does a non-programming alternative exist that is more
practical?
2. Is there a non-computer method that can provide the
necessary results?
3. Would the non-computer method be more practical (e.g. time
wise, financially, labor and other resources wise)?
4. Can one or more programs provide the necessary results?
5. Can they be integrated for a complete end product as
needed?
6. How can they be integrated?
Identify Specific Processes and Data
1. Divide the program into distinct functions that may be
sequenced separately.
2. Divide each function into data and actions necessary to
perform the function.
3. Simplify data into the least number of necessary variables. If
a variable may change from one action to another, create a
separate variable for each. If each of these unique variables
has an identical default, then create a simple default
statement in the appropriate class.
4. Associate actions with the data variables and determine
which variables are shared, universal, or "private" to that
action.
5. Put universal values in a class within the hierarchy above the
actions that call on them and label them as shared.
6. Put shared variables with their specific actions (sequences)
and label them as shared.
7. Put the private variables with their specific actions
(sequences) and label them as private.
Create Objects and Test
1. Routine Flowcharts: The flowchart provides a logical
sequence of events including gathering, manipulating and
outputting information. Each function must have a logical
sequence to provide step-by-step exact actions needed to
complete the function. Be sure to think of every possible
thing that could cause a process to fail (e.g. bad or missing
data) and to provide alternative means of inputting the data
manually before the process tries to use it.
2. Create Primary Object: The primary object is also called the
Source. It must contain means of contacting, either directly or
indirectly, all the function sequences. It is itself a sequence
and the primary interface between the computer, software,
data and user.
3. Identify Appropriate Language: The language must fit the
environment the program will run in and the function needs of
the program. Not all environments support the same
functions. As such sometimes it is necessary to change the
environment to meet the needs of the programming language
needed to execute the functions.
4. Translate into Appropriate Language: Convert the sequences
you have written into the codes necessary to do them.
5. Organize and Compile as Needed: Put all the objects of the
program in a logical sequence with distinct boundaries (e.g.
separate files, grouped by class distinction, line numbered,
etc. as appropriate to the language and application).
Compiling translates the programming language you used to
write the program into Machine Language.
6. Test and Debug: Every program, regardless of its simplicity or
language, has potential for failure. Failures may be syntax,
incorrect sequencing, mislabeled connections or data, etc.
Errors are remarkably easy to make and immeasurably
difficult at times to find in the code (certainly easy when
executing the program to see the error in the output though!).
To debug you must find the error in the program and correct
it. Then test again to be sure the problem has not persisted
and that other problems did not surface.
Data Structures
Data Types
A value applied to a name within the code of a
program. For example you might define
Constant Pi=3.14159265358979 so you do not need to retype the
number repeatedly, and to conserve the size of your
program.
Textual data type. See also String under Data Storage
String
& Retrieval.
Variable A name applied to a number whose source is either
user input or the result of a formula. These often have
initial values. They are called variables because the
value is subject to change.
Denotes a value (textual or quantitative) may be used
by any subclass within a class. A common use for this
Public is with constants which may be used by any routine with
a superclass, or any variable which must be accessed
by another class.
Denotes a value (textual or quantitative) may be used
only within the class where it resides. Commonly use
Private
counting functions, because the counter typically
resides within the local function only.
Variable Containers
Type Value Range Purpose Memory
Size
Char Plain text Plain text 8 bits
Small integers
Short int 255 (whole 8 bits
numbers)
Integers (whole
Int -32,768 to 32,767 16 bits
numbers)
Large integers
Long -2,147,483,648 to
(whole 32 bits
Integer 2,147,483,647
numbers)
Real numbers
3.402823E38
Float (with decimal 32 bits
to 1.401298E-45
values)
1.79769313486232E308
Extremely
to
Double large real 64 bits
4.94065645841247E-
numbers.
324
Data Storage
Array A collection of data items with a single name
distinguished by numbers. In BASIC you can define
an array with five elements by using DIM X(5), then
later define the values for those elements {X(1),
X(2), X(3), X(4), X(5)} separately. An array may be
multidimensional such that information is accessed
as if in a table by row and column numbers (e.g. DIM
Y(5,5) allows 25 elements).
Geometric representation of the relationships
between two or more objects (illustrates coordinates,
Graph
distance and angle). Most likely of issue when
dealing with a network, circuit, web, or relationship.
List A set of data items to be accessed in order.
An arrangement or ordering of items, e.g. {1, 2, 3, 4}
and {4, 3, 2, 1} are two permutations of the same
Permutation
set. Often synonymous with arrangement, tour,
ordering, and sequence.
A sequence of characters or patterns. Strings are
String typically of issue when dealing with text, characters,
patterns, or labels.
A hierarchical representation of relationships
between items. An example would be the hierarchy
of folders on your computer, or a family tree. Trees
Tree
are typically of issue when dealing with a hierarchy,
dominance relationship, ancestor/descendent
relationship, or taxonomy.
Data Retrieval
A data retrieval structure independent of the actual
Container data. These are typically used with data sets and not
with variables with only a single value.
Queue The retrieval of information according to First-In-First-
Out (FIFO) priority. Queues may be prioritized
according to significance, or placed in a specific
sequence if the objects must be attained in a specific
order. Print jobs are typically set to queue in the order
they are created in. Typically when printing from a
laser printer you want the pages to come out first to
last so they appear (queue) in order.
The retrieval of information according to Last-In-First-
Out priority. When retrieval order does not matter, (e.g.
batch processing) then a stack may be appropriate.
Stack
When printing to a DeskJet or other printer that feeds
the output face-up, you want the job stacked so the last
page prints first, and the first page prints last.
Retrieves information according to position. This is the
Table method you use when retrieving information from an
array.
Control Structures
Switch
A function that swaps one value or set for another. Microsoft Excel
has a set of functions called lookups (lookup, hlookup, and vlookup).
As an example of a switch examine the following method for the
MOUS exam and example of vlookup.
Method:
1. If the range name is given in the question, start at step 4.
2. Click the second sheet tab
3. Click the down arrow on the name box and select the
named range (remember the name!)
4. Click the first sheet tab
5. Select the cell where you will enter the function in column B
6. Type: =vlookup(
7. Type the name of the range you looked up in step 2 then
type: ,
8. Select the range of cells being used for the lookup (both
columns and all rows) then type: ,2)
9. Click and drag the fill handle down through the desired
cells.
Example:
Loops
Loops serve a variety of functions including counting, making
decisions, and any function that requires repetition of the same
sequence (typically in association with a counting function). Loops
can easily become indefinite with the result of system lock-up and
program failure, so it is highly advised to provide means of escaping
your loops before system or data resources are exhausted. The
loops we will examine here include the post-test Do-While, the pre-
test While, the decisive If-Else, the swapping Switch, and counting
For statements. I associate the terms decisive, swapping and
counting to the latter functions because that is most descriptive of
their common functions. Swapping may also be done in a more
cumbersome way with the If-Else, decisions will to occur in all these
types of loops, and counting commonly occurs in all but the Switch.
Nested Function
A function within a like function. For example, ƒ(X)=ƒ(Y) + ƒ(Z).
Word 2000 supports nested tables. This means you can insert a
table into a table cell. The most common function to nest is the If-
Else (see table):
Lengthy: Short:
If X=1
{ If X=1
Y=A; {
} Y=A;
Else if X=2 }
{ if X=2
Y=B; {
} Y=B;
Else }
{ Y=C;
Y=C;
}
Recursion
Any process that references itself to perform its function. For
example, X=X+1 is recursive.
Worksheet 5—Programming & Coding
Unit 6—Problem Solving
Objectives:
Students will understand:
1. RAM Model 3. Graph Problems
2. Problem Solving With
Reasoning
RAM Model
The Random Access Machine (RAM) Model is used to determine the
processing speed of an algorithm. To assist understanding how this
model works we will examine a RAM model applied to web pages
then examine the same concept applied to algorithms and
programming.
Web Design RAM Model
Fundamental Principles:
All computations are 1 unit =
relative 1000 bytes of
Assume browser information
processing is >= Relative call for data
connection Invocation of styles
3 units = server script or scripts
execution or absolute Style execution,
reference module call, class
execution
ASP results
processing
The following table outlines the relative time it takes to acquire and
view information for a web page in a browser. The reader could use
the same table layout to make design decisions for any site. Notice
that all objects are given integer values regardless of size due to the
fact that each piece is individually packaged during transmission.
Below the table is a brief description of each attribute.
Size For HTML and other documents, this is determined by
the file size rounded up to the nearest kilobyte (1024 bits of
information). For scripts the number of classes, not the number
of commands, determines size. For particularly long classes,
say over 20 command lines, I would recommend adjusting this
value following the standard RAM model applied to programs,
as the browser must interpret each individual line of code.
Calls Referencing an object on the server. If you are
referencing a CGI script, then add 3. This chart assumes
relative references (valued at 1 unit), where absolute
references (citing the entire URL) should be counted as 3
instead.
Function Functions are only applied to Styles and Scripts
because these are not the primary native format of a browser,
so the browser needs to invoke other subroutines to interpret
the code. Each time the code is invoked requires the addition
of 1 unit, no matter how many lines of code are involved.
QTY How many instances of the Web object occur. For
Styles, every individual style is counted as a unit because the
browser must interpret then apply the individual item
throughout the document. For Scripts, each class is treated
separately as a unit.
Time The sum of Size, Calls, Function multiplied by the
quantity. The sum total of these times gives you an idea of how
long it takes to load the page.
I seriously discourage the use of both styles and scripts. Styles are
not supported the same among browsers. If you use them, I
recommend keeping them very simple because Internet Explorer
and Netscape produce very different results. Personally I
recommend using HTML instead. VB script and ActiveX are only
recognized by Internet Explorer. All browsers encounter problems
interpreting Java Script, resulting in browser failure during page
loading or other attempts to access the code.
A major error of web designers is the use of multiple graphic objects
when one will suffice, such as with buttons. I encourage integrating
your images and using image-mapping techniques with HTML.
Always create the image the size you want it to be on the page then
you do not need to worry about defining the size in the HTML, nor do
you need to worry about the resolution of the image nor file size.
Although I recommend embedding special fonts in graphics, I would
also encourage you to refrain from too large of graphics and
encourage you to provide enough text to occupy the viewer until
graphics appear.
RAM in Algorithms
Fundamental principles of RAM cycles in algorithms:
All basic functions = 1 unit/ cycle (+, -, *, =, memory access)
Loops are composites of their parts
Division
is a function of the solving algorithm
RAM applied to algorithms provides nothing more than a concision
meter. In other words, by counting the number of cycles required to
process information at the algorithm stage you can compare
algorithms for time efficiency. The key, of course, is not to sacrifice
quality but to conserve processing time. The above figure illustrates
a basic sort that is remarkably efficient and fast. With two items to
sort the best run time is 17 cycles, and the worst is 30 (brute force
sort in the median algorithm requires 3 cycles in best case and 8 in
worst). Some redundancy occurs in the 30 cycles, but it is assumed
you have more than two items to sort. A random selection of 9 digits
was completely sorted in only 153 cycles (2 to start, and 16 (7/9)
cycles per item). A brute force sort (the median function) requires
569 cycles (2 to start and 63 cycles per item) for the same set!
While this sort looks much more complex, and certainly takes more
coding, it is more efficient for larger sort jobs. Less is not always
more. 5 items using brute force requires only 76 cycles, and in the
quicker method requires 65. This is insignificant, and if the sort is
conducted during the input of a small set, the sort time of the brute
force method goes unnoticed. You must weigh opportunity costs,
and in the case of a median, this quicker sort is overkill because you
can handle the sequence during data entry, and in fact it helps
resolve input problems.
RAM in Programming
Back to Napoleon's: "The best plan never survived the first shot of
battle." When you code and compile your algorithm you become
subject to the qualities of the language. As a consequence, coding
technique can also save large amounts of time. As we did above,
we can trial run the algorithm manually then deduce from
observation the speed function. The Quicker sort with 5 items yields
65 cycles / 5 items = 13 < 4*5 log 5, and with 9 items yields 153
cycles / 9 items = 16.77778 < 2*9 log 9! Clearly the Quicker sort
grows faster based on the number of items being sorted. Depending
on your coding techniques, this could run faster (n log n or even
faster) or slower. Note: The compiler will estimate the run-time for
you. The brute force sort can easily become n² with poor technique,
e.g. variable miss-management.
Operate (Formulative)
What process does the topic represent?
O1. What is the real form of this stimulus?
O2. What concept do we perceive of this stimulus?
O3. How do we present or represent the concept?
O4. How do we relate the concept to other stimuli?
Define (Facilitative)
What does this topic mean (the definition)?
What are the parts of this definition?
F1. Composite initiate What is the general,
accepted definition?
F2. Constructive bonds What fundamental
concepts (components: action, subject, object) are brought
together by the definition?
F3. Correlate bond-action What are the
relationships between the components of the definition?
F4. Relative action How do these correlations
affect the definition?
F5. Initiate action What do these affects infer about
similar systems?
RAM Graphed:
15. Valid input for the common
factorial (top g(n)) takes
_______ cycles per unit of n
to compute.
16. Valid input for the new
factorial (ƒ(n)) > 0 takes an
average of _______ cycles
per unit of n to compute.
17. This is an example of ____
notation for (ƒ(n))?
A. o B. O C. D.
E.
Unit 7—Database Design
Objectives
This material was designed for a three contact-hour period in a
junior-senior level Algorithms course. It may prove very useful for
students seriously considering programming. In this supplemental
chapter, students will learn:
1. Database Objects
4. Normalizing (MCSD)
2. Field Design
5. Relationships (MCSD)
3. Data Type, Field Size and
6. Computer Math Concepts
Input Masks
I recommend reading memorizing(!) this entire chapter before you
create any table. This information does not fit into a neat sequence,
but it is all necessary to understanding table design. Most of this is
also critical to the MCSD.
General Terms
Batch: Processing information in groups as opposed to
transaction processing (randomly and singularly). Reports and
queries are typically processed in batches, while the data entry
for records and expressions are processed by the transaction.
Consider a table with a field labeled "Age," with the data type
being number. By using a number you can create an
"expression," which is the same as building a formula. Enter
birth dates in one field and use an expression to calculate the
current age so the age field never needs to be manually
updated. The expression will need to link to a field containing
the current date (available under the Insert menu as Date and
Time).
Data Access (ability to retrieve and use data) Database: A
collection of data related to a particular topic or purpose; a
table comprised of group of records containing fields of
categorized information. A collection of related files stored
together that allow you to define relationships between those
files so multiple files may be simultaneously accessed.
Programs other than databases use a "flat file" meaning each
record is separate and self-contained (e.g. not related to the
other files directly).
Data Acquisition (inputting and importing) Data Accuracy (of
input or import) or data integrity refers to the reliability of the
data and that the data is reported and entered correctly. Timely
data has not lost its usefulness or legitimacy because of the
passage of time.
Data Maintenance (updating, sorting) is the procedures used to
keep data current (see accuracy above), such as updating.
Data maintenance procedures may overlap data security
procedures to also include file management activities and
backups.
Data Management: The procedures used to acquire, access
and maintain data. Ensures that data required for an
application will be available in the correct form and at the
proper time for processing.
Data Security (accessibility of users to specific information)
protects data from being misused or lost. Part of data security
is Backup, where files are copied and stored in the event of
extraneous circumstances (e.g. disasters: manmade, natural,
or with the system).
Data Type: As with a spreadsheet, the database allows you to
define data types such as text, number, date/time, etc. You may
have one or more fields that contain graphics, such as
company logos. The database also allows you to perform
calculations using "expressions."
Expression: An expression uses the field names to perform
calculations within a record. In the table view of the records,
expressions in the database may be constructed similar to
formulas in a spreadsheet.
Query-by-example (QBE): helps you to construct a query by
displaying a list of fields that are available in the files, in which
you enter known information and prompt to provide all records
containing the values you entered in the query fields. Hoover's
Master List uses this query method. Note: typically this format
is previously specified.
Querying: Creates views and report content and layout. Allows
you to retrieve information from the database based on
specified criteria in a format previously specified or one that
you specify.
Realtime: The computer equivalent of Just-In-Time and FIFO
(First In First Out). The information is processed as it is
presented to the system. Form use is processed in real time
(e.g. changing record information).
Relational Querying: Allows you to query and manipulate data
to create a unique view or subset of the total data. Uses
relational operators to specify search criteria and perform
manipulations, such as select, project and join. Select finds
specific records, project specifies the fields within the records
that appear in the output, and join combines files/tables for an
integrated query which is typically saved in a separate file for
future use.
Report: A layout of information intended to be printed or
viewed. This layout will be standardized like a form, making it
easy to find desired information at a glance. Often, in industry,
forms will already be designed and standardized. This is
convenient because then you do not have to manually layout
the form. If the form does not already exist, then it may be
necessary to examine the information going into the form first,
to be sure that the layout and the "shape" of the output are not
in conflict.
Structured Query Language (SQL pronounced see-qwell): Now
a common language used to write relational queries; typically
available in most database programs. Allows for more
complicated querying and reporting where decisions are
necessary (e.g. where . . . = . . . replaces BASIC operations like
if . . . then, or for . . . and simplifies these with "and" statements
to allow for multiple conditions to be necessary for an action to
occur).
Database Qualities
Data Dictionary (definitions of fields such as field shape, name,
description, type of data, default value, validation rules, and the
relationship to other data elements)
Utility Program (creates files and dictionaries, monitors
performance, copies data, and deletes unwanted records)
Security (controls levels of access to data)
Replication (Distributes data to other computers to update
remote computer databases, typically for purposes of having a
central database from which information is updated, while
distributing only the necessary information to remote
computers)
Recovery (restores information after equipment failure)
Sophisticated databases often keep a log of what the database
had before and after a change was made (before and after
image). "Forward recovery" or "rollforward" automatically
reenters the changes made at the time of the last backup.
"Backward recovery" or "rollback" reverses the changes that
occurred over a specified period of time, which requires all
transactions during that time be reentered.
Query Language (creates views and report content and layout)
Allows you to retrieve information from the database based on
specified criteria in a format you specify.
Database Types
Hierarchical—Organizes data in a series like a tree. The
highest-ranking parent record is called a root record. From the
root record is derived the parent records, which accesses the
child records. Each child record can have only one parent
record (a record that accesses the information within the record
lower in hierarchy)
Hierarchy of Data—The various levels of the data (bit, byte,
field, record, file/table, relational database. The order (from
lowest to highest) is:
Bit—binary digit of 0 for off and 1 for one
Byte—a single character or unit of information stored in a
quantity of bits (8, 16, 32, etc.)
Field—Individual elements of descriptive data consisting of one
or more characters or units (e.g. bytes)
Record—A group of related fields combined to describe a
single person, place, thing, etc.
File/Table—A group of related records that share field attributes
but not necessarily the contents of the fields.
Relational Database—A set of related files/tables grouped to
perform functions interactively between the records of separate
tables and their respective fields.
Network—Allows multiple sources (parents) to access and
modify members (children) similar to a hierarchy.
Relational Database—A collection of one or more related
tables that can share information. The tables are related to
each other and are thus called "relations." The relations, like
tables, are divided into rows called "tuples," and fields called
"attributes". The range of available field/attribute values is
called the "domain".
Object-Oriented—Contains both data and actions (expressions)
for managing the data, such as instructions on how to display
or print the data, calculation methods, etc.
Database Objects
Databases have a variety of object types, which are listed below.
Each object name should have no spaces, and the first letter of each
word in a name is capitalized, or an underline (_) is used to separate
the words. The naming conventions listed in the table below may be
placed either in front of the object name (TBLMyName) or after
(MyNameTBL). I prefer to put the naming convention after so I can
see related objects together when viewing them all. Note also that I
use additional conventions to help create categories of objects,
which I identify as we discuss the objects.
Object
Convention Description
Type
A layout of raw information in columns
and rows where a row represents a
record and a column represents a field
where information is stored to define a
Table TBL
record. In Access the field "shape"
includes input masks, field sizes,
formatting, and data types, which will
restrict data input.
Query QRY Queries either acquire and manipulate
information from one or more tables
based on criteria (select queries) or
perform a function (action queries), such
as updating records, deleting records,
creating a table, or appending records
from one table to another. The viewable
results of a select query always look like
a table.
A graphical layout of fields whose source
is either a tale or a query. Forms limit the
user's access to data and provide a
Form FRM means for the programmer to include
meaningful descriptions and create a
path of travel for the user to put data in
correctly.
A printout of information derived from a
Report RPT
table or query.
A sequential set of instructions to perform
specific actions (like closing and opening
things) that can be applied to any object
Macro MCR in a form. In Access these are
remarkably easy to do, and will be
discussed in detail later. See Trigger
below.
Module MOD A Visual Basic for Applications (VBA)
program used to perform special
functions. I recommend using these
sparingly if at all, and have not personally
found a good use for them if you are
capable with query and macro design.
However, when analyzing your database,
the wizard may recommend compiling
forms and macros into modules. If so,
then I recommend following the directions
given after you are certain you will make
no further modifications. This way you
can rest assured that the coding is
absolutely correct. Anyone who has
done manual coding in any language
understands the hardships of even the
slightest human error and can appreciate
letting the application program itself.
For the MCSD you must understand the
concept of a Trigger. A trigger is an
event (insertion, update, or deletion)
executing a stored procedure. The
stored procedures in Access can be
either macros or modules.
Planning a Database
You will note that the list provided here contains different steps and a
slightly different order from lists in other books. It also appears to be
in reverse order of what one might think to do. This is a practical
application oriented approach, meaning you first determine the end
product then design the means of accomplishing that product.
Furthermore, this list does not neglect the fact that another database
program or system may be more appropriate than Access. For
example, the size of the database may be such that it is not practical
for Access (take AltaVista's database of indexed web pages as an
example).
Design the structure of the reports you want to be able to
generate from the database, including the necessary fields of
information and their shapes, as well as any extraneous
information (e.g. headers and footers or other text or graphics
that will appear on each form). Design the structure of the
records, defining the fields, their data types, and any
"expressions" in which a field will provide an automatically
calculated value.
Determine the purpose of the database (e.g. What will the
database represent (item b)? What will it be used to do (item
a)? How large will the database be?). Note that the size of the
database may also play a factor in hardware requirements,
such as available disk space, RAM, and processor speed.
Determine what type of database or what database program is
most appropriate to fit the desired purpose (e.g. for reporting
and querying). Find the simplest means of importing or
entering the desired information necessary to the database
(e.g. importing from various spreadsheets, word processor
created lists, etc.). If you are importing data, it is essential to be
sure the data is in a manageable format before attempting to
import it to your database.
Gather together all the forms, which will be filled out/generated
from the data in the database. Identify the various fields of
information contained within the forms
Separate the various fields into appropriate groups that should
be stored in separate tables (files).
Using the fields of one group, design the File on paper first (or
use an existing form) containing all the fields necessary to that
group.
Include a unique key field, like a record number or account
number.
Use separate fields for logically distinct items. Typically it is
wise to have separate fields for first, middle and last names,
title, company name, phone number, fax, e-mail, URL, street
address, post office box, city, state/state code, zip code, and
four digit zip code extension. Note: State and state code are
not the same. If you wish the state name to be spelled out and
to have the code, it may be wise to have separate fields for
each.
Do not create fields that can be derived from entries in other
fields.
Allow enough space for the information (the shape of the field).
Foreign addresses, names and phone numbers may require
extra space. Shape: The dimensions of a field required to
show the data. If the data is to be printed on fixed shape forms,
then the shape of each field must clearly defined providing a
limit to the quantity of information (number of characters) that
may be stored in that field. If the data is to be viewed
electronically, then the shape is governed more by cosmetics
(for most practical viewing) and the size limitations of the
database.
Create default values for frequently entered data (e.g. the state
when most records will be in the same state). Note: It is unwise
to require a field have an entry especially if the entry is not
appropriate. For example, state code will not apply for foreign
addresses, so allow for blank spaces.
Implement your design and input the data.
Field Design
The following guidelines assume that you follow the other rules
defined in this chapter (and there are many!). As such, when I say
something like "Include a unique key..." I mean if that key is
appropriate according to the rules of normalization, lookups, indexing
and key fields. Sound like a handful? That is why database
designers make a lot of money and hackers pay developers a
fortune to rebuild failing databases.
1. Gather together all the forms, which will be filled
out/generated from the data in the database.
2. Identify the various fields of information contained within the
forms
3. "Normalize" or "atomize" these fields so an information field
is only identified once (First Normal Form). It is typically
seen as easier to combine information (denormalize) than to
separate it (normalize). Always reduce first to the lowest
denominator then denormalize for functionality and to
balance system resources. For example, on a gradebook
database, I first atomized assignment entry into two fields,
the first containing a lookup to different types of assignments
and the second to name the type selected. I related these
two to the student grades and everything looked all right until
I tried tracking a class. Then I could only see what the
assignment type was, not the title, so I denormalized
(merged) the fields and eliminated the lookup. Sometimes
less is more. Limit the user only when absolutely necessary
to ensure proper functionality.
4. Separate the various fields into appropriate groups that
should be stored in logically separate tables.
5. Using the fields of one group, design the table on paper first
(or use an existing form) containing all the fields necessary
to that group:
1. Include a unique key field, like a record number or
account number if the table will be a parent table.
2. Use separate fields for logically distinct items.
Typically it is wise to have separate fields for first,
middle and last names, title, company name, phone
number, fax, e-mail, URL, street address, post office
box, city, state/state code, zip code, and four digit zip
code extension. Note: State and state code are not
the same. If you wish the state name to be spelled
out and to have the code, it may be wise to have
separate fields for each.
3. Do not create fields that can be derived from entries
in other fields (e.g. from expressions that can be
created in queries).
4. Allow enough space for the information (the shape of
the field). Foreign addresses, names and phone
numbers may require extra space. Shape: The
dimensions of a field required to show the data. If the
data is to be printed on fixed shape forms, then the
shape of each field must clearly defined providing a
limit to the quantity of information (number of
characters) that may be stored in that field. If the
data is to be viewed electronically, then the shape is
governed more by cosmetics (for most practical
viewing) and the size limitations of the database.
5. Define data types, formatting, input masks and
indexing qualities
6. Create necessary lookups
7. Create default values for frequently entered data
(e.g. the state when most records will be in the same
state). I discourage the use of default data as it can
result in data-entry errors that are extremely difficult
to track which result from oversight and laziness. It
is easier to find and repair data errors if a field is
accidentally left blank than if it is automatically filled.
8. Create validation rules and other data entry rules. It
is unwise to require a field have an entry especially if
the entry is not appropriate. For example, state code
will not apply for foreign addresses, so allow for
blank spaces.
6. Repeat step 5 until all tables are developed necessary to
accomplish the desired results.
7. Create input and output mediums (these are potentially
interchangeable and may even be worked simultaneously at
times):
1. Create queries to perform desired computations
(expressions) and present the data required for the
forms in step 1.
2. Create reports to print out the desired information.
3. Create a user interface (Form objects, macros and
modules) to insure proper data entry.
8. Develop security measures to limit user access to data and
design.
9. Test all features of the design with sufficient data to
potentially break the system (e.g. normal operating
conditions) on the least capable users with no training
(particularly those known to break things without trying) and
observe the consequences. I know it sounds cruel to those
users, but if they can use it and not break it, then it will likely
do well under real pressure. Often tests are run using the
most competent users. From a management perspective
this means lost production time with their most valued
employees. Personally, as a manager, I would rather risk
losing production time on already unproductive employees
because I stand to gain productivity from them if the system
actually works. Note: Microsoft justifiably recommends
aiming development at company regulation levels and not
the lowest known denominator. I would argue you should fill
both objectives, because failure to do so means your project
is not justified because the existing system clearly did not
work. If the system had worked, your project would never be
considered.
Primary Field Attributes
Field Names
Access will allow you to create long field names with spaces in
them. Do not abuse length, and definitely do not put spaces into
your field names. While these practices are alright with
dysfunctional database designs, they are dysfunctional because
eventually the developer hacks their way into a feature that does not
forgive the spaces (like real programming). It is wise to have a
naming convention that is brief, intuitive and logical. It is also wise to
try avoiding using the same field names in other tables as this could
become confusing for you, and more disastrously, could confuse the
programming code of a SQL statement or module. Field names
must be unique within a table, and should be unique among the field
names of the other tables in the database. If you want the user to
see a name other than the field name, change the Caption attribute
on the General tab at the bottom of the Table design view.
Constraints and Validation (MCSD)
Constraints limit what kind of data can be entered into an field or
table (often called an entity on the MCSD), how the data is entered,
and the order in which the data is entered. One way to control the
order data is entered in is to follow the Navigation Model, which
defines how the user navigates through the interface (for Access this
often means switchboards, action buttons and forms).
Note: this paragraph is crucial for the MCSD. Types of validation
include Point-of-Entry (forces the user to make input), Field Level
(tests validity when field is updated, but before stored data is
updated), Transaction Level (when the record is going to be
updated). Validation occurs at one of the following points: when a
field is updated or modified (the user types or edits field contents),
when a record is deleted, and when a record is updated. Access
automatically validates information based on data types (when field
goes to update), input masks (as you type), key field (these are
automatically required and must be different from each other, occurs
typically when the record is updated), and relationships (when you
try to delete or modify something that is related to something else).
You can go beyond the defaults of Access and otherwise require a
field and/or provide a default value. I do not encourage the use of
default values as they can lead to quality assurance nightmares. It is
much easier to get information than to wade through misinformation
that is default and verify it all.
You can set more validation rules by using the ValidationRule
property. If you set the ValidationRule property but not the
ValidationText property, Microsoft Access displays a standard error
message when the validation rule is violated. If you set the
ValidationText property, the text you enter is displayed as the error
message in a message box. All rules created in the Table design
(including error message boxes, masks, etc.) are also applied in
forms even if the form is indirectly derived through a query. If your
tables are from external sources (e.g. dBASE, Paradox, or a SQL
server) you cannot modify table properties, so you can only apply
rules to controls on your forms (independent of the table).
Control, field, and record validation rules are applied as follows:
Validation rules you set for fields and controls are applied
when you edit the data and the focus leaves the field or
control.
Validation rules for records are applied when you move to
another record.
If you create validation rules for both a field and a control
bound to the field, both validation rules are applied when you
edit data and the focus leaves the control.
The following table contains expression examples for the
ValidationRule and ValidationText properties.
ValidationRule property ValidationText property
Entry must be a nonzero
<> 0
value.
Entry must be blank or
> 1000 Or Is Null
greater than 1000.
Entry must be 5 characters
Like "A????"
and begin with the letter "A".
>= #1/1/96# And <#1/1/97# Entry must be a date in 1996.
DLookup("CustomerID", Entry must be a unique
"Customers", "CustomerID = CustomerID (domain
Forms!Customers!CustomerID") Is aggregate functions are
Null
allowed only for form-level
validation).
To allow a Null value, add "Is Null" to the validation rule, as in "<> 8
Or Is Null" and make sure the Required property is set to No.
Formatting and Descriptions
Formatting is only a visual constraint and does not directly affect the
data. As a consequence forcing upper case characters with a > in
the Format field on the General card succeeds in generating
programmer headaches because case sensitive searches will fail.
As such, I discourage considering formatting as a constraint, but
rather consider it a visual bonus to help the user correctly recognize
information. Note: to show the date as 01/01/1901 use the format
mm/dd/yyyy, which will prevent numeric conflicts between dates
early in the twentieth and twenty-first centuries. Another useful
formatting mask is HH:MM:SS AM for times.
Likewise, descriptions and tooltips are only useful if the user notices
them. Descriptions appear in the status bar, giving users and
programmers additional information to help understand the field.
Most likely the person who reads descriptions is already an
advanced user and will not need the extra information. I recommend
using forms with descriptive labels and help files that are easily
found and used. Likewise, new users are likely to move the mouse
too quickly to get tooltips, but when they finally slow down these act
as comments in other documents which can be immensely helpful as
context-sensitive help. You might put a "Quick Help" button on your
form that produces a message box that reads "For quick help on a
specific item, point your mouse pointer at the field and leave it there
until a tooltip appears." Then provide descriptive tooltip information
for each field shown on the form.
Normalizing (MCSD)
Note: the three entities (Associative, Characteristic, and Kernel) are
the terms used in the MCSD Analyzing Requirements and Defining
Solutions Architectures.
Associative A table that derives all of its data from two or
Table more tables, creating a relationship between
(Associative those tables that could not otherwise exist.
Entity) Recommended naming
conventions: TableNameDetailsTBL,
TableNameDTBL, TableNameATBL .
Characteristic A child table providing information about a parent
Table table that has a variable length. Were this data
(Characteristic stored in the parent table, it would result in blank
Entity) fields for many records. For example, in an order
entry system you would have an OrderTBL with a
child OrderDetailsTBL. The OrderTBL contains
general information pertaining to the order, such
as who made the order, the date of the order, who
is receiving the order, who is getting billed, and
where the order is being shipped. The
OrderDetailsTBL links to the key fields of the
OrderTBL and the ProductsTBL, and lists the
quantity ordered. See the Fourth Normal Form.
Child Table A table that derives data from another table. If a
child table does not have any children itself, it
should not have a key field.
Decomposable Quality of a table indicating that certain fields
contain repetitive data better managed if
separated into another table and related by key
field. Typically decomposable tables have
multiple fields that can be distinguished from
each other. Names can be repetitive, but do not
themselves justify decomposing the table.
Flat Table A table with no key field and no relationships to
other tables.
Hierarchical Quality of a system where the parts are organized
such that lower ranking parts inherit the qualities
of higher ranking parts. Do not confuse the
application of this term in this section with a
hierarchical database. In a relational database,
child tables inherit the qualities of the parent
tables, and child tables provide either variable
length characteristic or historical details about the
parent table.
History Table A child table whose purpose is to store time-
specific data, such as a PriceHTBL or
CostHTBL. The data is only applied if the date of
the history table corresponds with the related
records. See the Tenth NormalForm.
Recommended naming
conventions: TableNameHistoryTBL,
TableNameHTBL
Navigation A special function table for which only one record
Table will ever exist. This type of table will be
discussed in great detail later. Recommended
naming
conventions: NavTBL or TableNameNTBL . This
is often an associative table, so those naming
conventions may also be applied.
Normalize Process of dividing a table into non-
decomposable tables. See the Fifth Normal
Form.
Parent Table A parent table always contains a key field which
is referenced by its children. A parent table could
also be a child table if and only if it derives data
from another table.
Primary Table A parent table with a key field and with no data
(Kernel Entity) derived from other tables. A record here provides
data describing a singular real-world subject that
is not a subset of but rather a superset of other
entities. Naming convention: TableNameTBL.
Terminal Table A child table that will not have any children.
Terms
Child Table A table that derives data from another table. If a
child table does not have any children itself, it
should not have a key field.
Decomposable Quality of a table indicating that certain fields
contain repetitive data better managed if
separated into another table and related by key
field. Typically decomposable tables have
multiple fields that can be distinguished from each
other. Names can be repetitive, but do not justify
decomposing the table.
Details Table A child table providing information about a parent
table that has a variable length. Were this data
stored in the parent table, it would result in blank
fields for many records. For example, in an order
entry system you would have an OrderTBL with a
child OrderDetailsTBL. The OrderTBL contains
general information pertaining to the order, such
as who made the order, the date of the order, who
is receiving the order, who is getting billed, and
where the order is being shipped. The
OrderDetailsTBL links to the key fields of the
OrderTBL and the ProductsTBL, and lists the
quantity ordered. See the Fourth Normal Form.
Flat Table A table with no key field and no relationships to
other tables.
Hierarchical Quality of a system where the parts are organized
such that lower ranking parts inherit the qualities
of higher ranking parts. Do not confuse the
application of this term in this section with a
hierarchical database. In a relational database,
child tables inherit the qualities of the parent
tables, and child tables provide either variable
length details or historical details about the parent
table.
History Table A child table whose purpose is to store time-
specific data, such as a PriceTBL or CostTBL.
The data is only applied if the date of the history
table corresponds with the related records. See
the Sixth Normal Form.
Intersection A table that derives all of its data from two or
Table more tables, creating a relationship between
those tables that could not otherwise exist.
Recommended naming
conventions: TableNameITBL .
Navigation A special function table for which only one record
Table will ever exist. This type of table will be discussed
in great detail later. Recommended naming
conventions: NavTBL or TableNameNTBL .
Normalize Process of dividing a table into non-
decomposable tables. See the Fifth Normal
Form.
Parent Table A parent table always contains a key field which is
referenced by its children. A parent table could
also be a child table if and only if it derives data
from another table.
Primary Table A parent table with a key field and with no data
derived from other tables.
Normal Forms
Microsoft provides five "Normal Forms" (see Analyzing Requirements
and Defining Solution Architectures for the MCSD) which are rules
governing normalizing of relational database design. I faithfully identify
these forms first then add my own to the end.
Form Definition
There cannot be decomposable repetitive data among the
records of a table. A table violates this rule if one or more
fields contain repetitive data that could be stored more
concisely in another table using a lookup to the key field of
the new table's key field. When designing your tables you
should be able to identify repetitive information easily.
When this happens, create a new table to store the data in
First
with a key field (typically as an autonumber) and any
descriptive fields. Save this table and close it. Return to
the original table and create a lookup in a blank available
field to the key field. It is also wise to include the name of
the record and hide the key field so the user is not confused
when they use the lookup during data entry. This can (and
should) be done without any data in the tables.
According to Microsoft, every field in a table must relate to a
primary key field in its entirety (which includes multiple key
fields). This rule is typically viewed as a function of multiple
key fields (composite key), for which I have added the
Second Eighth Normal Form. The reality of this form, however, is its
application to putting the fields in the tables where they
belong. For example, a price field belongs in a PriceHTBL
(see Tenth Normal Form) not an InvoiceTBL because the
price is a function of time and product, not the order.
Third A child table must be related to a parent table through the
primary key field. If a composite key is used, this can be a
serious problem, because you can only relate to one key
field at a time. For this reason I add the Eighth Normal
Form. Here, Microsoft is arguing that relating non-key fields
in two tables will result in potential data conflicts from many-
to-many relationships. Many-to-many relationships occur
when a relationship is made between non-key fields (e.g.
often without a properly formed lookup). See also the
Twelfth through Fourteenth Normal Forms.
Never create a related field that could be left blank. My
recommendation here is to make the lookup field in the child
table required. Microsoft's point, however, is that many
instances where this might occur are the result of a field that
Fourth
may not always be necessary and should thus be relegated
to a characteristic table. If the field is not related to
another table, then may be a necessary evil. If it is related
to another table the practice is forbidden.
Divide a table into multiple indivisible tables to reduce
repetitive data and prevent blank fields.
Other
Table Key Lookups
Fields
StudentTBL StudentID Name,
Phone,
etc.
CourseTBL CourseID
TextbookTBL TextbookID Author,
Fifth Publisher
SectionHTBL SectionID CourseID, semester
TextbookID,
InstructorID
RosterATBL RosterID SectionID,
StudentID
AssignmentCTBL AssignmentID SectionID, title,
RosterID value
GradesATBL RosterID, Value
AssignmentID
Sixth 1. The fields in a parent table define a key field and do
not require a history
2. The fields of a child table (which either defines a
history, characteristic, or creates an associate), with
no key, are definitive of the key fields of the parent
tables
3. If a child table has a key field (meaning it is also used
as a parent), then the fields must fill both 1 and 2 of
this form.
Any table with children must have a single key field. Most
Seventh typically this is an autonumber if there is no other logical
alternative (like a social security number).
Never use a composite key. Access allows you to make two
more fields share the function of key field. The combination
of these fields cannot be repeated. I have found that most
instances where composite keys have been established,
there should have been no key field at all. Although
Eighth
Microsoft gives you this option, the typical result is a
violation of the Second Normal Form. The most likely
instigator to inspire multiple key fields is an Associative
table, which is a child table. If such a child must have
children of its own, then follow the Seventh Normal Form.
Never include a key field in a child table that has no children
Ninth
of its own.
Typically a terminal table maintaining dated information is a
History table, which is used to attribute values appropriately
to records based on the date of transaction. For example,
because prices and costs change over time, history tables
Tenth
should be maintained so reports can be run on old
transactions rather than forcing the maintenance of hard
copies which become difficult to analyze. This is useful for
accounting purposes.
Eleventh Typically a terminal table listing variable amounts of
information attributed to a parent table is a Characteristic
table. In an order entry system, each order can have any
number of items associated with the specific order. To
account for this variation create an OrderDetailsTBL
containing a lookup to the OrderID in the OrderTBL, a
lookup to the ProductID (showing the product name) in the
ProductTBL and a field indicating the quantity ordered. This
example is also an associative table as described in the
Twelfth Normal Form. An example that fits only this might
be a CertificationTBL for instructors, who would have
multiple certificates which can be immensely different from
each other, and have specific dates of validity. For such a
design you would create a lookup from the CertificationTBL
to the InstructorID in the InstructorTBL, then provide fields
for the granting institution, date awarded, title of the
certificate, and the date (if applicable) the certificate expires.
Typically a terminal table with lookups to two or more table
keys to allow otherwise unrelated tables to be related are
Twelfth associative tables. As noted in the Eleventh Normal
Form's order entry example, an associative table can also
contain detail information unique to the association.
Never use a key field derived through relationship from
Thirteen
another table as a key field in the child table.
The combination of lookup fields in an associative table
must never be repeated. This is an extremely difficult rule
because between the Eighth and Thirteenth Normal Forms,
it appears impossible to enforce on the user. A solution
could be to force the user to enter the fields in a specific
Fourteen order (see Navigation Tables below), and after the first
lookup field have each subsequent lookup use a query as
its source. Another would be to add a hidden date field with
default data of =Now(), create the necessary Delete Query
and macros to drive the function to automatically delete the
old data when the user replicates.
A terminal table that is an association where only one
Fifteenth record can exist in a table and the source data for all fields
are lookups to other tables is a Navigation table.
As you can see, my additions provide even greater detail on table
design, which often include solutions from other database objects.
Hierarchy of Normalized Tables
To help put this all in perspective, table types are listed in order of
relationship priority with brief explanations as to why. I put parents at
the top because they provide the most constant, stable data. This is
also the order in which you should create your tables.
1. Flat Tables―not involved in any relationship least affected can
be added any time
2. Parent Tables
1. Kernel (Primary Parent) Tables―share data with other
tables
2. Child tables who are also Parents―both borrow and
share data with other tables
3. Child Tables
1. Associative Tables―borrow most or all of their data to
regulate complex relationships
2. Other Children―require at least one parent for their
data to be meaningful
Characteristic Tables
History Tables
3. Terminal Tables―potentially descriptive of any child
table
4. Navigation Tables―exclusively borrow data as a
dominant function for forms and queries
Relationships (MCSD)
Access is not just a basic database design tool. The database designer
should know that Access is limited to 2 million records, but can be
attached to a much larger database (e.g. hosted by a SQL server). This
is actually common because with the VBA capabilities of Access
modules you can create a simple interface with all the simplicities of
Access including reports, queries, forms and security without having to
reinvent the application and retain the power of a "real" database.
The Access 2000 example has no relationships established in the
Relationships Window. I recommend relationships in the
Relationships Window be built only with the Lookup Wizard, then
develop other relationships in the queries. For an example of
relationships created with lookups alone see the circular.mdb in the
same location on the Internet. All relationships in the example are
shown in the queries. Note: if relationships are done in the
Relationships Window they will appear in the query when the tables are
inserted. You can, however, modify the relationship or even delete it if
created in the query alone without affecting the entire database. I also
recommend doing as many expressions as possible in the queries
to simplify forms and reports (not to mention reduce headaches as
expressions may work in a report but not in a form and vice-versa).
For fun, redefine the AZcompaniesQRY to prompt for a different state (in
the criteria cell type [Please enter the desired state]), then run the other
queries choosing other states. The other queries use this as their data
source.
Relationship Types (MCSD)
One-to-One: Both tables have one key field and those key fields
are related to each other. This means that a record in one table
will only have one matching record in the other table. If such a
relationship exists then I recommend merging the tables to simplify
the design and reduce the redundancy of listing the same key field
twice.
One-to-Many: Both tables have at least on key field and a key field
is either related to a non-key field or to a table with multiple keys.
For each record in the table with a single key field related to a non-
key or multiple key, there are potentially many records in the other
table that are related.
Many-to-Many: Both tables are related either with multiple keys or
by non-key fields when key fields exist in both. This means a
record in either table may have multiple related records in the
other. Although Microsoft's Third Normal Form seems to do away
with this, associative tables defined in the Twelfth through
Fourteenth Normal Forms make this possible in a controlled
manner.
Undetermined: Neither table contains a key field.
Join Types (MCSD)
Option 1 (Inner Join)--Shows only matching records of both
tables. This is shown by a line with no arrows connecting the
related fields.
Option 2 (Right Outer Join)--Shows all records of the "One" table
(or if undetermined or many-to-many, the table where you started
clicking and dragging) and only matching of the "Many" table (or if
undetermined or many-to-many, the table where you release the
mouse button). In other words, all the records of the "One" table
will show even if there are no matching records in the "Many"
table. When there are no matching records in the "Many" table
then the requested fields are blank. This is shown by a line
connecting the related fields with an arrow pointing to the field in
the "Many" table.
Option 3 (Left Outer Join)--Shows all records of the "Many" table
(or if undetermined or many-to-many, the table where you release
the mouse button) and only matching of the "One" table (or if
undetermined or many-to-many, the table where you started
clicking and dragging). In other words, all the records of the
"Many" table will show even if there are no matching records in the
"One" table. When there are no matching records in the "One"
table then the requested fields are blank. This is shown by a line
connecting the related fields with an arrow pointing to the field in
the "One" table. This join type potentially breaks the Third Normal
Form unless it is made to a query of the parent table.
Note: Right and Left Outer Joins are visually semantic terms that may
be confusing because the direction the arrow is pointing may be
reversed simply by moving related tables to the opposite sides of each
other. The assumption in data-flow diagramming is that parents (one)
will be on the left and children (many) will be on the right. As such, a left
outer join would point from the child to the parent. That is why I provide
the option number with description as well as the name. To change a
left outer join to a right outer join you must double click the joining line
and choose the other option. You cannot simply change the location of
a table so the arrow physically points left or right to establish the
required results.
Referential Integrity (MCSD)
The rules of referential integrity (when enforcement is selected) are:
You cannot change a key field referenced from or by another
table. Note: you can never change a key field referenced from
another table because this would damage the records in the child
table being edited.
You cannot change data in a field referenced from another table.
You cannot delete records referenced by another table.
To violate these use the options: Cascade Update Related Fields or
Cascade Delete Related Records with extreme caution!
When referential integrity is established it can be seen in the
Relationship design area of a query or in the Relationships Window by
the ones (1) and infinites ( ) indicating which table is "One" (1) versus
"Many" ( ). You must edit the relationship to see if the cascade delete
or update options are selected.
Cascading Changes and Deletes
Access provides the ability to "Cascade Update Related Fields" and
"Cascade Deleted Records". If your relationships are created properly,
updating will amount to updating the key field references only in related
records of child tables. The cascade delete will cause all related
records in child tables to also be deleted. Note: Parent-child
relationships are always one-to-many (Parent = 1, Child = ). While
referential integrity can be seen in the relationships window, cascade
features are only visible when viewing the properties of a relationship.