0% found this document useful (0 votes)
14 views100 pages

Module 2 - Using Apps and Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views100 pages

Module 2 - Using Apps and Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

Module 2 / Using Apps and Databases Using Apps and Databases

The following CompTIA ITF+ domain objectives and examples are covered in
this module:

CompTIA ITF+ Certification Domains Weighting


1.0 IT Concepts and Terminology 17%
2.0 Infrastructure 22%
3.0 Applications and Software 18%
4.0 Software Development 12%
5.0 Database Fundamentals 11%
6.0 Security 20%

Refer To Domain Objectives/Examples


Unit 2.1 / Using 1.1 Compare and contrast notational systems.
Data Types and Binary • Hexadecimal • Decimal • Data
Units representation (ASCII, Unicode)
1.2 Compare and contrast fundamental data
types and their characteristics.
Char • Strings • Numbers (Integers, Floats) • Boolean
1.4 Explain the value of data and information.
Data and information as assets • Importance of
investing in security • Relationship of data to creating
information • Intellectual property (Trademarks,
Copyright, Patents) • Digital products • Data-driven
business decisions (Data capture and collection,
Data correlation, Meaningful reporting)
1.5 Compare and contrast common units of
measure.
Storage unit (Bit, Byte, KB, MB, GB, TB, PB) •
Throughput unit (bps, Kbps, Mbps, Gbps, Tbps) •
Processing speed (MHz, GHz)
Unit 2.2 / Using 3.1 Manage applications and software.
Apps Application management
3.3 Explain the purpose and proper use of
software.
Productivity software (Word processing software,
Spreadsheet software, Presentation software, Web
browser, Visual diagramming software) •
Collaboration software (Email client, Conferencing
software, Instant messaging software, Online
workspace, Document sharing) • Business software
(Database software, Project management software,
Business-specific applications, Accounting software)
3.6 Compare and contrast general application
concepts and uses.
Licensing (Single use, Group use/site license,
Concurrent license, Open source vs. proprietary,
Subscription vs. one-time purchase, Product keys
and serial numbers) • Software installation best
practices (Reading instructions, Reading
agreements, Advanced options)
Page 107
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit Summary
Refer To Domain Objectives/Examples
Unit 2.3 / 3.4 Explain methods of application architecture
Programming and and delivery models.
App Development Application delivery methods—locally installed
(Network not required, Application exists locally,
Files saved locally) • Application delivery methods—
Local network hosted (Network required, Internet
access not required) • Application delivery
methods—Cloud hosted (Internet access required,
Service required, Files saved in the cloud)
3.6 Compare and contrast general application
concepts and uses.
Single-platform software • Cross-platform software
(Compatibility concerns)
4.1 Compare and contrast programming
language categories.
Interpreted (Scripting languages, Scripted
languages, Markup languages) • Compiled
programming languages • Query languages •
Assembly language
4.2 Given a scenario, use programming
organizational techniques and interpret logic.
Organizational techniques (Pseudocode concepts,
Flow chart concepts, Sequence) • Logic components
(Branching, Looping)
4.3 Explain the purpose and use of programming
concepts.
Identifiers (Variables, Constants) • Containers
(Arrays, Vectors) • Functions • Objects (Properties,
Attributes, Methods)
Unit 2.4 / Using 3.4 Explain methods of application architecture
Databases and delivery models.
Application architecture models (One tier, Two tier,
Three tier, n-tier)
5.1 Explain database concepts and the purpose
of a database.
Usage of database (Create, Import/input, Query,
Reports) • Flat file vs. database (Multiple concurrent
users, Scalability, Speed, Variety of data) • Records •
Storage (Data persistence)
5.2 Compare and contrast various database
structures.
Structured vs. semi-structured vs. non-structured •
Relational databases (Schema, Tables,
Rows/records, Fields/columns, Primary key, Foreign
key, Constraints) • Non-relational databases
(Key/value databases, Document databases)
5.3 Summarize methods used to interface with
databases.
Relational methods (Data manipulation [Select,
Insert, Delete, Update], Data definition [Create, Alter,
Drop, Permissions]) • Database access methods
(Direct/manual access, Programmatic access • User
interface/utility access, Query/report builders) •
Export/import (Database dump, Backup)

Page 108
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1 Using Data Types and Units

Using Data Types and Units

Objectives
On completion of this unit, you will be able to:

□ Recognize and use different notational systems, data types, and units of
measure.

□ Compare and contrast fundamental data types and their characteristics.

□ Discuss the importance of data and ways that a company can use it to
make business decisions.

Syllabus Objectives and Content Examples


This unit covers the following exam domain objectives and content examples:

□ 1.1 Compare and contrast notational systems.


Binary • Hexadecimal • Decimal • Data representation (ASCII, Unicode)

□ 1.2 Compare and contrast fundamental data types and their characteristics.
Char • Strings • Numbers (Integers, Floats) • Boolean

□ 1.4 Explain the value of data and information.


Data and information as assets • Importance of investing in security •
Relationship of data to creating information • Intellectual property
(Trademarks, Copyright, Patents) • Digital products • Data-driven business
decisions (Data capture and collection, Data correlation, Meaningful
reporting)

□ 1.5 Compare and contrast common units of measure.


Storage unit (Bit, Byte, KB, MB, GB, TB, PB) • Throughput unit (bps, Kbps,
Mbps, Gbps, Tbps) • Processing speed (MHz, GHz)

Page 109
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1
Notational Systems

In computing, a notational system is one used to represent different


quantities or characters. Notational systems used to represent values and
quantities include decimal, binary, and hexadecimal.

Decimal Notation
For most people around the world, when they want to count something, they
use a numbering system based on decimal. The decimal system (or base 10)
is so well understood, it’s actually quite easy to overlook how it actually works.
Decimal is based on the principle of expressing ten different numbers using a
single digit in the range 0 to 9. Once you have a value of more than ten, then
you require two digits of decimal to express it. Thus, when twelve is expressed
numerically in decimal as 12 that means 1*10 plus 2*1.

1000 100 10 1
0 0 1 2
1000*0 100*0 10*1 1*2
0 + 0 + 10 + 2
= 12
You will notice that the rightmost column is worth one, while the second
column is worth ten times that (10). The third column is worth ten times the
second column (100), and so on. In other words, each digit as we move from
right to left (from least to most significant) is worth the base number (ten) times
more than the preceding digit. This is referred to as place value.

Binary Notation
While people find decimal easy to use, computers use binary to calculate and
process information. Binary is a numbering system where each single digit can
express only two values, in the range 0 to 1. The reason binary works well with
computers is that these two values can represent the off/on states of the
transistors that make up computer memory. Binary can also be referred to as
base 2.

As with decimal, to express a value of more than one, you must use multiple
binary digits in a place value system. For example, the number 51 in decimal
can be expressed in binary as 110011. As with decimal, when you write the
number down, and assign the digit values, you can see that each column is
worth the base number (two) times more than the preceding column as we
move from least to most significant (right to left). Thus, the second column is
worth twice the first, the third column is two times the second, and so on.

Page 110
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
128 64 32 16 8 4 2 1 Using Data Types and Units

0 0 1 1 0 0 1 1
128*0 64*0 32*1 16*1 8*0 4*0 2*1 1*1
0 + 0 + 32 + 16 + 0 + 0 + 2 + 1
= 51

Hexadecimal Notation
When handling large values, expressing them in binary can consume many
digits. For example, 1234 in decimal uses four digits, whereas the same
number in binary is 100 1101 0010, which requires 11 digits. You can
express large numbers more efficiently by using hexadecimal, often shortened
to "hex." The hex notation system enables you to express 16 different numbers
using a single digit in the range 0 to F. For example, the number 1234 (in
decimal) can be expressed in hex as 4D2, using one fewer digit. In this
notation, the letters A through F are used to express numbers larger than nine
(which require two digits of decimal to express). Thus, A is 10, B is 11, C is 12,
D is 13, E is 14 and F is 15.

4096 256 16 1
0 4 D 2
4096*0 256*4 16*13 1*2
0 + 1024 + 208 + 2
= 1234
Hex is used in programming. You will also encounter this numbering system
when you plan and implement Internet Protocol (IP) networks. IPv6 network
and host addresses are expressed using a hexadecimal notation system.

Conversion
If you are going to get involved in computing, it’s worth the effort of learning
how to convert numbers from binary to decimal and back. You can do so
manually using the place value columns shown above. You can also use a
programming calculator to achieve this conversion. Windows 10 provides one,
as shown below.

Windows 10 Calculator app in Programmer mode. Screenshot used with permission from
Microsoft. Page 111
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1
Units of Measure

You need to understand the units used to describe computer storage and data
transfer technologies.

Bits and Bytes


The basic unit of computer data is the binary digit or bit, which can represent two
values (zero or one). Computer memory and file sizes in Windows are measured
in multiples of bits. The first multiple is the byte, which is eight bits. A double byte
is 16 bits. As a byte represents very little information in terms of file sizes and
storage capacity, the following multiples are used:

■ KiloByte (KB)—1000 bytes (or 103 or 10*10*10 bytes). Small files are often
measured in KB.

■ MegaByte (MB)—1000*1000 bytes (or 1,000,000 bytes). Many files would


be measured in megabytes.

■ GigaByte (GB)—1000*1000*1000 bytes (1,000,000,000 bytes). Gigabytes


are usually used to talk about disk capacity.

■ TeraByte (TB)—1000 GB (1,000,000,000,000 bytes). Some individual disk


units might be 1 or 2 terabytes but these units are usually used to describe
large storage networks.

■ PetaByte (PB)—1000 TB or 1015 bytes (1,000,000,000,000,000 bytes). The


largest storage networks and cloud systems would have petabytes of
capacity.

You should also be aware that a different system of notation is available to


describe these multiples in binary terms (base 2), where the multiples express
powers of two rather than powers of 10:

■ KibiByte (KiB)—1024 bytes (210 bytes).

■ MebiByte (MiB)—1024*1024 bytes (or 1,048,576 bytes).

■ GibiByte (GiB)—1024*1024*1024 bytes (1,073,741,824 bytes).

In practice the KiB, MiB, and GiB notation is rarely used, but the binary
measurement is. Consequently, you should understand what is generally meant
by terms such as "MB" and "GB" in different contexts.

■ In the context of the Microsoft Windows operating system, file sizes and
memory capacity are always quoted as binary measurements (base 2). For
example, when you see that Windows reports 2 GB memory, this means 2048
MB, not 2000 MB.

Page 112
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
■ Storage capacity is typically quoted by vendors in decimal measurements Using Data Types and Units
(base 10). For example, a hard disk advertised with a capacity of 300 GB
has an "actual" capacity of 286 GiB. Some operating systems, such as
Ubuntu Linux and macOS, also use the decimal notation for system
memory, disk capacity, and file sizes.

Throughput Units
When data is transferred between components in the computer or between
computers over a network, the throughput rate that a particular connection
can sustain is measured in bits per second (bps). As with storage, the basic
unit of bits per second would result in writing out very long values, so
throughput can be expressed more efficiently using the following multiples:

■ Kbps (or Kb/s)—1000 bits per second. Older computer peripheral


interfaces (or buses) and slow network links would be measured in Kbps.

■ Mbps (or Mb/s)—1,000,000 bits per second. Many internal computer


interfaces have throughputs measured in Mbps. Wireless networks and
residential Internet links also typically have this sort of throughput.

■ Gbps (or Gb/s)—1,000,000,000 bits per second. The latest PC bus


standards and networks can support this higher level of throughput.

■ Tbps (or Tb/s)—1,000,000,000,000 bits per second. This sort of capacity is


found in major telecommunications links between data centers, cities, and
countries.

Throughput units are always base 10.

Also note that transfer rates can be expressed as Bytes per


second, in which case the "B" is capitalized (KBps, MBps, GBps,
and TBps).

Processing Speed Units


While throughput rates describe how much data is transferred over a link, the
speed at which a computer works can also be described independently of how
much data is involved in each operation. A computer's internal clock and the
speed at which its processors work is measured in units of time called Hertz
(Hz). 1 Hz represents one cycle per second.

■ Megahertz (MHz)—1 million (1,000,000) cycles per second. Older PC bus


interfaces and many types of network interface work at this slower
signaling speed.

■ Gigahertz (GHz)—1000 million (1,000,000,000) cycles per second. Modern


CPUs and bus types plus fiber optic network equipment work at these
much faster speeds.

Page 113
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1

Throughput is not always the same as the signaling rate. System


memory and network technologies can transmit more than one bit
per cycle for instance.

Data Types

It is important to understand the different data types that a computer program


can use. This is especially important when you start to write your own
programs (coding) or work with database systems.

The CPU and storage devices in a computer only process data as ones and
zeros. These hardware components have no conception of what the data
mean. When it comes to programming software applications though, data
types are very important because they determine what sort of operations can
be performed. For example, the characters 51 can be treated as a number
value, in which case you can use the data in additions and subtractions, or it
can be treated as a text string (representing a house number for instance). If
51 is stored as a string, it must be converted before it can be used in a
mathematical operation.

There are different types of number values and a variety of text forms. These
include:

■ Integers—these are whole numbers. For example: 5, 21, or 65536. An


integer data type consumes 1 to 8 bytes of computer storage.

■ Floating-point numbers—this type can support decimal fractions such as


4.1, 26.4, or 5.62. A floating-point number (or just "float") consumes
between 4 and 8 bytes of storage. Note that the floating-point type could
store a whole number too (4.0 for instance).

■ Boolean values—these are a special numeric data type indicating that


something is either TRUE or FALSE (with a 1 or 0). They consume a single
bit of storage.

■ Characters—a character (or char) is a single textual character, and can be


a letter of the alphabet, a symbol, or, indeed, a numerical character. For
example: a, D, 7, $, @, #. These consume one byte of storage. Note that
when a number is entered as a character data type, you cannot perform
any mathematical operations on it.

■ Strings—a string is a collection of text characters. For example: XYZ,


Hello world. There is no real limit on the amount of storage that can be
used by a string. Generally, you define the string length when you define
the data type.

Page 114
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Data Types and Units

When single or double quotes can be used to delimit a string


("Hello World"), the quotes are NOT part of the string itself. If you
want to represent a quote character (or other delimiter) within a
string, you have to use an escape character. For example, the
string "John said \'Hello World\' then left again." contains two single
quotes, escaped using the backslash character (\).

Data Representation

When binary values (1s and 0s) are used for char and string data types, there
must be some means of data representation by which different value bytes
map to letters, numbers, and symbols in a character set. There are two
common ways of presenting character set data: ASCII and Unicode.

ASCII Data Representation


In ASCII (American Standard Code for Information Interchange), each
number or character in a text file or string variable is represented by a seven-
bit binary number. With seven bits of binary, you can express 128 different
values (0 through 127).
Binary Dec Character Binary Dec Character Binary Dec Character

010 0000 32 space 011 0000 48 0 100 0000 64 @


010 0001 33 ! 011 0001 49 1 100 0001 65 A
010 0010 34 " 011 0010 50 2 100 0010 66 B
010 0011 35 # 011 0011 51 3 100 0011 67 C
010 0100 36 $ 011 0100 52 4 100 0100 68 D
010 0101 37 % 011 0101 53 5 100 0101 69 E
010 0110 38 & 011 0110 54 6 100 0110 70 F
010 0111 39 ' 011 0111 55 7 100 0111 71 G
010 1000 40 ( 011 1000 56 8 100 1000 72 H
010 1001 41 ) 011 1001 57 9 100 1001 73 I
010 1010 42 * 011 1010 58 : 100 1010 74 J
010 1011 43 + 011 1011 59 ; 100 1011 75 K
010 1100 44 , 011 1100 60 < 100 1100 76 L
010 1101 45 - 011 1101 61 = 100 1101 77 M
010 1110 46 . 011 1110 62 > 100 1110 78 N
010 1111 47 / 011 1111 63 ? 100 1111 79 O

Binary Dec Character Binary Dec Character Binary Dec Character

101 0000 80 P 110 0000 96 @ 111 0000 112 p


101 0001 81 Q 110 0001 97 a 111 0001 113 q
101 0010 82 R 110 0010 98 b 111 0010 114 r
101 0011 83 S 110 0011 99 c 111 0011 115 s
101 0100 84 T 110 0100 100 d 111 0100 116 t
101 0101 85 U 110 0101 101 e 111 0101 117 u
101 0110 86 V 110 0110 102 f 111 0110 118 v
101 0111 87 W 110 0111 103 g 111 0111 119 w
101 1000 88 X 110 1000 104 h 111 1000 120 x
101 1001 89 Y 110 1001 105 i 111 1001 121 y
101 1010 90 Z 110 1010 106 j 111 1010 122 z
101 1011 91 [ 110 1011 107 k 111 1011 123 {
101 1100 92 \ 110 1100 108 l 111 1100 124 ¬
101 1101 93 ] 110 1101 109 m 111 1101 125 }
101 1110 94 ↑ 110 1110 110 n 111 1110 126 |
101 1111 95 ← 110 1111 111 o
ASCII table. Page 115
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1

ASCII was designed a long time ago (1963) when using seven bits
rather than eight represented a significant cost saving. As most
systems now use byte-based storage (eight bits), various ways of
using extended ASCII to encode 256 values have been developed.

Unicode
ASCII, although widely adopted, is a very old standard (devised in early
1960s). More recently, Unicode has become more prevalent. Unicode enables
you to handle character data and express that data across platforms in a
uniform way.

Unicode comprises:

■ A set of code charts that handle visual reference.

■ A data encoding method.

■ A set of standard character encodings.

■ A set of reference data files.

■ Additional properties, including:

● Character properties.

● Rules to handle normalization, rendering, display order (for languages


that display right to left instead of left to right).

There are a number of different Unicode character encoding standards,


including UTF-8, UTF-16, and UTF-32. UTF-8 is used by many websites.

Page 116
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
The Value of Data Using Data Types and Units

When you think about data, it is important that you understand that it
represents more than just encoded numbers and letters. For organizations,
and even for individuals, computer data can be considered an asset. An asset
is something of commercial value. Therefore, it is important that you take steps
necessary to protect this asset.

Investing in Security
A mechanism designed to protect an information asset or processing system is
called a security control. There are many types of security controls, and they
can be classed in different ways. Typically they are designed to prevent, deter,
detect, and/or recover from attempts to view or modify data without
authorization. Security controls can be costly, both in terms of purchasing
hardware and software and in terms of more complex procedures and staff
training. The business case for investing in security is made by a calculation
called Return on Security Investment (ROSI). To calculate ROSI, you
perform risk assessments to work out how much the loss of data would cost
your organization and how likely it is that data loss might occur. The use of
security controls should reduce both the impact and likelihood of losses,
justifying the investment made.

When an attacker removes data from your network without


authorization, this can be called data exfiltration. Data breach is a
similar circumstance but can occur whenever your network
exposes private data publicly, whether the data is actively stolen or
not.

Security Controls
As mentioned above, a security control is something designed to ensure that
data is contained within the information processing system and is only
accessible with authorization. Some typical examples of security controls to
help protect your data might include:

■ Backup—ensure that you maintain copies of your data and that these
copies can be quickly and easily accessed when necessary.

■ Access control—your data might have a value to your business


competitors. Therefore, it makes sense to try to control access to stored
data. You can use the following technologies to control access:

● Permissions—most operating systems provide a number of methods


with which you can assign permissions on data files to users and
groups of users.

● Usage restrictions—you can use rights management software to control


what users can do with data files. For example, you can allow specified
users to read a file but not to copy or print a file. Page 117
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1 ● Data encryption—this means that data is encoded in some way that only
a person with the correct key can read it. Even if someone obtained a
copy of encrypted data, they would not be able to read it without the
key. This means that rather than try to protect the data, the security
system only has to protect the key, which is smaller and easier to
defend. Some operating systems offer the ability to encrypt data while it
is at rest (when stored on a disk). You can also use technologies to
encrypt data when it is in transit between the nodes on a network.

Make sure you understand the difference between permissions and


encryption. Permissions only work when the data is stored within
an OS or network that "respects" the access control system. If the
data were transferred to a different computer, the permissions
could be overridden. Encryption prevents this possibility (unless the
key is transferred with the data). Most security systems use both
permissions and encryption.

● Firewalls—on a network, a firewall can control how hosts and network


applications are accessible to one another.

■ High availability—it is often the case that temporary loss of access to data
can lead to high costs for an organization. Consider a situation when
financial transactions are not available to a banking institution. You can
implement technologies that enable you to ensure your data is available in
the event of one or several failures of hardware or software components
within your infrastructure. These technologies are referred to as fault
tolerance.

Any organization that does not take some, or all, of the preceding steps stands
to lose data and in all probability, suffer financial loss as a result.

Intellectual Property

Intellectual Property (IP) is often the most valuable information asset that an
organization owns. There are various different types of IP and different ways to
protect them from theft.

Copyright
Copyright is automatic legal protection granted to certain types of work
indicating that the copyright holder owns the right to control the use of the
work, including rights of publication, distribution, or sale.

There is no need to apply for copyright or display any copyright notice in order
to be protected by it. The creation of the work ensures copyright protection
automatically. Nonetheless, in case of a dispute, you might need to prove when
the work was created in order to defend yourself against charges of plagiarism.
Plagiarism is the unacknowledged or unauthorized use of someone else's work.

Page 118
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Most authors and publishers demonstrate that they hold copyright over a work Using Data Types and Units
by displaying the copyright symbol © with the date and their name. While
copyright laws vary throughout the world, demonstrating copyright in this way
is likely to protect the owner in most circumstances. In the USA, proof of
authorship can be demonstrated by registering the work with the Copyright
Office (copyright.gov).

Copyright does not apply to an idea that is not actualized, nor does it apply to
names, phrases, or titles. Copyright applies to both the original content of the
work and to original features of its layout, format, and appearance.

Copyright lasts for a number of years after the owner's death. The exact length
of time varies between 15 and 70 years depending on the nature of the work.
After this time, provided the copyright has not been extended for some reason,
the work becomes public domain and may be used freely. Also, in some
circumstances, a copyright holder may have waived their rights and designated
the work as public domain.

Even though copyright is not granted to an idea, the ownership of copyright is


not transferred if you purchase an edition of the copyrighted work. So, for
example, ownership of this book does not give you ownership of the copyright
in this book, and you are forbidden to copy or distribute it to others. In a similar
way, purchasing a software application does not give you the right to use it in
any way you want. Take another example: you download a song recording
from an Internet website. There is no copyright symbol displayed, but in fact
the copyright in the recording is held by Widget Music, who has not given
permission for the recording to be distributed in this way. You have broken the
law by downloading the song, and the website owner has broken the law by
making the song available for download.

Copyright can be transferred however. For example, if you create a piece of


work as an employee of a company, you will hold the copyright to the work,
unless your terms and conditions of employment contain a clause saying
otherwise (which they probably will). Ownership of copyright can also be sold,
as is common with the rights to music recordings.

Most types of original, created work are covered by copyright whether the work
is printed, broadcast, distributed on a CD, CD-ROM, DVD, or other type of
computer disk, exhibited in a gallery or theatre, or published on the Internet.
Examples include books, films, plays, computer software, games, and artwork.

Note that a work does not have to be "artistic" to secure copyright; technical
subject matter (such as an automobile's driver's handbook) is protected too.
Also, if material is stored electronically, the type of file has no bearing on
copyright; text, graphic, audio, and video files are protected equally.

Page 119
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1 Trademarks
As copyright is not given to the selection of a name, if a company wants to
promote its goods it will normally trademark its name and/or logo. A trademark
must be distinctive within the industry in which the company is selling goods
and services. An ordinary trademark is indicated by the ™ symbol. A registered
trademark is indicated by ®.

If you re-use or imitate an existing trademark, you are liable to legal action from
the owner.

Patents
A patent is legal protection for some kind of invention. Unlike copyright, a
patent can apply to an idea so long as the idea is original (or novel), useful,
and distinctive or non-trivial. If you have registered the patent, you do not
actually have to have made a copy of the invention or put it into practice. A
patent must be applied for and registered; however, there is no automatic
protection, as there is for copyright. In a lot of cases the registration must be
international, or you have no basis for action against people in other countries
infringing upon your patent. This can be complex as different countries have
different standards for accepting patents. Patents are registered for a limited
time only.

A patent infringement is where someone uses, makes, sells, or imports your


invention without your permission. It does not matter whether the use was
intentional or not.

It is important that any organization is able to protect its intellectual


property. This might extend to making sure that you register
appropriate product trademarks, protect your intellectual property,
and ensure that for products, you take out patents.

Digital Products
A digital product is one that is sold or distributed as binary computer data.
Examples of digital products include software, computer games, ebooks, music
tracks, streaming video, video downloads, and so on. Digital products typically
have low manufacturing and distribution costs, though hosted products can
have substantial infrastructure costs. The downside is that digital products are
quite easy to copy and steal.

Various copy protection or Digital Rights Management (DRM) systems have


been invented to try to enforce "pay-per-use" for digital products. When you
purchase a digital product, the vendor may license the file for use on a
restricted number of devices. You generally need to use your account with the
vendor to authorize and deauthorize devices when they change.

Page 120
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Data-driven Business Decisions Using Data Types and Units

As well as having importance and value as an asset, data and information are
critical in driving business decisions and strategies. For example, data can
help a company become more efficient and develop better products and
services:

■ Production and fulfilment—analysis of things such as process flows,


manufacturing and assembly, delivery and transportation networks, and
ordering and billing systems provides the opportunity to make them more
productive (efficient). Better productivity reduces costs and can improve
customer satisfaction.

■ Sales and marketing—information about individual consumers gleaned


from web search and social media histories allows for personalized
advertising. Large data sets of the same information aggregating the
activity of millions of consumers can be used to identify trends and develop
products and services to meet changing demands and interests.

Data Analytics (Relationship of Data to Information)


The process of using data in this way is usually called analytics. In an
analytics process, you can think of data being used to create information in
the following way:

■ Data is the raw values collected by the system. The system must have
some way of tagging or normalizing these values, similar to the way that
data is defined with different types, so that they can be used for
comparisons. For example, a web server might log whenever a page is
visited and record information about the visitor, such as the time, the
location, the type of browser, how long they spent viewing the page, or any
link from the page that was clicked. All these things are data points with
distinct types and formats.

■ Information is some level of summarization of the individual data points.


For example, you could use the logs of page visits to work out how many
unique visitors there were (as opposed to the same visitor viewing the page
more than once).

■ Insights are things that inform meaningful business decisions. For


example, from the information provided by the analysis of unique visitors,
you may devise a plan to increase unique visitor numbers through better
marketing or page design.

Page 121
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 1 Facilitating Data-driven Business Decisions
Following the definitions of data, information, and insights set out above, it
follows that you need systems to support these processing, analyzing, and
reporting functions.

■ Data capture and collection—data points can be collected from many


different sources. In the previous example, most of the data points come
from web server log files. The Internet of Things facilitates the use of
sensors attached to all kinds of components, packages, and appliances to
capture huge amounts of raw data. As well as collecting the data, it must
be stored and secured. A traditional way of storing data is a relational
database, but such structured data stores are being replaced (or
supplemented) by semi-structured data warehouses.

■ Data correlation—the information layer requires software to perform data


correlation. This means analyzing the whole data set and finding
connections and links between data points. For example, software may find
a correlation between page visitors and the color schemes used on pages,
with pages that are predominantly blue attracting more visitors than pages
that make more use of yellow. The ability of software to perform data
correlation without much human intervention is being greatly boosted by
the development of Artificial Intelligence (AI) and machine learning
systems.

■ Meaningful reporting—to inform human decision making at the insights


layer, the information identified by the analytics system must be presented
in ways that humans can analyze and interpret. The system must support
search and query tools plus charts and graphs and other ways to present
information pictorially. There is also the security requirement; only
authorized users should be able to query the information store.

Page 122
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Data Types and Units

Review Questions / Module 2 / Unit 1 / Using Data Types and Units


Answer these questions to test what you have learned in this unit.

1) Which notation system supports presenting the largest numbers using the
fewest digits: Binary, Decimal, or Hexadecimal?

2) What is the decimal number 75 in binary and hexadecimal?

3) Which data type provides for whole numbers only?

4) What is the difference between the char and string data types?

5) Which data representation format can encode the widest range of


characters?

6) What type of legal protection could be obtained for a novel software


algorithm?

7) What data protection technology could you implement in order to restrict


the type of activity that users could employ on digital products that they
have purchased or rented?

8) What part of the process of data analytics is most closely supported by


meaningful reporting?

Page 123
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2
Module 2 / Unit 2
Using Apps

Objectives
On completion of this unit, you will be able to:

□ Install and uninstall software applications and configure compatibility


settings.

□ Explain the importance of software licensing and the types of license


available.

□ Describe the key features of different types of application and associated


file formats.

Syllabus Objectives and Content Examples


This unit covers the following exam domain objectives and content examples:

□ 3.1 Manage applications and software.


Application management

□ 3.3 Explain the purpose and proper use of software.


Productivity software (Word processing software, Spreadsheet software,
Presentation software, Web browser, Visual diagramming software) •
Collaboration software (Email client, Conferencing software, Instant
messaging software, Online workspace, Document sharing) • Business
software (Database software, Project management software, Business-
specific applications, Accounting software)

□ 3.6 Compare and contrast general application concepts and uses.


Licensing (Single use, Group use/site license, Concurrent license, Open
source vs. proprietary, Subscription vs. one-time purchase, Product keys
and serial numbers) • Software installation best practices (Reading
instructions, Reading agreements, Advanced options)

Page 124
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Installing Applications Using Apps

Applications (or apps) are the software programs that let users do useful
things with their computer, such as create and edit documents, browse
websites, send email, watch videos, or play games. When you have installed
an operating system such as Windows, you are also likely to want to install and
manage software applications and perhaps enable or disable OS features and
components.

The term "app" originally referred specifically to software written for


mobile devices, such as smartphones and tablets, while
"application" came to mean software written for a desktop PC or
laptop. The distinction has since broken down, and the terms are
now somewhat interchangeable.

Reading Instructions and Documentation


Before you try to install an application, make sure you are following software
installation best practices. Read the accompanying documentation to verify:

■ That the software is compatible with your operating system.

■ That your computer hardware meets the application's recommended


system requirements.

■ Any special installation instructions or known issues.

■ That you have a valid agreement or license to install and use the product.

Installing a Desktop Application


Windows creates special folders for storing system and application files called
"Windows" and "Program Files." The contents of these folders should not be
changed manually. Moving or deleting files in these folders could cause
Windows or software applications not to start properly. Access to these folders
and files is restricted to administrative users in any case.

Applications should be installed using the supplied setup program. To install a


program, the user account must be a Computer Administrator. An application's
setup files are usually either provided on a setup disc or downloaded from the
Internet.

■ Put the program disc in the drive and choose the option to install the
software.

■ Download the setup program from a website then locate and open the
setup program through Explorer.

Page 125
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2

In order to install a program successfully, you should exit any other


applications or files. You may also need to disable anti-virus
software.

When you try to install a program, you will see another example of Windows'
User Account Control (UAC) security feature in action. UAC prompts you to
confirm any important change to the system, such as installing a program or
hardware device or changing a security setting. In the case of programs,
Windows also checks whether the program has a digital certificate proving it
has been created by a trustworthy software publisher; if a certificate is not
there or not valid, Windows displays another warning.

Untrusted publisher warning—this does not necessarily mean that the program is harmful as not
all publishers obtain valid certificates but do not run it if you do not know that it is from a reputable
source. Screenshot used with permission from Microsoft.

Confirm the UAC prompt if you are happy to proceed. The setup program will
then provide a wizard for you to choose the appropriate options, such as
choosing program components, selecting the install location (always choose
"Program Files" unless you have a good reason not to), and creating shortcuts.

Advanced Options
Most software installer packages offer a choice between a default installation
and a custom (or advanced options) installation. A custom installation allows
you to choose specific settings, such as where to install the software and what
icons or startup/autorun options to configure. A custom installation may also
involve the selection of specific feature sets or modules within the software
package.

Page 126
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Microsoft Store Apps Using Apps

In recent versions of Windows, you can install two types of software. Desktop
applications are installed and managed using Programs and Features, as
described above. Apps are installed and managed via the Microsoft Store.

Microsoft Store. Screenshot used with permission from Microsoft.

Unlike desktop applications, store apps run in a restrictive sandbox. This


sandbox is designed to prevent a store app from making system-wide changes
and prevent a faulty store app from "crashing" the whole OS or interfering with
other apps and applications. This extra level of protection means that users
with only standard permissions are allowed to install store apps. Installing a
store app does not require confirmation with UAC or computer administrator-
level privileges.

Application Management

Once the application has been installed, there are various ways to perform
additional configuration and application management.

Configuring Application Compatibility


After an application has been installed, you may experience difficulties getting
it to run. If this is the case, you can inspect the properties of the executable file
(or a shortcut to the executable). The Details tab is useful for troubleshooting,
as it will let you know whether you are running a version with the latest
patches. The Compatibility tab can be used to run the program in a
compatibility mode (for Windows 98 for instance) and adjust the display
settings.

Page 127
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2 Windows features such as UAC and its greater protection for system folders
(Program Files and the system root) plus the redesigned desktop compositing
engine have made application compatibility more challenging. UAC problems
can be solved by running the program as an administrator, and there is an
option to turn off advanced desktop compositing effects.

Use the Details tab in a program's Properties dialog to find the version number and the
Compatibility tab to configure settings for legacy applications. Screenshot used with permission
from Microsoft.

If you need a user to tell you the version number, it is usually listed
by selecting the "About" menu option in the software. The "About"
option may be accessed via a “Help” menu.

Repairing and Uninstalling Software


If a software program stops working, the best solution is usually to uninstall
then reinstall it. Some programs may also support a Repair option, which can
be a bit quicker and preserve your custom settings. Some programs may have
optional components, which you can add or remove using the Change option.
You will also want to uninstall unneeded programs. A new PC or laptop may
come with bundled software programs and trial versions (sometimes unkindly
referred to as “bloatware”). There may also be programs you no longer use. To
use any of these options, open Programs and Features in Control Panel,
click the program icon, then choose the appropriate option.

In order to uninstall a program successfully, you should close any


applications or files that might lock files installed by the application
or the PC will need to be restarted. You might also need to disable
anti-virus software (although not Windows Defender). If the
uninstall program cannot remove locked files, it will normally
prompt you to check its log file for details. The files and directories
can then be deleted manually.
Page 128
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
If uninstalling and reinstalling does not work, you may need to perform a clean Using Apps
uninstall. Essentially this means removing files and settings manually,
following the instructions on the vendor's website.

Programs and Features—select a program then choose an option from the toolbar. Screenshot
used with permission from Microsoft.

If you click View installed updates, the list will display patches or hotfixes
installed for Windows. You can use the wizard to uninstall a patch.

Enabling and Disabling Windows Features


Windows comes with a number of components and add-ons that may be
enabled or disabled by default. You can control these by clicking the Turn
Windows features on or off link in Programs and Features.

Turning Windows features on or off. Screenshot used with permission from Microsoft.
Page 129
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2
Managing Software Licensing

When installing an app, you need to ensure that the software is properly
licensed for use.

Software Licensing and Agreements


When you buy software, you must read and accept the license governing its
use, often called the End User License Agreement (EULA). The terms of the
license will vary according to the type of software, but the basic restriction is
usually that the software may only be installed on one computer (single use
license).

Usually, the software is activated using a product key, which will be a long
string of characters and numbers printed on the box or disk case. The product
key will generate a different product ID or serial number, which is often used
to obtain technical support. The product ID is usually displayed when the
application starts and can be accessed using the About option on the Help
menu.

A company may have hundreds of employees who need the same software on
their computers. Software manufacturers do not expect such companies to buy
individual copies of the software for each employee. Instead, they will issue
either a group use/site license, which means that the company can install the
software on an agreed number of computers for an unlimited number of
employees to use at the same time, or a concurrent license, which means
that the company can allow only a set number of users access to it at any one
time. It is important to monitor usage of the software to ensure that the
permitted number of host-installs or concurrent users is not exceeded.

If a site has a large number of computers, these computers are often


networked. This means that software bought under license can be installed
onto a network server so that all authorized users can access it without it being
installed on each individual computer. These are referred to as Client Access
Licenses (CAL).

It is illegal to use or distribute unauthorized copies of software (pirated


copies). Pirated software often contains errors and viruses as well.

Another important aspect of a software agreement is how any data gathered


and processed by the software is used, stored, and retained by the software
vendor.

Page 130
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Registration Using Apps

The software setup program will often prompt you to register the application,
either using an online form or the card supplied with the setup disc. Registering
is usually optional but may be required to obtain product support and updates
and validate the warranty.

Subscription versus One-time Purchase


Historically, software licensing tended toward one-time purchases of licenses
for a given number of devices or user seats. The one-time purchase price
would give perpetual use of the software, though subsequent upgrades would
normally involve a new license fee. This model is being replaced by
subscription-based licensing, where organizations pay a per-user monthly
fee to get access to the software. In this model, upgrades are provided as part
of the subscription. Examples of subscription pricing include Adobe Creative
Cloud and Microsoft Office 365.

Shareware, Freeware, and Open Source Applications


Not all software is distributed using the commercial licensing or subscription
models described above. Shareware, freeware, and open source licenses
represent some different ways of making applications available.

■ Shareware is software that you can install free of charge so that you can
evaluate it for a limited period. If you decide to continue using the software
after this period, you must register it, usually for a fee. When you register
the software you often become entitled to extra features and support.

■ Freeware is software that is available free of charge.

Even if software is distributed as shareware or freeware, the


copyright is still held by the publisher or designer. Both shareware
and freeware may still be governed by a license, which may restrict
its use (for example, to prevent commercial use of the product or
unauthorized redistribution or resale).

■ Open source is software that also makes the program code used to
design it available. The idea is that other programmers can investigate the
program and make it more stable and useful. An open source license does
not forbid commercial use of applications derived from the original, but it is
likely to impose the same conditions on further redistributions.

Page 131
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2
Productivity Software

Productivity software refers to applications that help users complete typical


office tasks. Such tasks might include writing a letter or report, making a sales
presentation, or processing orders.

Most productivity software is sold or distributed in suites, such as Microsoft


Office or Open Office. Each application within the suite shares a common look
and feel with other applications, helping users to switch between them more
easily. Using an integrated software suite means that users can learn to use
the basic layout and commands of an application more quickly (for example, to
access file commands, run a spell check, and so on). It is easier to share data
between the different applications (for example, to embed a spreadsheet in a
word-processed report).

Web Browser Software


While there is some risk that an employee with access to a web browser will
waste a certain percentage of the work day, web access is important to many
professions and organizations, not only for information and research but also
to contact customers, suppliers, and business partners through social media.

Spreadsheet Software
A spreadsheet consists of a table containing rows, columns, and cells. When
values are entered into the cells, formulas can be applied to them, enabling
complex calculations to be carried out. Spreadsheet packages can be used for
many tasks including tracking and analyzing sales data and working on
company accounts.

Microsoft Excel spreadsheet software. Note the lettered columns and numbered rows. Each
intersection is a cell that can contain data or a formula. Screenshot used with permission from
Microsoft.

Page 132
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Word Processing Software Using Apps

Word processing means applications that help users to write and edit
documents. A word processor will come with features enabling the user to edit
and review text quickly, using an automated spell checker for instance. Most
word processors also provide formatting and layout tools, allowing the use of
pictures and tables in a document for instance. They are also likely to allow
output to different formats, such as print or online web page.

Presentation Software
Presentation software enables users to create sophisticated slide shows.
Pictures, company logos, graphs, and text can be added to the slides, together
with a variety of animations.

Visual Diagramming Software


Diagrams are an important means of communicating or recording ideas or
configurations clearly. Visual diagramming software assists the creation of
these by providing templates and shapes for different kinds of diagram. The
user does not have to worry about creating icons or shapes; they can just drag
shapes from the template (or stencil) into the diagram and use the software
tools to connect them appropriately.

Microsoft Visio diagramming software with a network diagram document open. In this sort of
diagram, you can add shapes from the stencil collections shown on the left of the window and then
draw connectors to link the shapes. Screenshot used with permission from Microsoft.

Page 133
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2
Collaboration Software

Collaboration software means that multiple users can work together on the
same file or project.

Email Software and Personal Information Managers


Email software is an application that allows the user to compose and send
messages and then receive messages from others. The email client software
works in conjunction with an email server, which handles the business of
actually transmitting the messages over the network.

Email software is very often coupled with a Personal Information Manager


(PIM). PIM software provides features for storing and organizing information,
such as contacts and calendar events and appointments.

Windows Mail client. Screenshot used with permission from Microsoft.

Online Workspaces and Document Storage/Sharing


An online workspace is one where a file is hosted on a network, and users
can sign in to get access to it. Different users might be assigned different
permissions over the document. For example, some users may be able to view
or print the document or add comments to it; others may be able to edit it.

As with email, this type of application uses servers and clients. The server
software, such as Microsoft's SharePoint Server, or cloud-based services,
such as Google Drive or Smartsheet, provide the storage and sharing features.
The workspace server hosts the document and contains the accounts and
permissions of the users allowed to access it.

Page 134
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
The client software provides the user with the tools to view and edit the Using Apps
document. The client software might be a productivity suite (such as Microsoft
Office) or might be provided with the workspace (Google Docs and Smartsheet
tools for instance).

Editing a document stored in Microsoft's OneDrive cloud storage solution with a cloud-based
version of Microsoft Word. Screenshot used with permission from Microsoft.

When multiple users are editing a document, there has to be a process for
managing changes. One option is to provide a "check out" feature, where a
user checks a document out for editing, and it becomes locked for other users.
Another option is to allow a master editor to view multiple revisions and
approve and merge or reject changes to a single published version.

Remote Desktop and Screen Sharing Software


Remote Desktop allows a user to connect to a computer over a network. The
remote desktop server runs on the target computer. The user starts a remote
desktop client application and enters the connection information. When the
connection is established, the user can operate the remote computer's desktop
via a window on their local computer.

An ordinary user might use remote desktop to connect from a field laptop to a
machine in the office. Remote desktop is also used by IT support staff to login
to a user's computer to provide support and assistance without having to travel
to the user's location.

Remote connection utilities can also be used in a "read-only" type of mode to


facilitate screen sharing. This means that the remote user can view the host's
desktop but cannot interact with it. This mode is often used for software
demonstrations and for product support.

Page 135
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2

Operating a Windows 7 host from a Windows 10 client using Remote Desktop. Screenshot used
with permission from Microsoft.

Instant Messaging and VoIP Software


Instant Messaging (IM) software allows users to communicate in real time.
Unlike with email, there is (virtually) no delay between sending and receiving a
message. Basic IM software allows for the transfer of text messages and can
also be used for file attachments. These days, all IM applications facilitate
voice and video calls too.

Voice over Internet Protocol (VoIP) packages voice communications as data


packets, transmits them over the network, then reassembles the packets to
provide two-way, real-time voice communication.

Configuring audio devices in Skype. Screenshot used with permission from Microsoft.

Page 136
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
There are numerous different ways of implementing VoIP, each with different Using Apps
protocols which are often proprietary to a particular VoIP software vendor. To
implement VoIP to make calls from a computer in a typical Peer-to-Peer
configuration, you need software (such as Skype or Slack), an Internet
connection, and usually a headset (more convenient than using PC
microphone and speakers).

IM software requires a good quality network link between the participants.


"Real-time" applications such as IM are sensitive to latency, which is the delay
in seconds that a packet of data takes to travel over a network. IM voice and
video calling also requires sufficient bandwidth. These factors might be
controllable on a private network, but on the Internet, where a packet might
traverse many different networks to reach its final destination, link quality is
more difficult to guarantee.

Video Conferencing Software and Telepresence


Video conferencing or Video Teleconferencing (VTC) software allows users
to configure virtual meeting rooms, with options for voice, video, and instant
messaging. Other features often include screen sharing,
presentation/whiteboard, file sharing, and polls and voting options. Most
conferencing suites also provide a fallback teleconference option, to be used in
conjunction with the presentation features, in case some participants cannot
get a good enough connection for an IP voice or video call.

Telepresence is a term used to refer to particularly sophisticated video


conferencing solutions. The idea is that the participants have a real sense of
being in the same room. This can be achieved by a number of video
technologies, including HD or 4K resolutions, large and/or curved flat-screens,
and 3D. Emerging technologies might make use of virtual reality headsets,
holograms, and robotics.

Business Software

Productivity software covers general office functions and tasks. Applications


such as spreadsheets and databases can be developed to perform a wide
range of tasks, covering operations from accounting and sales to production
and distribution. However, a company or individual will often want to use
specialized business software designed to assist with a particular business
process or consumer demand.

Desktop Publishing Software


Desktop Publishing (DTP) is similar to word processing but with more
emphasis on the formatting and layout of documents than on editing the text.
DTP software also contains better tools for preparing a document to be printed
professionally. DTP software combines text and images in the best possible
layout for a wide variety of media, including books, magazines, posters,
ebooks, and web pages.
Page 137
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2 Graphic Design
DTP and web design software is often used in conjunction with graphic
design applications. There are many types of graphic design applications,
which can be broadly categorized as follows:

■ Digital darkroom products such as Adobe Photoshop assist with the


correction and manipulation of photographic images.

■ Digital paint products such as Corel Painter allow the creation of bitmap
artwork on a computer.

■ Digital drawing products such as Adobe Illustrator allow the creation of


vector-based line art.

Bitmap artwork means that the file records the color value of each
pixel in the image. Vector artwork records the plot points and color
values of the lines and shapes used. Vector artwork can be resized
without loss of quality whereas resizing a bitmap will require some
pixels to be lost or added, using some dithering process to
determine the color values of the remaining pixels.

■ 3D and animation packages allow the creation of digital films or creation of


effects in motion pictures.

Computer Aided Design (CAD)


Computer Aided Design (CAD) software makes technical drawings and
schematics easier to produce and revise. Drawings can be rotated or viewed in
3D and easily transmitted to a client for feedback. CAD is often linked to
Computer Aided Manufacturing (CAM) which enables the data produced in
CAD drawings to be loaded into a machine which then manufactures the part.

Project Management
Project management involves breaking a project into a number of tasks and
assigning responsibilities, resources, and timescales to ensure the completion
of those tasks. Project management also involves identifying dependencies
between tasks. Software such as Microsoft Project or Smartsheet assists with
this process by visualizing task timelines and dependencies and recording
information about task properties and progress.

Accounting and Commercial


There are many software applications designed to support financial and
commercial functions, such as order processing, accountancy, and payroll.
For corporates and Small and Medium Sized Enterprises (SME), these
packages allow companies to input orders and create invoices and profit and
loss reports. There are also consumer versions designed to help with
household budgets and financial planning.
Page 138
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Another important class of commercial software is Customer Relationship Using Apps
Management (CRM). These are applications for organizing sales leads and
contacts. There are also any number of programs designed to assist with
marketing, including optimizing use of the web and social media.

Database Software
Database packages enable the user to store, organize, and retrieve
information. Databases can search through thousands of records very quickly
and display data in a format specified by the user. They can be used to store
many different types of information, such as timetables, customer details, and
patient records. The database application in Microsoft Office is called Microsoft
Access. This is suitable for creating databases with tens of users.

Databases are also used at every level of IT infrastructure. Fast and reliable
database products are as important as operating systems for large
organizations. Examples of enterprise-level database products include SQL
Server and Oracle. The XML (eXtensible Markup Language) format is also
increasingly important for data storage, as it allows for a high level of
integration between different types of systems.

Business-specific
A company may also commission custom-made software to implement specific
Line of Business (LOB) functions. LOB applications would cover functions
that cannot be performed by "off-the-shelf" software. This might include
product design and manufacturing, fulfilment and inventory control, plus
marketing and sales.

Page 139
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2

Review Questions / Module 2 / Unit 2 / Using Apps


Answer these questions to test what you have learned in this unit.

1) What compatibility information should you confirm before installing a


software application?

2) Following installation of a program written for an older version of Windows,


you receive an alert that it might not have installed correctly. What feature
could you use to make the program run correctly?

3) Why would Windows prompt you to enter a password if you try to install a
software application?

4) Windows comes with web server software but it is not enabled by default.
How would you install this software?

5) Following installation of an application, another program on your computer


has stopped working. What could you do to try to fix it?

6) Why might one of your first tasks on receiving a new computer be to


remove software applications?

7) In order to obtain support, the software vendor wants to know the


application's product ID. How would you locate this information?

8) What is the difference between freeware and open source software?

9) What type of software would you use to configure a server by connecting to


it over the network?

10) What type of software manages tasks, dependencies, and timelines?

Page 140
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Apps

Lab 7 / Managing Software Applications


In this lab, you will install and uninstall a software application and examine
Windows Update settings.

The software application you will install displays technical information about
the system components installed on your computer. It is published by CPUID.
Optionally, browse CPUID's website (cpuid.com) before proceeding to learn
about the company and its products.

This lab involves downloading and installing a program from a


third-party website. The authors and publisher believe the website
and program to be reputable and pose no risk to your computer or
personal information but cannot be held responsible for any loss or
damage that may occur as a result of following the steps in this lab.
If you have any concerns we recommend that you do NOT
proceed.

1) If necessary, start your computer and sign in.

2) Open Microsoft Edge (or your preferred browser), and type the following
URL into the address bar:

http://download.cpuid.com/cpu-z/cpu-z_1.85-en.exe
3) In the prompt box displayed at the bottom of the window, click Run.

In the "Open File—Security Warning" dialog, note that the publisher is


identified as CPUID. When you allow a software program to install itself,
you need to be confident that it is a legitimate application (not a Trojan
Horse that might be installing some malware). If the setup program is
digitally signed and comes with a trusted certificate, then that is some
evidence that the software is trustworthy.

4) Optionally, click the CPUID link then inspect the publisher's digital
certificate. If you are happy to proceed, click Run.

The fact that the certificate is issued by a company that Windows


trusts (DigiCert) is a fair indication that the publisher is legitimate.
You should always take care when installing software from
unknown sources.

Page 141
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 2 5) Complete the application's Setup wizard by making the following choices:

○ Select I accept the agreement and click Next.

○ Accept the default installation folder and click Next.

○ Accept the default start menu folder and click Next.

○ Accept the option to create a desktop shortcut and click Next.

○ Select Install.

○ When installation is complete, uncheck the View readme box and click
Finish.

6) Show the desktop and open the CPUID CPU-Z icon.

The User Account Control dialog is displayed. CPU-Z obtains detailed


information about system components by installing a special device driver
each time it runs. This requires administrator-level access to perform.

If you were not sure of the provenance of the software, you might
be suspicious of software that requests this level of access.

7) If you are happy to proceed, click Yes.

The program will execute and display a dialog showing detailed information
about the CPU, memory modules, motherboard, and graphics adapter
installed in your computer.

CPU-Z utility from CPUID (cpuid.com).

Page 142
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
8) Browse the information reported by selecting the tab headings for a few Using Apps
minutes, then click Close.

We recommend that you do NOT select options from the Tools


menu, as these link to ad-supported software programs.

9) Press START+X then select Apps and Features.

You can also display this shortcut menu by right-clicking the Start
button. It contains most of the "power" tools for configuring
Windows.

10) Select the CPUID CPU-Z icon and click the Uninstall button. Click
Uninstall to confirm.

11) Click Yes to confirm (again) then OK when the process is complete.

12) Take a moment to browse the programs installed on your computer. This
view shows you when a program was installed, its size, and (in some
cases) its version number.

13) Press START then type appwiz.cpl and click the icon for the Control
Panel applet returned in the search results.

Programs and Features is the older program management interface. This


only lists desktop applications (not Windows Store apps).

14) In the left-hand pane of "Programs and Features," click Turn Windows
features on or off.

15) Browse the features already installed and available then click Cancel.

16) In the left pane of "Programs and Features," click View installed updates.

You can use this view to check whether a particular update is installed.

17) Close any open windows.

18) Optionally, shut down your computer if you are not continuing to use it after
this lab.

Page 143
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3
Module 2 / Unit 3
Programming and App Development

Objectives
On completion of this unit, you will be able to:

□ Describe programming organizational techniques and logic.

□ Categorize types of programming languages and list the advantages and


disadvantages of each type.

□ Describe some of the main features of application code and Object-


Oriented Programming.

□ Describe the ways that an application can be deployed.

Syllabus Objectives and Content Examples


This unit covers the following exam domain objectives and content examples:

□ 3.4 Explain methods of application architecture and delivery models.


Application delivery methods—locally installed (Network not required,
Application exists locally, Files saved locally) • Application delivery
methods—Local network hosted (Network required, Internet access not
required) • Application delivery methods—Cloud hosted (Internet access
required, Service required, Files saved in the cloud)

□ 3.6 Compare and contrast general application concepts and uses.


Single-platform software • Cross-platform software (Compatibility concerns)

□ 4.1 Compare and contrast programming language categories.


Interpreted (Scripting languages, Scripted languages, Markup languages) •
Compiled programming languages • Query languages • Assembly
language

□ 4.2 Given a scenario, use programming organizational techniques and


interpret logic.
Organizational techniques (Pseudocode concepts, Flow chart concepts,
Sequence) • Logic components (Branching, Looping)

□ 4.3 Explain the purpose and use of programming concepts.


Identifiers (Variables, Constants) • Containers (Arrays, Vectors) • Functions
• Objects (Properties, Attributes, Methods)

Page 144
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming Logic Programming and App
Development

Apps, of whatever type, are created by programmers in a process of software


development. Programmers (or coders) are individuals who work with one or
more programming languages to write code that is used as the basis for the
applications that you use on your computing device.

Program Sequence
A program is just a sequence of instructions for your computer to perform. For
example, you might want to add two user-entered numbers together and
display the sum on the screen. In plain English, the program might look
something like this:

1) Clear the current display.

2) Ask the user for the first number and store that number for subsequent use.

3) Ask the user for the second number and store that number for subsequent
use.

4) Retrieve the two stored numbers and add them together.

5) Display the result.

It’s a simple set of instructions, but while English can tolerate ambiguity,
programming generally cannot. In designing a program, we have to consider
how input, processing, and output are all clearly defined. What if the user
entered a word instead of a number? What if the user doesn’t understand
what’s required? You could modify the program to address these issues:

1) Clear the current display.

2) Output to the screen the instructions for the operation.

3) Ask the user for the first number.

4) Verify that the entered value is a number:

a) If it is, proceed.

b) If it is not, remind the user what the valid range is and prompt again.

5) Store that number for subsequent use.

6) Ask the user for the second number.

7) Verify that the entered value is a number:

a) If it is, proceed.

b) If it is not, remind the user what the valid range is and prompt again.

8) Store that number for subsequent use. Page 145


Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 9) Retrieve the two stored numbers and add them together.

10) Display the result.

Using a Flow Chart


As this restatement of the program is getting significantly more complex, it
might help to visualize it. You could view the sequence as a graphical flow
chart to help understand the processes.

Flow chart of simple program.

With the steps shown visually in a diagram, it is easier to see that the program
is not completely linear. There are branches and loops. Also notice that the
program contains some duplicate steps; specifically, the verification steps and
the display instructions steps. We can use the diagram to analyze the
sequence of instructions and write better code to support that sequence.

"Better" code is a matter of some judgement, but it is desirable for


a program to be as compact and efficient as possible. The fewer
lines of code that can be used to perform the necessary
instructions, the easier the code will be to maintain and update.

Page 146
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Writing Pseudocode Programming and App
Development

Having analyzed the structure of our program, we can switch from writing out
the steps as a simple list and start to develop code blocks to support the
program's function.

For example, where there are duplicate steps, you could write those as
separate subroutines and then call them whenever needed.

'Main routine
Add It Up routine {
clear display
call Display Instructions routine
prompt for first number
call Verify subroutine
store first number Variable1
prompt for second number
call Verify subroutine
store second number Variable2
sum (Variable1, Variable2)
write sum to display
}
End routine
'Verify subroutine
Verify subroutine {
verify user input is number
if FALSE, call Display Instructions subroutine
return
}
End routine
'Instructions subroutine
Display Instructions subroutine {
clear display
write "instruction text" to display
prompt OK
clear display
return
}
End routine

Page 147
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 Features of Programming Code
We haven’t used the specific syntax of a particular programming language yet,
but already, this is starting to look like a program (pseudocode). Note some of
the features:

■ The main routine calls some subroutines. Each routine is completed by an


"End Routine" statement. This means (for example) when the program
reaches the last step of the main routine, it closes rather than flowing
through to try to execute the first subroutine.

■ When a subroutine completes, it can return to the point in the main routine
from where it was called, and the main routine continues execution. Note
that when we use structures such as this, we have to be very careful not to
create infinite loops in the code by mistake.

■ There is a conditional statement (IF) that means part of the code only
executes when certain conditions are true or false.

■ There are variables to store data input by the user.

■ There are functions (such as "sum" and "write") that we can assume are
provided as features of the programming language. We don't need to code
how to add two numbers together or write output to the display screen.

■ There is a user interface that the program interacts with (prompting for
input and displaying output).

■ It contains comments, preceded by the ' character. Comments are part of


the programming code that are not executed by the computer but that help
the developer read and maintain the code.

Programming Languages

Having created the logic behind your program, you must then code it using the
appropriate programming language. It’s important to consider what
programming language to use. The choice that you make will be determined by
many factors, including:

■ What type of program you are writing.

■ How experienced you are as a programmer.

■ What type(s) of device(s) your users will be using.

A programming language provides the exact syntax for you to use for your
code. For example, the character used for a comment or the way conditional
statements are written out varies from language to language. Some languages
provide more built-in functions than others.

There are many programming languages to choose from, but the most popular
are:
Page 148
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
■ Java Programming and App
Development

■ Python

■ JavaScript

■ C++

■ C#

■ PHP

■ Perl

■ Ruby

You can also divide programming languages into a number of broad


categories, such as compiled, interpreted, and query languages.

Compiled Programming Languages


When you write a program using a compiled programming language, you
must transform the code to an executable binary before it can run. Compiling
converts the source code that you wrote to machine code. Machine code is
the instructions converted to strings of ones and zeros for the CPU to process.
A compiled program generally runs quickly (compared to interpreted code).
However, a compiled program tends to be platform (CPU) specific; to run on
other platforms, you must recompile the source code for the new platform. The
following languages are compiled:

■ C++

■ C#

■ COBOL

■ PASCAL

Interpreted Programming Languages


When you write code with an interpreted language, you do not need to compile
the program. It runs within the context of an interpreter, which converts the
code into machine code at runtime. This means that the program probably runs
more slowly but also means it is likely that you can run the program on any
platform for which you have an interpreter. Examples of interpreted languages
include scripting languages, such as JavaScript, Perl, and Python.

The interpreter can either be part of the operating system, or it can be provided
as a virtual machine, such as the Java VM. With a Java VM, you develop the
programming code in the Java environment and deploy it to your hosts. Each
host OS (Windows versus Linux versus macOS for instance) has a different
Java VM. When you package your Java program, your source code is
compiled to a form called bytecode for the Java VM and the VM converts it to
machine code to run on the hardware platform.
Page 149
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Some programming languages support both compiled and


interpreted modes of execution.

Query Languages
Code written in a query language, such as Structured Query Language (SQL),
is designed to retrieve specific records from a dataset. The code does not
need to be compiled.

See Unit 2.4 for more information about query languages and
databases.

Assembly Language
An assembly language represents machine code in human-readable text. An
assembly language is typically specific to a particular hardware architecture.
This is in contrast to compiled, interpreted, and query languages which you
can use to write code that can be run on a number of platforms, assuming you
have an appropriate compiler or interpreter. Even though it is in human-
readable text, assembly code is very difficult to follow and is only really used by
specialists trying to solve a very particular problem with an application. You
would not choose an assembly language to start your new development
project.

Markup Languages
A markup language is not a programming language but a means of making
data in a document accessible to a program. A markup language, such as the
HyperText Markup Language (HTML) or eXtensible Markup Language (XML),
defines a series of nested tags that describe the structure and/or meaning of
the tag contents.

For example, consider the following HTML markup:

<html>
<body>
<h1>Hello World</h1>
<p>Say hello back to <a href="mailto:[email protected]>
CompTIA</a>!</p>
</body>
</html>
The tags tell a client application (such as a browser) how to structure the
document:

■ html—this top-level parent element identifies the type of document. All the
other tags are nested within this one.
Page 150
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
■ body—indicates the main part of the content as a page to show to the Programming and App
Development
client. HTML files can also have head sections, which would not be shown
as part of the page display.

■ h1—indicates that the content is a heading level.

■ p—indicates the content is a paragraph-level block.

■ a—indicates that the content links to another resource. In the example, this
is an email address, but it could be another section of the page or another
file or a page on another web server.

Note that each tag has a start and close element.

Programming Concepts

In order to write a program using a particular programming language, you must


first understand the structure and syntax of the language. Most programming
languages share similarities in their structure and syntax, but it is important to
use the specific syntax correctly as any errors will cause the code not to
compile or run. Without discussing the specifics of any particular language, the
following topics list some of the basic building blocks and structures used.

Identifiers
An identifier is used in a program to access a program element, such as a
stored value, class, method, or interface. For example, you might assign the
identifier FirstName to a stored value that contains a user’s first name. In
essence, an identifier is a label for something within your program. If your
identifier stores data, then it will be either a variable or a constant.

Variables
A variable contains a value that can change during the execution of the
program. This value might be a text string, a number, or any other data type.

Variables are usually declared, defined as a particular data type,


and given an initial value at the start of the routine in which they are
used. It is often possible to use undeclared variables, but this can
make code harder to read and more prone to errors.

Using our example of a first name, it’s important to understand that although a
person’s name might not change, if you use a programmatic technique to refer
to a user’s name without knowing which user you’re referring to, then, as far as
the program is concerned, that is a variable. You can assign a value to a
variable using fairly simple code.

Page 151
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 For example, the following pseudocode declares our FirstName variable to
store a string value with an initial value Andy, then sets it to a value from a
data store:

declare FirstName as String = "Andy"


FirstName = find LastLoggedOnUser and get FirstNme
print FirstName
Running this code might produce the following output:

James

Constants
A constant is a specific identifier that contains a value that cannot be changed
within the program. For example, you might want to store the numerical value
for the screen dimensions or resolution.

Containers
Container can be used as a term for a special type of identifier that can
reference multiple values (or elements). One example of a container construct
is a simple array. For example, say that you want your program to store a list
of user names who have logged on to the computer in the last 24 hours. You
would declare the array with the data type of the values it will contain and the
number of elements or "rows" that the array can contain:

declare Logons(9) as string

Elements in the array are counted from zero so the Logons(9) array
contains up to 10 elements.

The following pseudocode would add a value to the first element in the array:

Logons(0) = find LastLoggedOnUser and get FirstName


In this example, the array has a single dimension. Arrays can also be
multidimensional, which you can visualize as like a table with multiple columns.
Note that all the elements must be the same data type. For example, the
following code creates a two-dimensional array:

declare Logons(9,1) as string


The following pseudocode would populate the first "row" in the array, with the
first name going into the first column and the logon time into the second:

Logons(0,0) = find LastLoggedOnUser and get FirstName


Logons(0,1) = find LastLoggedOnUser and get Time
One of the limitations of the array container type is that it cannot be resized.
Most programming languages support container types called vectors that can
grow or shrink in size as elements are added or removed.

Page 152
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Branches Programming and App
Development

Your program runs from the start to the end unless you instruct it to deviate
from this path. One way of doing so is to create a branch; this is an instruction
to your computer to execute a different sequence of instructions. You use
branches to control the flow within your program. For example, you might
create a branch based on a condition. We saw this in our earlier example
when we verified a number had been entered correctly. If it had, then
something happened, and if it had not, then something else happened. This is
a conditional branch.

For example, in the following pseudocode, the value of a variable called


DisplayNumber is compared to 25. If DisplayNumber is greater than 25,
then a variable called Count is incremented by 1. If DisplayNumber is less
than 25, no action occurs and the variable Count remains the same.

If DisplayNumber > 25 Then


Count = Count+1
End If

Loops
Loops are similar to branches in as much as they deviate from the initial
program path according to some sort of logic condition. However, with a loop,
you instruct your computer to perform, or repeat, a task until a condition is met.
For example, you might create a loop that continues until a certain amount of
time has elapsed or until a counter reaches a certain level. Then, a
predetermined action might occur, depending upon what you want. In the
following example, the program loops around until the value of i is 5. Then the
program proceeds to the next statement.

For i = 1 to 5
print i
Next
As well as "For" structures, loops can also be implemented by "While"
statements:

Do While i <= 100


i = i + 1
print i
Loop

As mentioned above, you need to make sure your code does not
contain unintended or infinite loops. Without the statement to
increment i in the Do loop example above, the loop would continue
forever. An infinite loop will make the process hang.

Page 153
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 Operators
Looping and branching structures depend on logical tests to determine
whether to continue the loop or the branch to follow. A logical test is one that
resolves to a TRUE or FALSE value. You need to be familiar with basic
comparison operators:

■ == is equal to (returns TRUE if both conditions are the same).

■ != is not equal to.

■ < less than.

■ > greater than.

■ <= and >= less than or equal to and greater than or equal to.

You might also want to test more than one condition at the same time. The
logical operators are as follows:

■ AND—if both conditions are TRUE, then the whole statement is TRUE.

■ OR—if either condition is TRUE, then the whole statement is TRUE.

■ XOR—if either condition is TRUE but not both, then the whole statement is
TRUE.

You can also use the negation operator NOT to reverse the truth value of any
statement.

Procedures and Functions


Both procedures and functions enable you to create segments of code that
you will reuse. In our earlier example, we used a function to check that the
user had entered a number. The key difference, in programming terms,
between a procedure and a function is that the latter can return a value to
whatever called it, whereas a procedure cannot. For example, the following is
a procedure:

Verify subroutine {
verify user input is number
if FALSE, call Display Instructions subroutine
return
}
Whereas, the following is a function:

Verify function {
IsNumber = verify user input is number
return IsNumber
}

Page 154
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
In the function, the value of IsNumber, which will either be TRUE or FALSE, is Programming and App
Development
returned to the main program for some further processing.

Comments
As noted above, it is important to use comments in code to assist with
maintaining it. A comment line is ignored by the compiler or interpreter. A
comment line is indicated by a special delimiter, such as double forward slash
(//), hash (#), or apostrophe (').

Object-Oriented Programming

Object-Oriented Programming (OOP) is a popular way of designing code.


The idea is that creating recognizable things within the code and making them
interact through defined methods makes the code easier to maintain and
update. An object can have inner workings that other parts of the program
cannot affect and outer or public values and things that the object can do that
other parts of the program can read or ask the object to change or do.

Objects can have attributes (fields), properties, and methods:

■ Attributes are values and data types that define the object. The attributes
are stored within the object as fields or private variables. Other programs
cannot access or change the fields directly. They must call a particular
method (see below) to do that.

■ Methods define what you can do to an object. For example, a Customer


object might have a ChangeAddress method. When another part of the
program calls the ChangeAddress method, it also passes a string
(hopefully containing a well-formatted address) to the object because that
is what the method expects. The object's code receives this string, checks
that it can be used as a valid address, and updates its Address field. The
object might then have another method (PrintAddress) allowing another
part of the program to find out what the current value of the Address field
is.

The important part is that the external code cannot interact with the
field directly.

■ Properties represent an alternative way of accessing a field publicly. Using


a method might be regarded as quite a "heavyweight" means of doing this,
so properties allow external code to ask the object to show or change the
value of one of its fields.

While it's not mentioned in the syllabus, the concept of a class is


also important to OOP. A class defines what a "thing" can be like,
while an object is an instance of a thing created from a class.
Page 155
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3
Scripting Languages

We learned earlier that some of the interpreted programming languages are


scripting languages. You can also make a distinction between the general
purpose interpreted scripted languages, such as JavaScript or Perl, discussed
above and scripting languages, such as Windows Command Prompt, Windows
PowerShell, or Linux Bash. These languages support the automation and
configuration of a particular operating system.

Just to confuse things, most languages can call (or "wrap") system
commands as part of the code and can therefore also be used for
scripting.

Whatever language is used to create it, a script is a smaller piece of code than
a program. A script is generally targeted at completing a specific task, whether
that task is based within a web-based application or is used by a network
administrator to perform a repetitive administrative task. While a program
usually provides some sort of unique functionality, anything a script does could
usually be performed manually by a user.

Writing scripts is a good place to learn the basics about programming. They
are usually simpler to learn, require no compiling, and are well documented on
the Internet, should you require guidance or samples.

In Windows 10, you can create simple scripts using a number of different tools.

Batch Files
Batch files are a collection of command-line instructions that you store in a
.CMD file. You can run the file by calling its name from the command line, or
double-clicking the file in File Explorer. Generally, batch file scripts run from
end to end and are limited in terms of branching and user input.

Windows batch file. Screenshot used with permission from Microsoft.

Page 156
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Windows PowerShell Programming and App
Development

Windows PowerShell enables you to perform management and administrative


tasks in Windows 10 and Windows Server 2016 (and some earlier versions). It
is fully integrated with the operating system and supports both remote
execution and scripting. To help create and manage your Windows PowerShell
scripts, Microsoft provides the Windows PowerShell Integrated Scripting
Environment (ISE).

Windows PowerShell ISE. Screenshot used with permission from Microsoft.

VBScript
VBScript is a scripting language based on Microsoft’s Visual Basic
programming language. It provides similar functionality to JavaScript. VBScript
is often used by network administrators to perform repetitive administrative
tasks. With VBScript, you can run your scripts from either the command line or
from the Windows graphical interface. Scripts that you write must be run within
a host environment. Windows 10 provides Internet Explorer, IIS, and Windows
Script Host (WSH) for this purpose.

Visual Basic Script in Windows 10. Screenshot used with permission from Microsoft.

Page 157
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3
Application Platforms and Delivery

Once you have written and tested your code, you need to package it as an
executable or script for deployment to the hosts that will run the software.
There are many different ways of packaging and deploying software
applications.

Single-platform Software
Some software applications are written to run under a particular operating
system (and sometimes a particular version or set of versions of an OS). The
software is written using a development environment suitable for that OS. The
developer writes the application in program code using a particular
programming language. When the application is compiled, it gets converted to
machine code that can run (or execute) in the target OS environment.

Editing a document in the Windows desktop edition of Microsoft Office. Screenshot used with
permission from Microsoft.

This development model can be referred to as single-platform software.


Because this model produces software that is optimized for a particular
platform, it can perform better and be simpler to check for errors than cross-
platform software. The drawback is that "porting" the software to a different
platform (from Windows OS to Android for instance) can be very difficult.

Cross-platform Software
Software written for PCs and laptops ("desktop" applications) is being
supplemented with software written for touch-based mobile devices and
operating systems. These are often referred to as apps. There is usually plenty
of interoperability between desktop and mobile platforms. For example, you
could create a document in Microsoft Word on a PC and send it to someone to
view on their smartphone.
Page 158
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development

Editing a document in Office Mobile. Screenshot used with permission from Microsoft.

Another trend is for applications to be accessed over the web, often using a
"cloud" deployment model. When software is run from a web server as a web
application, it can usually support a wide range of different types of client
operating systems and devices. Usually the only client required is a compatible
web browser.

Editing a document in Word Online using a web browser. Screenshot used with permission from
Microsoft.

Page 159
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 This sort of cross-platform development is complicated by the different
hardware interfaces for different computing devices. The interfaces supported
by keyboard and mouse input devices for PCs and laptops do not always work
well with the touchscreens used by smartphones. The wide range of display
sizes, orientations, and resolutions are another factor making cross-platform
design challenging. There can be performance problems when software is
written for a "platform independent" environment, such as a Java virtual
machine, rather than code run natively by the OS.

Compatibility issues can also affect web applications as different browser


vendors can make slightly different interpretations of open standards that result
in applications not working correctly in particular browsers or browser versions.

Application Delivery Methods


A traditional PC-type software application is installed locally to the computer's
hard drive. When launched it executes within the computer's memory and is
processed by the local CPU. Any data files manipulated by the application can
also be stored on the local disk, though usually in a user folder rather than the
application folder. For security reasons ordinary users should not be able to
modify application folders.

A locally installed application such as this does not need network access to
run, though obviously the network has to be present if the application makes
use of network features.

For some enterprises, this locally installed model presents performance and
security issues. Another option is for the application to be installed to a
network server and executed on that server. Client workstations access the
application using a remote terminal or viewer. The most successful example of
this kind of application virtualization model is Citrix XenApp. Locating the
application and its data files on a server is easier to secure and easier to
backup. This model also does not require that client hosts be able to access
the Internet. The drawback is that if there is no local network connection or the
local network is heavily congested, users will not be able to use the
application.

A third option for deploying apps is the cloud hosted model. This is very
similar to the local network model except that clients connect to the application
servers over the Internet. This provides a lot of flexibility in terms of
provisioning the app to clients located in different regions. As with local
network applications, user-generated data files would normally be saved in the
cloud too, with the same benefits for creating security access controls and
backing up easily. The drawback is that clients and cloud service must both
have a reliable Internet connection. Outages on either side can cause serious
productivity problems.

Actually, Internet access for cloud apps isn't always necessarily the
case. There are different means of providing cloud services, some
of which use local networks. But it is the most dominant model.

Page 160
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development

Review Questions / Module 2 / Unit 3 / Programming and App


Development
Answer these questions to test what you have learned in this unit.

1) What shows the structure of code without using the specific syntax of any
one language?

2) What is an interpreted language?

3) How is a markup language differ from a compiled language?

4) What are constants and variables examples of?

5) What type of programming concept allows for a variable size container?

6) You want to check whether a condition has been met, and if it has, perform
one action. Otherwise, you want your program to perform a second action.
What sort of programming operation would help achieve this?

7) In a program, what does a loop do?

8) What is the difference between a procedure and a function?

9) What three things define an object?

10) What three scripting options are commonly used in Windows 10 to perform
administrative tasks?

11) True or false? You do not need to install a web application to your
computer; it would be accessed via a browser.

12) What is the advantage of a local network hosted application, in terms of


data storage?

Page 161
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Lab 8 / Using Scripting Tools


In this lab, you will practice creating scripts in three different Windows scripting
environments.

Exercise 1 / Creating a Batch File


In this exercise, you will create simple batch file to automate the creation of a
report of the local host's network configuration.

1) If necessary, start your computer and sign in.

2) Press START, type notepad and then press ENTER.

3) In the Untitled – Notepad window, type the following text:

@echo off
ipconfig /all > report.txt
echo Press a key to view report
pause > nul
notepad report.txt
Note the features of the script:

○ @echo off—suspends output being written to the command prompt.

○ ifconfig > report.txt—calls the system command to produce a network


configuration summary (ifconfig) and redirects (or pipes) its output to a
text file.

○ The remainder of the script waits for the user to press a key and then
opens the report file in Notepad.

4) From the File menu, select Save As.

5) In the Save as type list, click All Files.

6) In the File name box, type test.cmd

7) In the navigation pane, click Documents.

8) Click Save.

9) Close Notepad.

10) Click Start, scroll down and expand Windows System, and then click
Command Prompt.

Page 162
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
11) In the command prompt window, type documents\test.cmd and then Programming and App
Development
press ENTER.

Running the batch file. Screenshot used with permission from Microsoft.

12) When prompted to press a key, press SPACEBAR.

A notepad window opens and displays the output from the ipconfig.exe
command that you put in your batch file.

13) Close all open windows and apps.

Exercise 2 / Creating a Visual Basic Script


In this exercise, you will create and test a Visual Basic script.

1) Press START, type notepad and then press ENTER.

2) In the Untitled – Notepad window, type the following text:

for i = 1 to 5
wscript.echo i
next
This program creates a simple loop and uses the echo statement to show
the current value of the variable i as the loop executes.

3) From the File menu, select Save As.

4) In the Save as type list, click All Files.

5) In the File name box, type Test.vbs.

6) In the navigation pane, click Documents.

7) Click Save.

8) Open Windows Explorer and navigate to your Documents folder.

9) Double-click the Test.vbs file.

10) The script runs and a new window opens that displays the number 1. Click
OK, and then number 2 displays in a new window. Continue until 5 has
displayed.

Page 163
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Running the VBScript file. Screenshot used with permission from Microsoft.

11) Click Start, scroll down and expand Windows System, and then click
Command Prompt.

12) In the command prompt window, type cscript documents\test.vbs


and then press ENTER.

Running the VBScript from the command-line. Screenshot used with permission from Microsoft.

13) The script runs from the command line and displays each number in
sequence.

14) Switch to the Notepad window and update the script to read as shown
below:

iHigh = 50
iLow = 10
for i = 1 to 5
randomize
iDisplay = int((iHigh - iLow + 1) * rnd + iLow)
wscript.echo iDisplay
next
15) Save the file.

This script uses some additional integer variables and built-in VBscript
functions to return a random number between 10 and 50 during each
iteration of the loop.

16) In the command prompt window, type cscript documents\test.vbs


and then press ENTER.

Page 164
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development

Running the edited VBScript. Screenshot used with permission from Microsoft.

Five random numbers between 10 and 50 display.

17) What part of the code would you change to show 10 random numbers?

____________________________________________________________

18) Edit this line and save the file:

for i = 1 to 10
19) Run the script again.

20) Switch to the Notepad window and update the script to read as shown
below:

iHigh = 50
iLow = 10
iCount = 0
sTitle = "Number count"
for i = 1 to 10
randomize
iDisplay = int((iHigh - iLow + 1) * rnd + iLow)
wscript.echo iDisplay
if iDisplay > 25 then
iCount = iCount + 1
end if
next
sMsg = cstr(iCount) + " numbers are greater than 25"
msgbox sMsg,vbOK,sTitle
21) Save the file.

These modifications add another branch to increment a variable if another


variable exceeds a certain value. Note how the branching statements are
nested. We also use some string-type variables and a function to convert
an integer (iCount) into a string for use as text output in a message box.
Finally, note the use of vbOK in the last line. This is an example of a
constant. It defines the type of message box to display (one with just an OK
button).
Page 165
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 22) In the command prompt window, run the script.

Running the modified VBScript from the command-line. Screenshot used with permission from
Microsoft.

23) Close all open apps and windows.

Exercise 3 / Creating a Windows PowerShell Script


In this exercise, you will create and test a Windows PowerShell script.

1) Click Start, type Windows PowerShell, right-click Windows PowerShell


and then click Run as administrator.

2) In the User Account Control window, click Yes.

3) In the Windows PowerShell window, type the following command (ignore


the line break) and then press ENTER:

Get-WmiObject -Class Win32_OperatingSystem –


ComputerName localhost
4) Examine the returned results.

5) In the Windows PowerShell window, type the following command and


then press ENTER:

Get-WmiObject -Class Win32_OperatingSystem –


ComputerName localhost | Select-Object -Property CSName

To save a bit of time, you can press the UPARROW to select the
original command and then edit it.

Page 166
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development

Running a Windows PowerShell cmdlet. Screenshot used with permission from Microsoft.

6) Examine the returned results.

Your computer name is displayed in a table. The command uses a pipe (|)
to send the output from one command to another command.

7) In the Windows PowerShell window, type the following command and then
press ENTER:

Get-Service
8) Examine the returned results. A list of all services on your computer is
displayed.

9) In the Windows PowerShell window, type the following command and then
press ENTER:

Get-Service | Select DisplayName


10) Examine the returned results. The same list of services is displayed but this
time the output is filtered down to the service's "friendly" name.

11) In the Windows PowerShell window, type the following command and then
press ENTER:

Get-WmiObject win32_service | Select DisplayName, State


| Sort State, DisplayName

Page 167
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Running a piped Windows PowerShell cmdlet. Screenshot used with permission from Microsoft.

12) Examine the returned results. A list of all services on your computer is
displayed, sorted by state and then display name.

So far we have been running commandlets individually. You can also


create PowerShell scripts in the editor environment and save them as files.

13) Click Start, type Windows PowerShell, right-click Windows PowerShell


ISE and then click Run as administrator.

14) In the User Account Control window, click Yes.

15) In the Untitled1.ps1 area, type the following code as a single line:

Get-WmiObject -Class Win32_OperatingSystem –


ComputerName localhost | Select-Object -Property CSName
Note that as you type, suggestion boxes appear helping you to
autocomplete statements. Also notice that the editor applies color-coding to
distinguish parts of your code. These features make a development
environment much easier to work in than a plain text editor like Notepad.

16) On the toolbar, click Save .

17) In the Save As window, in the navigation pane, expand This PC.

18) Expand Local Disk (C:), expand Windows, and then click System32.

19) In the File name box, type Sample.ps1 and then click Save.

Page 168
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
20) In the In the Administrator: Windows PowerShell ISE window, on the Programming and App
Development
toolbar, click Run . You receive an error. This is because unsigned
scripts are blocked by default. To enable scripts without a valid coding
certificate to run, switch to the Windows PowerShell window.

21) In the Administrator: Windows PowerShell window, type the following


command and then press ENTER:

Set-ExecutionPolicy RemoteSigned
22) When prompted, type A and press ENTER.

23) Switch to Windows PowerShell ISE and click Run. Your simple one line
script runs.

24) Switch to the Windows PowerShell window.

25) At the prompt, type Sample.ps1 and then press Enter. Your simple one
line script runs.

26) Close all open windows and apps.

Page 169
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Lab 9 / Using Programming Tools


In this lab, you will explore the code used in iterations of a simple Python
program.

Exercise 1 / Installing Programming Tools


In this exercise, you will install the Python development environment and
download some sample scripts.

This lab involves downloading and installing a program from a


third-party website. The authors and publisher believe the website
and program to be reputable and pose no risk to your computer or
personal information but cannot be held responsible for any loss or
damage that may occur as a result of following the steps in this lab.
If you have any concerns we recommend that you do NOT
proceed.

1) Open a web browser and navigate to www.python.org/downloads

2) Click the Download Python button to download the latest version of


Python for Windows. Note that the exact version of Python available may
vary over time.

Downloading Python.

3) When prompted, in the download bar at the bottom of the browser window,
click the Save button.

4) When the file has downloaded and the security scan is complete, in the
download bar, click the Run button.

5) In the Python Setup window, click Install Now.

Page 170
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development

Installing Python using the default setup options.

6) In the User Account Control window, click Yes.

7) Setup will continue for a minute or two. When the "Setup was successful"
message is shown, click Close.

8) In the browser, open the following URL:

https://s3.amazonaws.com/comptia-learning/python.zip
9) When prompted, in the download bar at the bottom of the browser window,
click the Save button.

10) When the file has downloaded and the security scan is complete, in the
download bar, click the Open button.

11) Click-and-drag to select the Python01 and Python02 files, and then copy
them to the Documents folder.

Exercise 2 / Exploring a Simple Program


In this exercise, you will use the shell and editor windows of Python's
Integrated DeveLopment Environment (IDLE). You will also identify some basic
code constructs in a simple program.

1) Click in the Instant Search box and type idle. From the search results,
click IDLE (Python 3.x 32-bit).

The Python shell window opens. The shell window is used to interpret and
run Python scripts and programs during development.

2) Type the following function. As you type, note how tooltips appear to help
you complete the statement and how color-coding is used to validate your
syntax (purple for the function name and green for the string input).

print('Hello World')

Page 171
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 3) Press ENTER to execute the statement. The string "Hello World" is "printed"
as output to the shell.

Using the shell window.

4) From the File menu, select Open. Click the Documents object then
double-click the Python01 file. The program code is opened in an editor
window.

Python editor window below the shell window.

5) Take a few moments to identify what each line of this program does. The
line position of the cursor is shown in the status bar or you can press
ALT+G to select a particular line:

○ Line 1 declares a variable (user_name) and sets it to the string value


"World."

○ Line 2 uses the print() function we saw earlier but the output is
constructed from both static strings and the variable we declared. Note
the use of the + sign to concatenate (join together) string literals and
variables. Note also that we use double quotes to delimit the literal
strings. This allows us to use the single quote (') as an apostrophe
within the string.

○ In line 3, we use the input() function to set the variable to a value


entered by the user.

Page 172
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
○ Line 4 sets up a loop using the for statement. A variable named Programming and App
Development
"counter" is used to track progress through the loop. To determine the
loop duration, the range() function sets an initial value of 1, an exit
value of 3, and a step value of 1. The intention is to run the loop three
times, but as we shall see the current code might not accomplish that.

○ Note the use of a colon to complete the line containing the for
statement. While "For" type constructs in general are common to all
programming languages, this statement syntax is specific to Python. It
will often be the case that you may understand the general operation of
logic components, but will need to learn the specific syntax of different
development languages.

○ Lines 5 and 6 are executed during the loop. Note that these lines are
indented. In Python, indentation is used to structure the code and is
critical to compilation and execution. In many other programming
languages, indentation is used for clarity but whitespace is ignored by
the interpreter or compiler.

○ Also in line 5, note the use of the str() function to convert the integer
variable "counter" to a string data type.

○ Line 7 is executed once the loop has completed and is also the final
statement in the procedure.

6) Press F5 to execute the program.

7) In the shell window, respond to the prompts by typing any names you wish
and pressing ENTER.

8) Count how many times the loop executes—-is this a surprise?

9) Leave all the Python windows open.

Exercise 3 / Using the Debugger


If you need to identify a logic error in code, it is often necessary to step through
program execution. Using a debugger, you can pause execution and view the
values of variables at the time a particular statement is being executed.

1) In the editor window, right-click line 5 (the first statement in the for loop)
and select Set Breakpoint.

The line is highlighted in yellow. A breakpoint means that code execution


will always pause at the line when the debugger is active.

2) In the editor window, right-click line 7 (the last line) and select Set
Breakpoint.

3) In the shell window, select Debug > Debugger. A Debug Control window
opens and the shell shows the message "DEBUG ON."

4) In the editor window, press F5 to run the program.

Page 173
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3

Using the Python debugger.

Because debug control is active, you now need to start execution manually.
The Go button proceeds normally with execution until a breakpoint is met.
For this exercise, we will investigate the use of tools to step through code
in increments.

5) In the Debug Control window, click the Step button.

The first line of the program is executed. Note that user_name is added to
the list of locals (variables).

6) Click the Step button.

The debugger starts executing the print() function, calling an


'idlelib.run.write()' function to do so. We don't necessarily need to view
every sub-step in this—as a built-in function we can assume that it works
correctly.

Using the "Step Into" debugger tool.

7) Click the Out button. Using "Step Out" completes processing of the
function and advances execution to the next statement (line 3).

8) Click the Over button. Using "Step Over" processes the statement without
pausing for each part of any functions it contains.

Note that program execution is still paused on line 3 however. The input()
function is waiting for user input. Note that the debugger buttons are
greyed out.
Page 174
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
9) Switch to the shell window, click at the prompt, type any name, and press Programming and App
Development
ENTER.

10) In the Debug Control window, note the new value of the user_name
variable. Click the Go button.

Program execution is next halted by the breakpoint you set for line 5. Note
that the counter variable is now listed, with the value 1.

11) Click the Go button.

12) Switch to the shell window, click at the prompt, type any name, and press
ENTER.

13) In the Debug Control window, Click the Out button.

14) Switch to the shell window, click at the prompt, type any name, and press
ENTER.

15) In the Debug Control window, click the Out button. Note the value of
counter as the program exits the loop and processes line 7. Can you
explain why the loop only executes twice?

The Python range() function is consistent with zero-based indexing. For


example, an array with 10 elements includes the items 0,1,2,3,4,5,6,7,8,
and 9 but not 10. The range() function is upper bound exclusive and the
range we have used does not include the value 3.

We can make the range() function work inclusively by adding one to the
stop value. We could also just set the stop value to 4 but adding one
makes the intent of the code clearer.

16) In the editor window, change the line to read as follows:

for counter in range(1,3+1,1):


17) Save the file then press F5 to run it again.

18) Step through the program to confirm that the loop executes three times.

Another option would be to define a different variable to store the


number of times the program has "met" someone. This might make
the code easier to understand at the expense of making it a bit
longer.

19) Take a moment to review the use of the debug tools:

○ Go—continue execution normally (unless a breakpoint is hit).

○ Step—advance through statements and functions step-by-step. This is


often also referred to as "Step Into."

○ Over—execute the next statement without "following" any function calls.

Page 175
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 3 ○ Out—complete any remaining parts within a function and pause at the
next statement in the main program flow.

20) Close the Python editor window.

21) In the shell window, select Debug > Debugger. The debugger is disabled.

Exercise 4 / Using a Function


We have used a few of Python's built-in functions to write our program.
Functions are self-contained routines designed to accomplish a specific task.
Functions can often be reused in different parts of the overall program.

While using this basic program, you may have noticed that some of the output
is not grammatical. Rather than state "You are the 2 person I've met today" it
would be better for the output to state "You are the 2nd person I've met today."
To do this, we can use a function that returns the correct ordinal suffix ("th,"
"st," "nd," or "rd") for a given cardinal integer.

1) From the File menu, select Open. Click the Documents object then
double-click the Python02 file. The program code is opened in an editor
window.

Python program with separate functions.

2) You can see the new function has been added in the first ten lines. Note
the use of "def" to declare the function and the use of indents to show
which statements belong to the function. Other languages are more likely
to use brackets to delimit the statements belonging within a function.

The previous code has been assigned to the function main(). The last line
of code calls this main() function if the script is executed directly. This
structure allows the file containing these functions to be imported by
another module without necessarily running the main() code.

You might think of main() as more procedure-like than function-like


but Python doesn't distinguish between functions and procedures.
A Python function does not have to return a value. It's simply a
means of defining a block of code.

3) Note that line 1 contains a comment (#) with attribution for the source code
Page 176
that this function is derived from.
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Programming and App
Development
The original function is more concise than this version. We've
added an additional step to illustrate the use of some different code
operations.

4) In line 16, note the way that the ordinal_suffix() function is called. The
function expects an integer as input (an argument). The main() function is
passing the value of the integer variable "counter" to the ordinal_suffix()
function.

5) In line 2 we use an array-like construction to store the list of ordinal suffixes


associated with 1, 2, and 3. This type of Python list is called a dictionary.
Note that the list is declared outside of any function definition, making it
available to any code in the same module.

6) Look at line 3. The function assigns its own variable (i) to the integer value.
Note that ordinal_suffix() does not manipulate the value of the "counter"
variable.

7) Look at the if conditional blocks in lines 4-9 and make sure you understand
what they do:

○ In the first if statement, we check whether the integer is over two digits
long. If it is, we truncate it, using functions to convert between integer
and string and back. For example, if the value of i is 112, this statement
will convert it to 12. The code snippet [-2:] is a slice, which is the
method used in Python to return part of a string (in this case the last
two characters). We're doing this because we only need to evaluate the
values from 0 to 99 to determine the appropriate suffix.

○ The second if statement checks whether i has the value of 11, 12, or 13
because in these special cases, the suffix is "th" not "11st" or "12nd."
The code uses the comparison operator less than (<) to accomplish
this.

○ The else statement returns the correct suffix in any other case. It does
this by using the mod operator (%). Mod returns the remainder after
division. For example, if i is 2 then the remainder after division by 10 is
also 2. If i is 22, the remainder is still 2. The get() function is used to
lookup this remainder value in the SUFFIX_DICT list. If the value is not
found (if it is zero or four for instance), "th" is returned by default.

8) Use F5 to run the new program and test that it returns correctly formatted
suffixes in the output.

9) Change the value of range(1,3+1,1) to test different integers. For


example, try range(109,124,1).

10) Close all open windows and apps.

Page 177
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4
Module 2 / Unit 4
Using Databases

Objectives
On completion of this unit, you will be able to:

□ Describe databases and explain the purpose of a database.

□ List the relational methods used by structured databases.

□ List the ways that users and applications can interface with databases.

□ Distinguish application architecture models.

Syllabus Objectives and Content Examples


This unit covers the following exam domain objectives and content examples:

□ 3.4 Explain methods of application architecture and delivery models.


Application architecture models (One tier, Two tier, Three tier, n-tier)

□ 5.1 Explain database concepts and the purpose of a database.


Usage of database (Create, Import/input, Query, Reports) • Flat file vs.
database (Multiple concurrent users, Scalability, Speed, Variety of data) •
Records • Storage (Data persistence)

□ 5.2 Compare and contrast various database structures.


Structured vs. semi-structured vs. non-structured • Relational databases
(Schema, Tables, Rows/records, Fields/columns, Primary key, Foreign key,
Constraints) • Non-relational databases (Key/value databases, Document
databases)

□ 5.3 Summarize methods used to interface with databases.


Relational methods (Data manipulation [Select, Insert, Delete, Update],
Data definition [Create, Alter, Drop, Permissions]) • Database access
methods (Direct/manual access, Programmatic access • User
interface/utility access, Query/report builders) • Export/import (Database
dump, Backup)

Page 178
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Database Concepts Using Databases

Databases are used everywhere in today’s connected world. Every time you
make an online purchase with an e-commerce retailer, many databases are
accessed by a variety of different applications in order to facilitate your
purchase.

A database is an organized collection of information. The information is stored


in a structured manner for easier access. Typically, a database consists of
tables of information, organized into columns and rows. Each row represents
a separate record in the database, while each column represents a single
field within a record.

This user record is backed by a database. Each form field you can see shows and updates a
column in a database table while this record is a row in the table.

Database Usage
A database is used both to store information securely and to report on the
information it contains. Consequently, database usage involves the following
processes and tools:

■ Creation—this step involves defining what information the database will


store, where it will be hosted, and how it will be accessed by clients.

■ Import/input—once the database has been created, it must be populated


with data records. Records can either be input and updated manually,
usually using some type of form, or data might be imported from another
source, or both.

Page 179
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 ■ Storage (data persistence)—databases are often used with applications.
While an application processes variables and other temporary data
internally, this information is lost when the application is terminated. A
database represents a way for an application to store data persistently and
securely.

■ Queries—it is possible in theory to read the information in each table


manually, but in order to view information efficiently, a query is used to
extract it. A query allows the user to specify criteria to match values in one
or more fields and choose which fields to display in the results so that only
information of interest is selected.

■ Reports—a query might return a large number of rows and be just as


difficult to read as a table. A report is a means of formatting and
summarizing the records returned by a query so that the information is
easy to read and interpret.

Flat File Systems


One common question asked when users are considering a database is, "Why
can’t I just use a spreadsheet such as Excel?" It’s a fair question because
Excel enables you to store your information in sheets, which are broadly
analogous to tables, with rows and columns of data. This is an example of a
flat file data storage and access system rather than a database.

Spreadsheets are not the only kind of flat file data store. Another example is a
plain text file with delimiters for each column. A Comma Separated Values
(CSV) file uses commas to identify the end of a column and a line feed for
each row.

Comma Separated Values file—the column headers are shown at the top with commas separating
each. Every line in the file corresponds to a row of data.

While flat file systems are easy to create they have many drawbacks compared
to database systems.

Databases versus Flat File Systems


A flat file system might be useful for tasks such as simple order or sales
databases used by a single person or small workgroup. A flat file is also a
good way of exporting and importing information between systems. Dedicated
database software has many advantages over flat files though.

■ Databases can enforce data types for each column and validate
information entered as fields and records. Spreadsheets can mimic some
of this functionality but not as robustly. Databases consequently support a
wider variety of data formats.
Page 180
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
■ Databases can manage multiple tables and link the fields in different tables Using Databases
to create complex schemas. In a flat file, all the information is stored within
a single table.

■ Databases can support tens, hundreds or thousands, or even millions of


users concurrently. A single file-based data storage solution does not offer
high enough speed for the volumes of transactions (adding and updating
records) on enterprise-level systems.

In a file-based storage model, when one user opens the file it


becomes locked to other users. They may be able to view the file
but cannot change it (read-only). A database system supports
concurrent users without locking the whole database. A particular
record may be locked during a data entry transaction though.

■ Databases are also more scalable. Scalability means being able to expand
usage without increasing costs at the same rate. For example, in a non-
scalable system, doubling the number of users would also double the costs
of the system. Database architecture means that extra capacity can be
added later with much less investment.

■ Databases provide access controls to protect information from


unauthorized disclosure and backup/replication tools to ensure that data
can be recovered within seconds of it being committed.

Database Structures

There are different types of databases and data stores with different levels of
structure.

Relational Databases
A relational database is the type we have been describing so far. A relational
database is a highly structured type of database. Information is organized in
tables (known as relations). A table is defined with a number of fields,
represented by the table columns. Each field can be a particular data type.
Each row entered into the table represents a data record.

Typically, Relational Database Management Systems (RDBMS) use


Structured Query Language (SQL) to maintain and query data in the
database. Examples of RDBMS include:

■ Microsoft SQL Server.

■ Oracle Database.

■ MySQL.

■ Microsoft Office Access.


Page 181
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 Primary Key and Foreign Key
Attempting to store a complex set of data within a single table is impractical.
For example, if you want to record who has borrowed books from a library, if
you have a single LibraryLoans table, you have to duplicate information about
the customer each time a loan record is created. It is likely that mistakes could
be made inputting this information and the customer's details may change,
resulting in inconsistencies in your data records. In a relational database, you
can have multiple linked tables. If you design the database schema with one
Customer table and one Loan table, you can link a single customer record to
multiple loan records. If a customer record has to be updated, you can do that
once in the Customer table rather than editing lots of records in a monolithic
LibraryLoans table.

For this to work, in any given table, each record has to be unique in at least
one way. This is usually accomplished by designating one column as a
primary key. Each row in the table must have a unique value in the primary
key field. This primary key is used to define the relationship between one table
and another table in the database. When a primary key in one table is
referenced in another table, then in the secondary table, that column is
referred to as a foreign key.

The structure of the database in terms of the fields defined in each table and
the relations between primary and foreign keys is referred to as the schema.

Relational Database Example


To give you an idea about a relational database, think again about a database
supporting a lending library. Your database is designed to store and allow
retrieval of data concerned with the management of book lending. This
database might include a table that stored customer information, another that
contained book title information, and finally a table that stored information
about the actual lending.

Relational database table model.

Page 182
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
You can see that the customer information and book information that appears Using Databases
in the Lending table is drawn from the Customer and Book tables respectively.
Specifically, the Customer ID is drawn from the Customer table and the Title is
drawn from the Book table. The advantage of this approach is that if you must
update customer information, you only need to do so in one place—the
Customer table.

A query can be used to reconstruct the information. For example, if you want to
check the customer associated with a particular lending record, your query
would select the record from the Lending table then use the join between the
Lending and Customer tables to show the values of the name and address
fields from the related Customer table record.

Constraints
One of the functions of an RDBMS is to address the concept of Garbage In,
Garbage Out (GIGO). It is very important that the values entered into fields
conform are consistent with what information the field is supposed to store.

When defining the properties of each field, as well as enforcing a data type,
you can impose certain constraints on the values that can be input into each
field. A primary key is an example of a constraint. The value entered or
changed in a primary key field in any given record must not be the same as
any other existing record. Other types of constraints might perform validation
on the data that you can enter. For example, you could add constraints to
prevent a field from being left blank, to define the format of a telephone
number, or to check that the value entered to choose an order delivery date is
not in the past. Another example of a constraint is to enter a default value in a
field if the user makes no selection.

Constraints can be applied at different levels. As well as applying


rules to fields, they can be used at the table and schema levels too.

Semi-structured and Unstructured Databases


When you store your information in a relational database, it is stored in a
structured way. This structure enables you to more easily access the stored
information and gives you flexibility over exactly what you access. For
example, you can access all fields or only certain fields. Each field has a
defined data type, meaning that software that understands the database
language (SQL), can parse (interpret) the content of a field easily.

Unstructured data, on the other hand, provides no rigid formatting of the data.
Images and text files, Word documents and PowerPoint presentations are
examples of unstructured data. Unstructured data is typically much easier to
create than structured data. Documents can be added to a store simply and
the data store can support a much larger variety of data types than a relational
database can.

Page 183
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 Sitting somewhere between these two is semi-structured data. Strictly
speaking, the data lacks the structure of formal database architecture. But in
addition to the raw unstructured data, there is associated information called
metadata that helps identify the data.

Document and Key/Value Pair Databases


A document database is an example of a semi-structured database. Rather
than define tables and fields, the database grows by adding documents to it.
The documents can use the same structure or be of different types. The
database's query engine must be designed to parse each document type and
extract information from it.

Documents would very commonly use markup language such as XML


(eXtensible Markup Language) to provide structure.

Markup languages such as XML were discussed in Unit 2.2.

A key/value pair database is a means of storing the properties of objects


without predetermining the fields used to define an object. A key/value pair
table looks like the following:

Key Value
user01_surname Warren
user01_firstname Andy
user01_age 27
user02_surname Pengelly
user02_town Bigtown
user_01_marketingconsent TRUE
user_02_marketingconsent FALSE

As you can see, not all properties have to be defined for each object. One
widely used key/value format is JavaScript Object Notation (JSON). For
example, "user01" could be expressed as the following JSON string:

{ "user01_surname" : "Warren", "user01_firstname" :


"Andy", "user01_age" : 27, "user01_marketingconsent" :
TRUE }
Document databases and key/value pair databases are non-relational
because there are no formal structures to link the different data objects and
files. This does not mean that relationships between the data items cannot be
found though. Non-relational database systems use searches and queries to
summarize and correlate data points.

Database engines dealing with a mixture of structured,


unstructured, and semi-structured data are often referred to as
NoSQL databases, which can stand either for "No SQL" or for "Not
Page 184
Only SQL.”
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Relational Methods Using Databases

Database interfaces are the processes used to add/update information to and


extract (or view) information from the database. In an RDBMS, the use of
Structured Query Language (SQL) relational methods is critical to creating
and updating the database.

These relational methods can be split into two types; those that define the
database structure and those that manipulate information in the database.

Data Definition Methods


Data Definition Language (DDL) commands refer to SQL commands that add
to or modify the structure of the database. Some examples of data definition
commands are:

■ CREATE—this command can be used to add a new database on the


RDBMS server (CREATE DATABASE) or to add a new table within an
existing database (CREATE TABLE). The primary key and foreign key can
be specified as part of the table definition.

■ ALTER TABLE—this allows you to add, remove (drop), and modify table
columns (fields), change a primary key and/or foreign key, and configure
other constraints. There is also an ALTER DATABASE command, used for
modifying properties of the whole database, such as its character set.

■ DROP—this is the command used to delete a table (DROP TABLE) or


database (DROP DATABASE). Obviously, this also deletes any records and
data stored in the object.

■ CREATE INDEX—specifying that a column (or combination of columns) is


indexed speeds up queries on that column. The tradeoff is that updates are
slowed down slightly, or quite a lot if the column is not suitable for indexing.
The DROP INDEX command can be used to remove an index.

There are also SQL commands allowing permissions (access controls) to be


configured. These are discussed below.

Data Manipulation Methods


Data Manipulation Language (DML) commands allow you to insert or update
records and extract information from records for viewing (a query):

■ INSERT INTO TableName—adds a new row in a table in the database.

■ UPDATE TableName—changes the value of one or more table columns.


This can be used with a WHERE statement to filter the records that will be
updated. If no WHERE statement is specified, the command applies to all
the records in the table.

■ DELETE FROM TableName—deletes records from the table. As with


UPDATE, this will delete all records unless a WHERE statement is specified.
Page 185
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 ■ SELECT—enables you to define a query to retrieve data from a database.

The following examples show some of the ways that a SELECT statement can
be used to build a query:

SELECT * FROM Customers;


...enables you to select all data in the specified "Customers" table.

SELECT Name, Town FROM Customers;


...retrieves the values in the Name and Town fields for all records in the
Customers table.

SELECT * FROM Customers


WHERE Town='Slough';
...retrieves all records from the Customers table where the value in the
Town field is equal to "Slough."

SELECT * FROM Customers


WHERE Town='Slough'
ORDER BY Name;
...as above but also sorts the results in alphabetical order by the contents
of the Name field.

Permissions
SQL supports a secure access control system where specific user accounts
can be granted rights over different objects in the database (tables, columns,
and views for instance) and the database itself. When an account creates an
object, it becomes the owner of that object, with complete control over it. The
owner cannot be denied permission over the object. The owner can be
changed however, using the ALTER AUTHORIZATION statement.

Other accounts can be granted specific rights over an object using the
statement:

GRANT permission TO user


For example, the following statement grants use of the SELECT statement to
the user "james."

GRANT SELECT ON Customers TO james


Rights can also be specifically denied a permission using:

DENY permission TO user


DENY overrides and GRANT permission, but cannot affect the owner, as
mentioned above.

Permission statements can be considered as Data Definition Language


(DDL) commands, like CREATE and DROP.

Page 186
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Databases

SQL also supports a CONTROL permission where the user has all
rights to the object by default but can subsequently be denied
some rights.

Database Access Methods

Database access methods are the processes by which a user might run SQL
commands on the database server or update or extract information using a
form or application that encapsulates the SQL commands as graphical controls
or tools.

Direct/Manual Access
Administrators might use an administrative tool, such as phpMyAdmin, to
connect and sign in to an RDBMS database. Once they have connected, they
can run SQL commands to create new databases on the system and interact
with stored data. This can be described as direct or manual access.

Query/Report Builder
There are many users who may need to interact closely with the database but
do not want to learn SQL syntax. A query or report builder provides a GUI for
users to select actions to perform on the database and converts those
selections to the SQL statements that will be executed.

Programmatic Access
A software application can interact with the database either using SQL
commands or using SQL commands stored as procedures in the database.
Most programming languages include libraries to provide default code for
connecting to a database and executing queries.

User Interface/Utility Access


An application might use a database in the background without the user really
being aware of its presence. Alternatively, the application might provide a
specific Graphical User Interface (GUI) or form to allow ordinary users to add
and search records.

Backups and Data Export


As with any type of data, it is vital to make secure backups of databases. Most
RDBMS provide stored procedures that invoke the BACKUP and RESTORE
commands at a database or table level.

Page 187
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4

Backing up databases is complicated by the problem of gaining


exclusive access to perform a consistent copy. SQL engines have
tools to facilitate backup access to an online database. See
Unit 4.4 for more information about backup issues.

It may also be necessary to export data from the database for use in another
database or in another type of program, such as a spreadsheet. A dump is a
copy of the database or table schema along with the records expressed as
SQL statements. These SQL statements can be executed on another
database to import the information.

Most database engines support exporting data in tables to other file formats,
such as Comma Separated Values (.CSV) or native MS Excel (.XLS).

Application Architecture Models

A database application can be designed for any sort of business function.


Customer Relationship Management (CRM) and accounting are typical
examples. If the application front-end and processing logic and the database
engine are all hosted on the same computer, the application architecture can
be described as one-tier or standalone.

A two-tier client-server application separates the database engine, or back-


end or data layer, from the presentation layer and the application layer, or
business logic. The application and presentation layers are part of the client
application. The database engine will run on one server (or more likely a
cluster of servers), while the presentation and application layers run on the
client.

In a three-tier application, the presentation and application layers are also


split. The presentation layer provides the client front-end and user interface
and runs on the client machine. The application layer runs on a server or
server cluster that the client connects to. When the client makes a request, it is
checked by the application layer, and if it conforms to whatever access rules
have been set up, the application layer executes the query on the data layer
which resides on a third tier and returns the result to the client. The client
should have no direct communications with the data tier.

In the terminology, a "layer" is a separate logical function, while a


"tier" is an independent or compartmentalized processing function.
While we describe tiers as "separate servers," they do not
necessarily have to be physically separated machines. They could
be implemented as virtual machines for instance.

An n-tier application architecture can be used to mean either a two-tier or


three-tier application, but another use is an application with a more complex
architecture still. For example, the application may use separate access control
or monitoring services.
Page 188
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Databases

Review Questions / Module 2 / Unit 4 / Using Databases


Answer these questions to test what you have learned in this unit.

1) What are the structural elements of a database table?

2) What term is used to describe selecting and viewing information in a


database?

3) How does an RDBMS such as Microsoft SQL Server differ from Microsoft
Excel when used to store a dataset?

4) What language is usually used to request data from an RDBMS such as


Oracle?

5) What is it that defines the relationship between tables in an RDBMS?

6) Give an example of unstructured data.

7) Give two examples of semi-structured data stores.

8) Is an INSERT statement an example of a definition or manipulation


language statement?

9) You need a development environment with a library of database functions.


What type of interface are you using?

10) How can a client-server application architecture be described if there is the


potential for the structure of the application platform to be developed
further?

Page 189
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4

Lab 10 / Creating and Using a Database


In this lab, you will use the database application bundled with Apache Open
Office to create a database, use a form to input data, and build a query to
select and view records.

Exercise 1 / Installing Apache Open Office


In this exercise, you will install Apache Open Office to make its database
application available. You will also need to install the Java Runtime
Environment in order to use the database features of Open Office.

This lab involves downloading and installing programs from third-


party websites. The authors and publisher believe the websites and
programs to be reputable and pose no risk to your computer or
personal information but cannot be held responsible for any loss or
damage that may occur as a result of following the steps in this lab.
If you have any concerns we recommend that you do NOT proceed.

1) If necessary, start your computer and sign in.

2) Open a browser and navigate to java.com/en/download/windows_offline.jsp

3) If necessary, accept the use of cookies by the site. On the main page, click
the Agree and Start Free Download button.

4) In the prompt at the bottom of the window, click Save. When download is
complete, in the prompt, click Run.

Downloading the Java Run Time Environment offline installer.


Page 190
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
5) In the User Account Control window, read the warning but click Yes. Using Databases

6) If necessary, on the taskbar, click the Java icon . In the Java Setup
wizard, click Install. At the license terms warning prompt, click OK.

7) When prompted, click Close.

Having installed the Java Runtime Environment, you can now download
and install Open Office.

8) In the browser, navigate to openoffice.org/download

9) Under the Download Apache OpenOffice heading, select Windows (EXE)


and English (US), then click Download full installation.

Downloading the Apache Open Office Windows executable.

10) If necessary, accept the use of cookies by the SourceForge site. In the
prompt at the bottom of the window, click Save.

11) When download is complete, in the prompt, click Run.

Windows does not trust the installer. In this case you have to trust
the site that you downloaded the file from (sourceforge.net). You
can find out more about how to verify the installer by browsing
Open Office's FAQs (www.openoffice.org/security/faq.html#verify).

12) In the User Account Control window, read the warning but click Yes.

13) In the OpenOffice Setup wizard, click Next.

14) On the Choose Install Location page, click Install.

15) On the Welcome to the Installation Wizard for OpenOffice page, click
Next.
Page 191
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 16) On the Customer Information page, click Next.

17) On the Setup Type page, click Custom and then click Next.

18) Review the components. Click Next.

19) On the File Type page, clear all check boxes and then click Next. This
step is very important if you already have Microsoft Office installed.

20) On the Ready to Install the Program page, click Install.

21) When prompted, click Finish.

22) Close the browser.

23) On the desktop, double-click the OpenOffice icon.

24) On the Welcome page, click Next.

25) Complete the User name information and then click Finish.

26) From the Tools menu, select Options. In the Options dialog, select Java.

After a few seconds, the dialog should update to show a path to the Java
runtime environment.

Verifying the Java path.

27) Click OK.

28) Close the Open Office window.

Page 192
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Exercise 2 / Creating a New Database Using Databases

In this exercise, you will create a new database and create database tables.

1) On the desktop, double-click the OpenOffice icon.

2) In Open Office, click Database.

3) In the Database Wizard, on the Select database tab, click Create a new
database and then click Next.

4) On the Save and proceed tab, click Finish.

5) In the Save As window, in the navigation pane, click Documents.

6) In the File name box, type CompTIA and then click Save.

7) In the open database window, click Tables and then click Create Table in
Design View.

As a first step, we will create a primary key for the table. As the primary key
must always be unique, it is a good idea to use an automatically generated
number for this field.

8) In the new table window, in the Field Name column, type CustomerID

9) In the Field Type column, select Integer [ INTEGER ], and in the


Description column, type Primary key for the Customer table

10) In the lower panel, from the AutoValue box, select Yes.

11) Click back in the field name area.

Creating a field to use as the primary key.

The database engine automatically picks this field to use as a primary key.
A key icon appears in the row selector in the far left (the grey box) to show
this.
Page 193
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 12) Click in the Field Name column in the next row and type Name

13) In the Field Type column, leave Text [ VARCHAR ] selected, and in the
Description column, type Enter the company name

This creates a field with a string data type (variable number of characters).

14) In the lower panel, set the Entry required value to Yes and the Length to
20

Defining a field with constraints.

This sets constraints for the field. Note that the length constraint sets a
maximum length, so the user can enter fewer characters if needed. If we
used a fixed length CHAR field data type, the same number of characters
would have to be input each time—obviously that would not be suitable for
a company name.

15) Add an address field to the table with the following properties:

○ Field name: Address

○ Field type: Text [ VARCHAR ]

○ Description: Enter the address

○ Required: No

○ Length: 50

Page 194
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
16) Add a telephone field to the table with the following properties: Using Databases

○ Field name: Telephone

○ Field type: Number [ NUMERIC ]

○ Description: Enter the phone number with no spaces

○ Required: No

○ Length: 10

Your table design should now look like this:

Completing the table design.

17) On the toolbar, click Save.

18) In the Save As box, type the name Customer and click OK.

19) Close the Customer table. In the database window, click Create Table in
Design View.

20) In the new table window, in the Field Name column, type ContactID

21) In the Field Type column, select Integer [ INTEGER ], and in the
Description column, type Primary key for the Contact table

22) In the lower panel, from the AutoValue box, select Yes.

23) Click back in the field name area. The field is set as a primary key
automatically.

Page 195
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 As each contact will be connected with an associated company record, we
now need to add the CustomerID field as a foreign key in the Contact table.

24) In the Field Name column, type Customer

25) In the Field Type column, select Integer [ INTEGER ], and in the
Description column, type Select a customer record

26) In the lower panel, from the Entry required box, select Yes.

27) Add a first name field to the table with the following properties:

○ Field name: FirstName

○ Field type: Text [ VARCHAR ]

○ Required: Yes

○ Length: 25

28) Add a surname field to the table with the following properties:

○ Field name: Surname

○ Field type: Text [ VARCHAR ]

○ Required: Yes

○ Length: 25

29) Click Save.

30) In the Save As window, in the Table Name box, type Contact and click
OK.

31) Close the table window.

32) From the Tools menu, select Relationships.

33) In the Add Tables dialog, with Customer selected, click Add then select
Contact and click Add. Click Close.

34) Drag the CustomerID field from the Customer table over the Customer
field in the Contact table.

Page 196
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Using Databases

Creating a relationship between two tables.

Note the symbols on the join line. The customer table side is shown with a
"1" while the contact side is labelled "n." This represents a one-to-many
relationship. Each single record in the Customer table can have many
related records in the Contact table. This is the most common type of
relation.

35) Close the Table Relationships window. Click Yes to save when prompted.

36) On the menu bar, click Save to save the database tables.

Exercise 3 / Creating a Form and Entering Data


In this exercise, you will populate the database with sample records using a
simple form.

1) With the CompTIA database open, click the Forms button.

2) in the Tasks list, click Use Wizard to Create Form.

3) In the Form Wizard, in the Tables or queries list, select Table:


Customer.

4) In the Available fields list, select Name, Address, and Telephone then
click > .

Page 197
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4

Creating a form with the wizard.

As the ID field is automatically generated for each new record, it does not
need to be added to the form.

5) Click Next.

6) Check the Add Subform box and the Subform based on existing
relation option button. Select Contact.

Adding a subform.

7) Click Next.

8) Add the FirstName and Surname fields then click Next.

Page 198
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
9) On the Arrange controls tab, under Arrangement of the main form, click Using Databases
Columnar – Labels Left icon. Under Arrangement of the subform, click As
Data Sheet.

Defining the form layout.

10) Click Next.

Forms can be configured to view only or with properties to prevent


modification, addition, or deletion of data.

11) Leave the defaults selected and click Next.

12) Click Next twice to accept the default style and name.

13) Select Work with the form and click Finish.

14) In the open form, type the following data in the appropriate fields:

○ Name: Widget

○ Address: 123 Address Street

○ Telephone: 9990001111

15) Click in the subform data sheet and enter the following information:

○ FirstName: Dave

○ Surname: Martin

16) Type the following data in the next row:

○ FirstName: Sue

○ Surname: Smith

Page 199
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 17) Click back in the main form (in the Name field for instance) then click the

New Record button .

18) In the open form, type the following data in the appropriate fields:

○ Name: Grommet

○ Address: 321 Main Road

○ Telephone: 8880002222

19) Click in the subform data sheet and enter one or two contacts.

20) Close the current form.

21) In the database window, select the Tables object. Open the Customer
table. Make a note of the values in the CustomerID primary key field for the
two records:

Widget: _____________________________________________________

Grommet:____________________________________________________

22) Close the table.

23) Open the Contact table and check the Customer field—you should see the
values you recorded above entered in the foreign key.

Values added to the Contact table foreign key Customer field.

These values are added automatically by the database engine because of


the relationship you defined between the tables and between the form and
subform.

24) Close the Contact table.

Page 200
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Exercise 4 / Working with Queries Using Databases

In this exercise, you will use a query to extract data and display it using a
report.

1) With the CompTIA database open, click the Queries button.

2) Click Use Wizard to Create Query.

3) In the Query Wizard window, from the Tables list, select Table:
Customer.

4) Select all fields except CustomerID and then click >.

5) From the Tables list, click Table: Contact.

6) Select the FirstName and Surname fields then click >.

Defining fields to show in the query.

7) Click Next.

8) On the Sorting order tab, in the Sort by list, select Customer.Name and
in the Then by list, select Contact.Surname.

9) Click Next.

10) With Match all of the following selected, from the Fields list box, select
Contact.FirstName. From the Condition box, select is not equal to, and
in the Value box, type Dave

11) Click Finish. What is wrong with the query results?

____________________________________________________________

Page 201
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4

All of these people seem to have more than one job!

To fix the output, we need to re-state the join (relationship) between the
tables in the query builder.

12) Close the query window. In the database window, right-click


Query_Customer and select Edit.

13) Drag the CustomerID field from the Customer table over the Customer
field in the Contact table.

Setting the join in query design view.

14) Click the Save button then press F5.

Page 202
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
This runs the query within the builder interface. You should see that the join Using Databases
is now working properly and the query is returning one row per contact
record rather than generating rows for each unique combination of
customer and contact records.

Running the query.

15) Close the query window. In the database window, right-click


Query_Customer and select Edit in SQL View.

SQL statement underpinning the query.

Page 203
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit 4 Everything you have done in the database GUI is using underlying SQL.
Note the features of this statement:

○ The SELECT statement chooses records for viewing (data


manipulation). It is followed by a list of column (field) names to use in
the output. The AS keyword specifies an alias for each field.

○ The FROM keyword lists the data sources (Customer and Contacts).

○ The WHERE keyword states the join and the criteria excluding "Dave."

16) Close the SQL window.

17) Close Open Office, choosing to save changes when prompted.

Page 204
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Summary Using Apps and Databases

Using Apps and Databases

In this module you learned the basics of using a computer, Windows, and
software applications.

Module 2 / Unit 1 / Using Data Types and Units


□ Computers process binary data but this must often be converted to decimal
or hexadecimal notation for use in programs and configuration dialogs.

□ The fundamental bit value can be expressed in various multiples to


describe storage and transfer rates (bits per second).

□ Data must usually be declared as a particular type to be processed. Types


include integers, floating point numbers, Boolean values, char values, and
strings. Char and string types can use ASCII or Unicode representation.

□ Data is a valuable asset and can be protected by legal mechanisms such


as copyright, patent, and trademark.

□ Consider the importance and use of data and analytics to defining business
goals.

Module 2 / Unit 2 / Using Apps


□ Plan software installation and upgrades carefully, making sure you read the
documentation, verify system requirements, and check compatibility. Make
sure you understand the implications of installing commercial, freeware,
and shareware software.

□ Be aware of the functions and features of productivity, collaboration, and


business types of software.

Module 2 / Unit 3 / Programming and App Development


□ Software development can progress through a sequence or flow chart of
steps, to pseudocode, to the fully developed code written in the syntax of a
particular programming language.

□ Some programming languages require that you compile your programs


before they can be run. However, others, including common scripting
languages, run in an interpreter, which compiles at runtime. Note the use of
other types of languages, such as query, markup, and assembly
languages.

□ Identifiers such as variables and constants, plus containers such as arrays


and vectors allow programs to manipulate data. Branches and loops
enable your program to deviate from its end-to-end run path.

□ Procedures and functions enable you to create pieces of code that you will
reuse within your program. Object oriented techniques help to design
robust code.
Page 205
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM
Module 2 / Unit Summary □ Applications can be packaged for standalone installation on a single
computer but other architectures, such as network hosted and cloud
hosted, are becoming more popular.

Module 2 / Unit 4 / Using Databases


□ Make sure you understand the structure of relational databases and the
processes of creation, import/input, storage, querying, and reporting
involved in database usage.

□ Flat file systems, such as Microsoft Excel, can be used to handle small
volumes of data, and support one or two users. RDBMS-based databases
typically support SQL and scale well to support high numbers of users and
transactions. Also be aware of semi-structured datastores.

□ You should know typical data definition and data modification commands
and the basics of database permissions and access methods. Also
consider how application architecture can use tiers to separate data from
presentation and application layers.

Page 206
Licensed For Use Only By: Byte Back Student 1 BB1 Jun 10 2021 11:32AM

You might also like