MT 262 Putting Computer Systems to Work Block

ﺑﺴﻢ ﺍﻟﻠﻪ ﺍﻟﺮﺣﻤﻦ ﺍﻟﺮﺣﻴﻢ MT 262 Putting Computer Systems to Work Block I Unit 1 the Course and Its Software 1/18/2022 Produced by: Mona Abdullah 1

Welcome to MT 262 § This Course will be introduced to you and directed by: Tutor Mona Abdullah § Full time Tutor in AOU – Faculty of IT & Computing § With Master Degree in information Science from Otago University – New Zealand § Getting to know students enrolled to course: § Reading Students’ Names § Filling Most Recent Attendance Sheet 1/18/2022 Produced by: Mona Abdullah 2

Welcome to MT 262 § Checking Course Material § Books § 16 Units in 4 blocks § Handbook (contains reference material) § Study Calendar § CD-ROMs including: § Borland C++ Builder 5 § Templates and Libraries 1/18/2022 Produced by: Mona Abdullah 3

MT 262 Assessment § Assessment consists of: § § 1/18/2022 4 TMAs (35%) (2 TMAs/Semester) 2 Quizes (15%) 1 Mid Term (25%) Final 3 -hour Examination (25%) Produced by: Mona Abdullah 4

Objectives of the course MT 262 1. 2. 3. 4. 5. 6. Develop a systematic approach to designing computer-based solutions; Translate designs for solutions into computer programs; Acquire basic skills in the use of C++ for writing programs; Understand concepts in C++ that are common to all similar programming languages; Acquire experience of using a modern programming environment; Acquire skills in ensuring that programs actually perform as they are intended to perform. 1/18/2022 Produced by: Mona Abdullah 5

1. Introduction: Algorithms and Programming Languages § An Algorithm is : v A method of solution, described in a way that can be carried out by a computer, for solving a certain problem. § In this course, algorithms will be expressed in C++ programming language. 1/18/2022 Produced by: Mona Abdullah 6

Introduction: The Language C++ § The language C++ is a development of the earlier C language: § § § with remedies to some previous defects, and adds useful features including Objects. Why C++ for the course MT 262? 1. C++ provides all the facilities that the practical work demands; 2. Transferring skills learned using C++ to other languages is fairly straightforward; 3. The widespread commercial use of C++. 1/18/2022 Produced by: Mona Abdullah 7

2. The Course Software: Introduction § A computer program: v Is a sequence of instructions used to control a computer. § Machine code: v Initially, programs were written directly in machine code consisting of binary numbers that the computer’s processors obey. § Assembly languages v Have simplified the programming process as they use more memorable mnemonics and abbreviations for the machine code instructions. 1/18/2022 Produced by: Mona Abdullah 8

2. The Course Software: Introduction § Higher Level Languages (such as C++) v Provide a more ‘human readable’ format for writing programs. v They are directed at the need to solve problems rather than at facilities available on a specific processor. § Program source code: v Is a human-readable form of a program (see page 21). 1/18/2022 Produced by: Mona Abdullah 9

2. The Course Software: Introduction § Compiling: v Is the process of turning source code into a form that the computer can obey. v It can be thought of as a translation process. § Debugging: v Is the process of tracking down errors in source code. 1/18/2022 Produced by: Mona Abdullah 10

2. The Course Software: C++ Programming Environment § A programming environment: v Is a package which facilitates the writing, editing, compiling and debugging of computer programs. § C++ Builder programming environment has: 1. Main window giving access to the main menu, Toolbar, and Component Palette; 1/18/2022 Produced by: Mona Abdullah 11

2. The Course Software: C++ Programming Environment § C++ Builder programming environment also has: 2. Code Editor: for writing and editing the program source code. § This is a specially tailored word-processing program. 3. A compiler to translate the program source; 4. A linker for incorporating reusable code supplied by other people; 1/18/2022 Produced by: Mona Abdullah 12

2. The Course Software: C++ Programming Environment § C++ Builder programming environment also has: 5. Extensive facilities for testing the programs, both as a whole and step by step; 6. Libraries of code for carrying out common programming tasks; 7. A number of other facilities connected with the details for programming for windows, such as: § § 1/18/2022 Forms for designing application windows; and Object Inspector for inspecting and editing the way in which window objects behave. Produced by: Mona Abdullah 13

2. The Course Software: Installing C++ Builder 5 § Students are advised to read pages 12 to 19. § students need to install Builder 5, install Templates and Libraries, create a shortcut, and perform an initial testing. § Students may be shown a quick tour of installing C++ Builder and initial testing (if time permits) 1/18/2022 Produced by: Mona Abdullah 14

2. The Course Software: Initial Testing of C++ Builder 5 § Tutor may show students an example of how a project runs in Builder 5. § Tutor may use example project called check, where project produces a window with colors buttons (see Unit 1, pp. 18, 19( 1/18/2022 Produced by: Mona Abdullah 15

Exploring Builder: . 3 Introduction § C++ Builder project v Is a collection of files used by Builder to create an executable program. § Every project consists of a number of files, as explained below: 1/18/2022 Produced by: Mona Abdullah 16

Exploring Builder: . 3 Files in C++ Builder Project § The project source files (with extension. cpp): § Which contain the source code for the project; § The project resource file (with extension. res): § Which contains information about the applications icon, cursors, etc. ; § The project makefile (with extension. bpr): § Which keeps track of all the files in the project; and § One or more header files (with extension. h): § Which contain declarations but not code. 1/18/2022 Produced by: Mona Abdullah 17

Exploring Builder: . 3 C++ Builder Project § During Linking process, all the compiled project source code is combined into one executable file. § Which is saved by Builder using project name with the extension. exe 1/18/2022 Produced by: Mona Abdullah 18

: Exploring Builder. 3 § Builder provides a variety of templates for developing new applications. § The simplest is the one used throughout Blocks I and II for designing Console Applications. § These are applications which are driven by commands entered at the keyboard, and which display output in a DOS window. 1/18/2022 Produced by: Mona Abdullah 19

Exploring Builder. 3 Computer Activities § Students are strongly advised to do computer activities (3. 1 3. 5) § Tutor may demonstrate how computer activity 3. 1 works. § Activity 3. 1 is about writing a simple program to print out the phrase “Hello world” on screen, using Builder 5. 1/18/2022 Produced by: Mona Abdullah 20

3. Exploring Builder: Example source code of a simple project As found in Activity 3. 1 C++ Source Code 1. //---------------------2. #include <vcl. h> 3. #include <stdio. h> 4. #pragma hdrstop 5. //----------------------6. #pragma argsused 7. int main(int argc, char* argv[]) 8. { 9. puts("Hello World. "); 10. puts("Press Enter to close program. "); 11. getchar(); 12. return 0; 13. } //-------------------------n 1/18/2022 Meaning of the code // is used for comments. Lines 2 and 3 tell Builder to incorporate code from libraries. Line 4 tells Builder how to deal with library files. Line 6 is to avoid the production of warning messages relating to argc and * argv[]. Lines 7, 8, 12, and 13 provide the compulsory code required by the version of C++ being used and by the Windows operating system. Lines 9, 10, and 11 provide an example of output from and input to the computer. (puts(…) is short for ‘put string’; getchar() is to await input from user. Produced by: Mona Abdullah 21

Example source code (Activity 3. 1) cont. 1/18/2022 Produced by: Mona Abdullah 22

3. Exploring Builder: Notes about computer activities in this section § Activity 3. 3: § includes an important aspect about adding libraries to a project using the command: § Project | Add to Project … § Activity 3. 4 : § Uses the Object Inspector : § To write a program for producing a single window (form) on which a single button will be placed. 1/18/2022 Produced by: Mona Abdullah 23

Using Computers. 4 computer systems § All computer systems have: a) Input devices Ø for receiving information, either from the user or from the components of an appliance; Ø List what input devices do you know? b) Processors Ø for manipulating the information received; Ø What else do you know about processors? 1/18/2022 Produced by: Mona Abdullah 24

Using Computers. 4 computer systems a) Storage devices Ø for storing the programs and data used by the processor; Ø List types of storage devices that you know? d) Output devices Ø for returning the processed information back to the user (or components). Ø What type of output devices do you know? 1/18/2022 Produced by: Mona Abdullah 25

Embedded systems 4. 1 § Embedded systems are: v computers that are built into devices (such as domestic appliances, machine tools, measuring instruments and vehicles) to control the way they operate. Ø A bicycle speedometer and a washing machine controller are examples of embedded systems (how do these operate? Read pp. 30, 31 ). 1/18/2022 Produced by: Mona Abdullah 26

Event-driven versus Procedural Models for programming § In event-driven models, o the user drives the program. o Event-driven programs respond to events initiated by the user, such as key presses and mouse clicks. 1/18/2022 Produced by: Mona Abdullah 27

Event-driven versus Procedural Models for programming § In procedural models, o the program drives the user. o This means that, the program controls when it will ask for input, when it will provide output and the order in which various things happen. § Programming for embedded systems can take both approaches. 1/18/2022 Produced by: Mona Abdullah 28

Non-embedded systems 4. 2 § When users use computers, they actually work with application programs (e. g. MS Word) § Operating systems make computers able to use other programs. § When designing application programs there are specific designs which follow “Human-computer interaction” rules. 1/18/2022 Produced by: Mona Abdullah 29

Non-embedded systems 4. 2 § A code specification is: v The description of what a piece of code does; § A code implementation is : v How a piece of code achieves its purpose. § Reusable code is: v Code that can be made available to other programs. Ø A Library is a file which contains reusable code for carrying out various tasks (e. g. Builder’s standard I/O library) 1/18/2022 Produced by: Mona Abdullah 30

Computer Hardware. 5 § This section contains a revision about : § § Types of computers I/O devices Memory (RAM, ROM) Storage devices (CD-ROM, CD-RW) § Please read pp. 37 -40 Of BI-U 1 1/18/2022 Produced by: Mona Abdullah 31

Software Issues - Disk Space § As each project generates some ancillary files which can take up quite a lot of disk space. § § (It may reach 5 MB per project or more. ) Two ways to reclaim disk space: § § 1/18/2022 Delete all files with extension. ilc, . ils, . tds, and empty the Recycle Bin. OR In Builder, Choose Project|Options Linker tab Check box of Don’t generate state files OK. Produced by: Mona Abdullah 32

Thanks § Thanks for joining us. § Next is Unit 2 1/18/2022 Produced by: Mona Abdullah 33
- Slides: 33