Programming basic Programming Concept ( 1 ) Define Program and Programming Language


Define object-oriented approach in programming (5.1.3.2)



Download 0.62 Mb.
Page4/4
Date28.05.2018
Size0.62 Mb.
#51388
1   2   3   4

Define object-oriented approach in programming (5.1.3.2)





Differentiate between Structured approach and Object-Oriented approach in programming (5.1.3.3)


Structured

Approach


Differences

Object-Oriented

Approach


Top down design model/modules

Model

Objects

Medium Programming Project

Usage

Large Programming Project

C

Example

C++

Translator (5.1.4)

Translator

Assembler

Interpreter

Compiler

Describe the Translation Method of Programming Using Assembler, Interpreter and Compiler (5.1.4.1)

Assembler

  • An assembler is a computer program that translates assembly language into machine language.

  • For example in Intel 80836, the assembly language for the ’no operation’ command is NOP and its machine code representation is 10010000.

  • Examples of assemblers are MACRO-80 Assembler and Microsoft MASM.

Interpreter

  • An interpreter is a computer program that translates a high-level language into machine language.

  • Translate programming statement of a program into machine language.

  • Translate programming statement line by line and execute it immediately.

  • No object code saves.

  • Interpreter code run slower

  • Examples of interpreter-based language are BASIC, Logo and Smalltalk.

Compiler

  • Compiler is a program that translates a high-level language into machine language.

  • Compiler translates entire programming statement and executes it later.

  • Save machine language in an object code on the disk.

  • Compiled code run faster.

  • Several programming languages like C++, Pascal and COBOL used compilers as their translators.


Basic Elements in Programming (5.1.5)
Differentiate between constants and variables. (5.1.5.1)





Variables__Characteristics'>Constants

Variables

Characteristics

Value is not changeable during the course of the program.


Value can be changed anytime during the course of the program.

Usage

Use constant when you want to declare something that won’t be changed midway in your program execution.

Use variable to store data that may or will change during the running of the program.


Differentiate between the data types: Boolean, integer, double, string and date (5.1.5.2)
Data type determines the type of data a variable can store, for example a number or a character. Examples of data types are integer, double, string and Boolean.


Data type

Size

Example

Integer

Contains any whole number value that does not have any fractional part.



2 bytes

To declare an integer as constant in VB:

Const Year_Birth =2004


To declare an integer as variable in VB:

Dim Age As Integer

Age =6


Double

Any number values that contain a fractional part separated by decimal point.




2 bytes

To declare a double as VARIABLE in VB:

Dim Mark As Double

Marks =68.5


String

Non-numerical and is used to store characters and words.



1 byte per character

To declare string as constant in VB:

Const Name = “IMRAN”


To declare string as variable in VB:

Dim Address As String

Address = “Alor Setar”


Boolean

Value either false or true.


Programmers usually use it to store status.


2 bytes

To declare a boolean as constant in VB:

Const Input_Status = true


To declare a boolean as variable in VB:

Dim Input_Status As Boolean

Input_Status = true


Long Integer

4 bytes

Dim Loan As Long

Single-precision floating point

4 bytes

Dim Price As Single

Double-precision floating point

8 bytes

Dim Pi As Double

Currency

8 bytes

Dim Debt As Currency


Differentiate between mathematical and logical (Boolean) operators (5.1.5.3)
Operator is a symbol or notation that tells a computer to perform certain actions or operations. An example: the plus (+) notation will tell the computer to perform the "add" operation.


Operators

Mathematical Operators

Logical Operators

Relational Operators

Function

Mathematical operators perform mathematical operations such as plus or subtracts.

Logical operators perform logical operations such as checking the condition of two Boolean values.
Used to combine two simple statements into a compound statement.


Relational operators perform element-by-element comparisons between two arrays.


Symbol

+(plus)

-(minus)

*(multiply)

/(divide)

AND

OR

NOT



>(greater than)

<(less than)

>=(greater or equal)



<=(less or equal)

Example

2 * 5 = 10

G AND H

G < H


Differentiate between sequence control structure and selection control structure (5.1.5.4)


Aspects

Sequence Control

Selection Control

Usage

  • Use to implement code line by line.

  • Does not use the decision symbol.

  • Use to implement decision making process in the program.

  • Use the decision symbol.

Execution Flow

  • Execute statement one by one in linear or consecutive order.

  • Execute different statement for different conditions.

Flow Chart






Notes:

Five basic elements in programming are:



  • Constant

  • Variable

  • Data Type

  • Operators

  • Control Structures


Constant
Constant is a data container that stores information. The value will never change (remains constant) at any time during the course of a program.

Declare is the official term used in programming to announce to the program the condition of statement in programming.


Variable
Variable is a data container that stores information. The value inside may change at any time during the course of a program.
Data types

Data types

Example

String

“This is String”

Integer

1, 45, 78

Double

1.25, 3.5


Operator

Operator is a symbol that tells what action to perform




Operator symbol

+ (plus)

>(greater than)

-(minus)

<(less than)

/(divided)

=(equal to)

*(multiplied)

<>(not equal to)


Control structures

Control structures allow the programmer to control the flow of a program.



Program Development (5.2)
Program Development Phase (5.2.1)
Describe the five main phases in programming development (5.2.1.1)




Problem Analysis

  • Identify input, process, output and data

  • Refer to book and website, ask expert and meet with system analyst and users

  • Example: client need to set up a School registration program. School administrator (user) might tell the programmer that they need to record students’ data such as name, date of birth, gender, class, parents’ names, address and contact numbers).

Program Design

  • Create a solution algorithm for each modules (logic structure)

  • A set of specific procedures, which consists of, step by step instructions to solve the problem must be develop.(pseudo code)

  • Design a flow chart (logical sequence) that represents the needs of the client

  • Design user interface

Coding

  • Coding is the next step after the program logic has been formulated using the appropriate programming language such as C++ and Visual Basic

Testing and Debugging Phase


  • The program done will be tested to ensure that is error free.

  • The usual error is the syntax error, logic error and run-time error.

  • Example: Manually testing using sample data. The program is run through a computer using a translator program. Errors will be identified by the translator.


Documentation Phase


  • Programmer will complete the documentation for the program.

  • Produce a description of the program, layouts of the input and output record and a program listing.

  • Example: User manual



Resources

Books


  1. Shelly Cashman, (2010). Discovering Computer

  2. CD Courseware KPM

Websites

  1. http://www.bukisa.com/articles/108793_program-development-phase

  2. http://en.wikipedia.org/wiki/Object-oriented_programming



Unit ICT dan Pengkomputeran, Sektor Pengurusan Akademik, JPN Kedah


Download 0.62 Mb.

Share with your friends:
1   2   3   4




The database is protected by copyright ©ininet.org 2024
send message

    Main page