ECE151 - Lecture 1
ECE151 - Lecture 1
Programming
Lecture 1
1. Lecture slides
2. Notes
3. Homework
4. Example codes
5. References
Tony Gaddis. Starting Out with C++: From Control Structures through Objects.
Pearson, Eighth Edition, 2015
Logistics
1. ~12 lectures
2. Marks distribution
40 Final, 60 Year work (Final project 20, homeworks and
assignments 20, midterm 15 and quizzes 5)
3. Be on time
Overview
Computer
Programmable machine designed to follow instructions.
Program
Instructions in computer memory to make it do something.
Programmer
Person who writes instructions (programs) to make computer perform a
task.
1 https://staff.emu.edu.tr/sebnemcoban/Documents/_itec243/StartingOutwithC++.pdf
Main Hardware Component
Categories
Figure 1-2
Central Processing Unit (CPU)
Comprised of:
Control Unit
Retrieves and decodes program instructions
Coordinates activities of all other parts of computer
Arithmetic & Logic Unit
Hardware optimized for high-speed numeric calculation
Hardware designed for true/false, yes/no decisions
CPU Organization
Figure 1-3
Main Memory
● In Figure 1-4, the number 149 is stored in the byte with the
address 16, and the number 72 is stored at address 23.
Main Memory – Cont.
Secondary Storage
From RedHat 3
3 https://www.redhat.com/en/topics/open-source/what-is-open-source
Technical Standard - What
From RedHat 3
3 https://www.redhat.com/en/topics/open-source/what-is-open-source
Programs & Programming
Languages
1011010000000101
• Types of languages:
C++
BASIC Ruby
FORTRAN
Java
Visual Basic
COBOL
C#
JavaScript
C Python
From a High-Level Program to an
Executable File
a) Create file containing the program with a text editor.
b) Run preprocessor to convert source file directives to source
code program statements.
c) Run compiler to convert source program into machine
instructions.
d) Run linker to connect hardware-specific code to machine
instructions, producing an executable file.
● Steps b–d are often performed by a single command or button
click.
● Errors detected at any step will prevent execution of following
steps.
From a High-Level Program to an
Executable File – Cont.
Integrated Development
Environments (IDEs)
● Imperative
● Structured
● Procedural
● Functional
● Event-Driven
● Object-Oriented
● Declarative
● Reactive
● Others
Examples of Programming
Paradigms - Cont.
Imperative Programming
● Programming paradigm that uses statements that change a
program’s state.
● Imperative program consists of commands for the computer to
perform.
Most of the mainstream languages, including object-oriented
programming (OOP) languages such as C#, Visual Basic, C++,
and Java, were designed to primarily support imperative
(procedural) programming.
Examples of Programming
Paradigms - Cont.
Structured Programming
● Programming paradigm aimed at improving the clarity, quality,
and development time of a computer program
● Making extensive use of subroutines, block structures, for and
while loops—in contrast to using simple tests and jumps such
as the goto statement.
Examples of Programming
Paradigms - Cont.
Procedural Programming
● Derived from Structured programming
● Based upon the concept of the procedure call.
● Procedures, also known as routines, subroutines, or functions
simply contain a series of computational steps to be carried out.
● Any given procedure might be called at any point during a
program’s
● execution, including by other procedures or itself.
● Pascal, C, C++, Ada, Lisp, PHP, Python, and Go
Examples of Programming
Paradigms - Cont.
Functional Programming
● Treats computation as the evaluation of mathematical functions
and avoids changing-state and mutable data.
● Programming is done with expressions or declarations instead
of statements.
● In functional code, the output value of a function depends only
on the arguments that are passed to the function, so calling a
function f twice with the same value for an argument x will
produce the same result f(x) each time.
Examples of Programming
Paradigms - Cont.
Functional Programming
● C++, Clojure, Coffeescript, Elixir, Erlang, F#, Haskell, Lisp,
Python, Ruby, Scala, SequenceL, Standard ML, JavaScript
Examples of Programming
Paradigms - Cont.
Event-Driven Programming
● Flow of the program is determined by events such as user
actions (mouse clicks, key presses), sensor outputs, or
messages from other programs / threads.
● Dominant paradigm used in graphical user interfaces (GUI) and
other applications (e.g. JavaScript web applications) that are
centered on performing certain actions in response to user
input.
● This is also true of programming for Device Drivers, Game
Programming
Examples of Programming
Paradigms - Cont.
● There are many different types of data, which you will learn
about in this course.
From Textbook4
4 4.5 — Unsigned integers, and why to avoid them – Learn C++ (learncpp.com)
Input, Processing, and Output