0% found this document useful (0 votes)
49 views30 pages

Commonwealth of Australia: Act 1968 (The Act)

The document provides an overview of copyright law and warns the reader that the material may be subject to copyright. It then discusses the COMP1004 Engineering Programming unit, including unit outcomes, topics that will be covered such as problem solving, algorithms, C programming, and Linux. It also discusses teaching and learning strategies for the unit.

Uploaded by

Francis Gomes
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)
49 views30 pages

Commonwealth of Australia: Act 1968 (The Act)

The document provides an overview of copyright law and warns the reader that the material may be subject to copyright. It then discusses the COMP1004 Engineering Programming unit, including unit outcomes, topics that will be covered such as problem solving, algorithms, C programming, and Linux. It also discusses teaching and learning strategies for the unit.

Uploaded by

Francis Gomes
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/ 30

COMMONWEALTH OF AUSTRALIA

Copyright Regulation 1969

WARNING

This material has been copied and communicated to


you by or on behalf of Curtin University of
Technology pursuant to Part VB of the Copyright
Act 1968 (the Act)

The material in this communication may be subject


to copyright under the Act. Any further copying or
communication of this material by you may be the
subject of copyright protection under the Act.

Do not remove this notice


Engineering Programming (COMP1004)
Lecture 1: Introduction

Dr Tele Tan
Outcomes

After this lecture you should be able to ...


State the unit outcomes (done)
State what is meant by an environment
Be familiar with Linux and some commands
Describe the mechanics of writing and running C programs
Identify some programming tools
Engineering Programming
helps you to learn how to write clean, efficient, and documented
programs using sound problem solving techniques. The
emphasis is on using programs to deal with engineering
problems that will occur at various stages in your degree and
career. Students are encouraged to think about the proper
design of a program before beginning to code.
Unit Level Outcomes
On completion of this unit you should be able
to:
ULO1: Apply logic, rigour and discipline in
designing the solution to a problem as a sequence
of distinct and unambiguous instructions
ULO2: Translate the solution sequence of a
problem into a set of commands to create a simple
program
ULO3: Compile, debug, run, and validate simple
computer programs
What will be taught?
Concepts
Problem solving
Procedural-based design
Skills
Design of algorithms
C program generation
Experience of Linux
Text editing and compilation
Debugging and testing
Some learning thoughts
Lao Tzu:
If you tell me, I will forget
If you show me, I will remember
If you let me experience, I will learn
Hence lots of opportunities to design and
write programs
Yoda: You must unlearn what you have
learned
Luke Foreman (EFY 2010): The unit taught
me that I must be willing to try and fail (and
fail again perhaps), in order to learn how to
write code
Teaching strategies
Try not to lecture (needs your help!)
Do your own pre-class reading
Engage in your lab work
Collaborate and cooperate with peers, tutors
and the lecturer
Do your online quizzes
Rely on supplementary materials - the web
etc.
Learning strategies

Learning to program can be tricky - creative process


May have to develop new habits
Know when to get help from experts
Too soon - wont learn
Too late - may not finish design or program
Try to work out the solution yourself
Take breaks
Re-read relevant documentation
Look at similar examples - the web, books etc.
Discuss with peers
See lecturer
See tutor
Visit the programming clinic in the EFY studio
Basic computer architecture
Input and output devices
Input devices
Convert instructions and data into binary form
Transmit to the CPU
Output devices
Convert binary contents of memory into meaningful symbols for
humans to view
Outputs information as spreadsheets, graphics, sound, video and
robotic movements
What is Binary?
Computer numbering system using two symbols; 0 and 1
Use to represent numbers and memory addresses
For example, a four digit binary number system can have the
following numbers;
0000,0001,0010,0011,0100,0101,0110,0111,1000,1001,1010,1011
,1100,1101,1110,1111
Environment
Hardware
Operating system
Development tools
Languages
Standard libraries
Operating System
What is an operating system?
An operating system (OS) is the software that manages the
sharing of the resources of a computer and provides
programmers with an interface used to access those
resources (http://en.wikipedia.org/wiki/Operating_system)
Can you name some Operating Systems?
Operating System
What is an operating system?
An operating system (OS) is the software that manages the
sharing of the resources of a computer and provides programmers
with an interface used to access those resources
(http://en.wikipedia.org/wiki/Operating_system)
Pre 1980s
Proprietary systems (IBM mainframes etc.)
1980s
CPM, PCDos, MSDos, Apple OS, Unix
1990s
Windows 3.1, Windows 95, 98, Unix, Linux
2000 on
Windows 2000, NT, XP, Vista, Windows 7, Windows 8, Apple OS
X, Unix, Linux, Symbian, Android
Unix
Unix written in C, C written for Unix
Unix philosophy - build complex systems from
simple well defined small parts or tools. This
is reflected in C
Linux is a version of Unix
Very popular but not as popular as Windows!
Most web servers use Linux. Also Google
Apple computers/iphone etc. use Unix
Practical sessions will use Linux
Languages
1940s
Machine language (just numbers)
Early 1950s
Assembly language (basic commands)
Late 1950s
High level languages and compilers introduced
Fortran, Cobol, Lisp
1970s and 1980s
Structured languages
Pascal, Ada, C
1990s
Objected Oriented Languages
C++
Java
The C language
Easy to learn (compared to others)
Portable (available on many systems)
Efficient
Popular
Strong development community
Massive amount of code available
Most operating systems written in C/C++
What is programming?
Given a problem
Create or find an algorithm to solve the problem
Express the algorithm in a way a computer can understand
and execute it
Algorithm
Sequence of steps to solve problem
Data structures
How to represent the information
Numbers
Text
Images, video etc.
What is an algorithm?
Ingredients
1 cup of butter
1 cup of sugar
etc.
Methods
Preheat oven to 180 degrees C
Line a cake tray with greaseproof paper
etc.
Follow a format (define ingredients then method)
Language has a vocabulary (beat, sift, fold)
Consists of a sequence of steps (order is important)
Take decisions based on comparisons (iteration - beat until)
Make choices (if then - cover in chocolate if making a
chocolate cake)
What is a computer program?
Collection of statements
Specifies the steps to take to solve a problem
Written in a programming language
Limited vocabulary
Follows grammar rules (syntax)
Why not just write in English?
Ambiguous
Difficult to create a program to understand English
Pseudo code
Artificial, non existent language
Informal English way of describing a program
Relatively easy to manually convert to code
Ambiguous - as is English! Hence not used
by a computer
Flexible in terms of words used - some
personal choice here
You should understand it and good if others
do as well
Creating a C program

Design, pseudo code, code

Edit code (vi,


gedit)

Compile code Syntax errors


(gcc) EP100 student

Run program Results, errors


(a.out)
Our first C program
Print a message to the screen then stop
Message: Hello World

/* File: helloWorld.c
** Programmer: G. West
** Date: 5 March 2008 pseudo code
*/
#include <stdio.h> start
output Hello Word
int main(void) end
{
printf("Hello World\n");
return 0;
}
Program in memory
Compilation
Edit a file called hello.c using an editor (vi,
vim, gvim, gedit etc.)
Compile with gcc:
% gcc hello.c
Produce an executable file named a.out
Run
% a.out
Hello World
%
Doing arithmetic
Program to multiply two numbers together

#include <stdio.h>
pseudo code
int main(void)
{ start
int i,j,k; i, j and k are integers
set i to be 3
i = 3; set j to be 5
j = 5; set k to be i * j
output result: k
k = i * j; end
printf(result: %d\n,k);
}
Doing arithmetic with input
Program to multiply two inputted numbers together

#include <stdio.h>

int main(void)
{
int i,j,k;

printf(input two integers to multiply: );


scanf(%d %d, &i, &j);

pseudo code
k = i * j;
start
printf(result: %d\n,k); i, j and k are integers
} output input two integers to multiply
input i and j
k is i * j
output result: k
end
Today we discussed
Basic computer history
Unix and some commands
C language and why needed
Programs, algorithms and pseudo code
Mechanics of writing and executing a
program
Some example programs
ETAP Starts Week 3 (15 Mar)
When
Tue, 1pm 5pm
Tue, 1pm 5pm
Where
204:305
Whats next?
Practical
Familiarise yourself with Linux
Try out writing simple C programs
Meet our wonderful and caring practical tutors
Lecture Next Week
Language fundamentals

You might also like