Professional Documents
Culture Documents
Cosc 202 Module 1
Cosc 202 Module 1
• Computer system:
• a group of associated components that work together
• Categorise into 2 major components
• Hardware
• Software
Introduction to Computer Science
• Hardware
• is the physical parts of the computer(tangible parts)
• Classify into two major parts
• System unit
• Peripheral unit/devices
• System unit
• plastic/metallic box/case that houses the motherboard, CPU, NIC memory, drive bays,
speaker, expansion slot etc.)
• CPU – central processing unit(or processor) - is the brain of the computer
• The CPU consist of the following
• Arithmetic logic unit(ALU)
• Control unit(CU)
• Registers
• CPU operates in fetch - execute- cycle
Introduction to Computer Science
• Cache - is located in the processor to provide fast memory access
• Main memory – random access memory(RAM)
• Computer work areas
• volatile
Introduction to Computer Science
• Peripheral unit
• Any components connected to the computer
• Classify into three main components
• Input unit
• Output unit
• Storage unit
• Input unit – collect data and send it to computer
• E.g.: mouse, keyboard, stylus, webcam, trackball, MICR, etc
• Output unit – send data to the outside world
• E.g.: Screen, printer, speaker
• Storage unit – record and or retrieve items to and from storage media
• also known as mass/secondary/auxiliary storage
Introduction to Computer Science
• Major storage unit are
• Magnet storage
• Disk drive
• Floppy drive (now obsolete)
• Optical drive
• Compact disk (CD)
• Digital video/versatile disk(DVD)
• Blu-ray dis(BD)
• Solid state drive:
• Memory card
• Flash drive
• Cloud storage
Introduction to Computer Science
• Software
• generic name for programs
• Instructions to computer to perform task
• Classify into two basic types:
• System software
• Application software
• System software
• control the operations of the computer and its devices. Categorised into three:
• Operating system(OS)
• Utility programs
• Translator
Introduction to Computer Science
• Operating system
• programs that manages and coordinates all the activities on computer
• E.g. windows, MacOS, Linux
• Utility programs
• These are programs responsible for routine operations within the computer
system. It perform tasks related to managing or maintaining the computer
system.
• Backup utilities/ Restore are the programs designed to backup or keep a
duplicate copy of the contents of a hard disk drive on floppy/ diskettes, CD,
DVD, flash drive, tape.
• Files maintenance(copy, delete, move),
• File compression / Data compression programs are the programs used for
compressing large files, thereby freeing up disk space.
• Diagnostic Software: These are programs designed to help in finding
and correcting problems on the computer.
• Disk defragmentation: A program that reorganizes contiguously
programs that were initially non contiguous on the memory to free
more space for incoming programs and to improve access time.
• Vaccine Programs are the program designed to prevent virus from
entering the computer system. They are popularly called antivirus
software.
Translator
•Machine code
•Assembly language
•High-level languages
• –Fortran, LISP, Cobol
• –C, Pascal, Basic, Smalltalk
• –C++, Eiffel
• –Java, C#
• •Scripting languages
• –Shell scripts, Perl, TCL, Python, JavaScript, VBScript
Introduction to Computer Science
• Solving Problems
• To solve computer programming problem you follow this basic steps:
• Problem statement/definition
• Analysis
• Design
• Implementation
• Code
• Test and Debug
• documentation
• Analysis
• problem analysis leads to requirement specification which include:
• Output requirement
• Input requirement
• Processing requirement
Introduction to Computer Science
• Design
• after analysis is to design solution using the following tools:
• Flowchart
• Pseudocode
• Structure(hierarchical) chart
• Implementation
• Code – translate algorithm to appropriate programming language
• Test & debug – locate and remove bugs(errors)
• Document- describe the program
Developing Algorithm
• Any computing problem can be solved by executing a series of
actions in a specific order.
• A procedure for solving a problem, in terms of
• 1. the actions to be executed and
• 2. the order in which these actions are to be executed, is called
an algorithm.
• The following example demonstrates the importance of
correctly specifying the order in which the actions are to be
executed.
• Consider the “rise-and-shine algorithm” followed by one junior
executive for getting out of bed and going to work: (1) get out of
bed, (2) take off pajamas, (3) take a shower, (4) get dressed, (5)
eat breakfast and (6) go to work. This routine prepares the
executive for a productive day at the office.
Introduction to Computer Science
• Algorithm
• a precisely specified procedure for solving problem
• A good algorithm should have the following properties:
• Input
• Output
• Definite
• Effective
• Finite
• Efficient
• General
• Basically, problem solving in computer programming follows this process:
Introduction to Computer Science
• Basic flowchart symbols:
Introduction to Computer Science
• Flowchart to computes grade average:
Pseudocode
• Pseudocode is an informal language that helps
programmers develop algorithms. Pseudocode is
similar to everyday English; it is convenient and user-
friendly, but it is not an actual computer programming
language.
• Pseudocode programs are not executed on
computers. Rather, they help the programmer “think
out” a program before attempting to write it in a
programming language, such as Visual Basic.
Introduction to Computer Science
• Pseudocode:
1. Program: Determine average grade of a class
2. Initialize Counter and Sum to 0
3. Do While there are more data
4. Get the next Grade
5. Add the Grade to the Sum
6. Increment the Counter
7. Loop
8. Compute Average = Sum / Counter
9. Display Average
Introduction
Visual Basic is a high level programming language evolved from
the earlier DOS version called BASIC. BASIC was developed in
the mid-1960s by Professors John Kemeny and Thomas Kurtz of
Dartmouth College as a language for writing simple programs. It
is a fairly easy programming language to learn. The codes look a
bit like English Language.
VB was developed by Alan Cooper in 1991. VB is a visual and
events driven programming language. In BASIC, programming is
done in a text only environment and the program is executed
sequentially.
In VB programming is done in a graphical environment because
users may click on a certain object randomly so each object has
to be programmed independently to be able to response to
those actions(events).
Therefore, a VB program is made up of many subprograms,
each has its own program codes and each can be executed
independently and at the same time each can be linked
together in one way or another.
The VB environment
• A project is a collection of files that make up your application.
• The VB environment consist of the following:
• - the Blank Form Window which you can design your
application interface. It is a window that appears on the screen.
Forms are the window and dialog boxes you place on the screen.
It is the main window of the application .
• - the Project window displays the files that are created in your
application.
• - the Properties window which displays the properties of
various controls and object that are created in your
applications. the properties determines the object size, color
name, location and appearance on the screen. it tells
something about an object such as its name, color, size location.
The toolbox that consists of all the controls essential for
developing a VB application. An objects (controls) are
items that appears on a form or component place inside a
form such as command button, radio button, check box,
scroll bar, label, option button to get input or display
outputs. Each object has properties, methods and events.
Methods is an action associated with object. Methods
have parentheses while Properties does not.
Event occur when the user takes an action such as press
the key, move a mouse, clicking a button, clicking a
mouse, scrolling and closing a window.
Introduction to VB
Each object is based on a class. A class is a template/
blueprint used to create a new objects. It contains the
definition of all available properties, methods and events.
Each time new object create, it must be based on a class.
For example, placing three buttons on form. Each button is
based on the button class and is considered one object
called an instance of the class. Each button (instance) has its
own set of properties, methods and events. One button may
be labeled OK another Cancel another Exit. When the user
clicks the OK button that buttons click event occurs, if the
user clicks on the Exit button that button click event occurs
Visual Studio .NET is Microsoft’s Integrated
Development Environment (IDE) for creating,
running and debugging programs (also called
applications) written in a variety of .NET
programming languages.
This IDE is a powerful and sophisticated tool for
creating business-critical and mission-critical
applications.
IDE contains properties window which is used to
view and set properties objects.
Although Visual Basic is derived from the BASIC
programming language, it is a distinctly different language
that offers such powerful features as graphical user
interfaces, event handling, access to the Windows 32-bit
Application Programming Interface (Win32 API), object-
oriented programming and exception handling.
It helps in creating window application. It was integrated
into visual studio in order to facilitate creating server side
component and web application. It is the current release
VB.
It is a fully object oriented language. One of its features is
easy to use i.e it makes life easier e.g writing Microsoft Office
Automation program.
VB is an object oriented language used to write application
program that run in window. In the object oriented model,
classes are used to create objects that have properties,
methods and events.
The process of rapidly creating an application is typically
referred to as Rapid Application Development (RAD). Visual
Basic is the world’s most widely used RAD language.
Most of the development in Visual Basic is done in two
windows,
(the Form window and the Code window).
The Form window is where the form is designed. That’s
where you put all the text, pictures, and controls for your
program. This is often called the interface and is what the
user sees when the program runs.
The Code window is where the code is written. That’s where
you put the directions for the program. A user never sees the
code window.