Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 71

UNIT 1 BASIC CONCEPTS

1.1- Software: System Software and Application Software


1.2 Algorithm.
1.3 Programming Language.
1.4 Software.
1.5 Programming (Coding).
1.6 Programming paradigms.
1.7 Text Editors.
1.8 Compilers and interpreters.
1.9 Executables.
1.10 Command Line.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


UNIT 1 BASIC CONCEPTS

Software
Computer programs that control the
operation of the computer / computer
instructions or data. Anything that can
be stored electronically is software. The
storage devices and display devices are
hardware.

PROGRAMMING FUNDAMENTALS
- HAZAEL GMEZ ENCINAS
PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS
1.1- SYSTEM AND APPLICATION SOFTWARE

Software is often divided into two categories.


Systems software includes the operating
system and all the utilities that enable the
computer to function. Applications software
includes programs that do real work for users.
For example, word processors, spreadsheets,
and database management systems fall under
the category of applications software.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ
ENCINAS
System software
Is an interface between application
software and hardware
Controls the computer hardware and acts
as an interface with applications programs

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ


ENCINAS
SYSTEM SOFTWARE
Coordinates instructions between Software and hardware, Includes:
Operating systems and utility programs.
APPLICATION SOFTWARE
Programs used to complete taks. Some popular apps for desktop and mobiles:

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


Operating
Application and
software systems
software

Users
Hardware

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


OPERATING SYSTEM FUNCTIONS

Perform common computer hardware functions


Provide a user interface
Manage system memory
Manage processing tasks
Provide networking capability
Control access to system resources
Manage files

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


User interface
A function of the operating system that allows
individuals to access and command the computer

Graphical user interface (GUI)


A user interface that uses pictures (icons) and
menus displayed on the screen to send commands
to the computer system
E.g. Windows, MAC OS
Command-based user interface
A particular user interface that requires text
commands be given to the computer to perform
basic activities
E.g., unix, DOS
SOME OF THE OPERATING SYSTEM TASKS
Memory management
Controls how memory is accessed and maximizes
available memory and storage
Use of virtual memory
This is the memory that allocates space in
secondary storage to supplement the immediate,
functional memory capacity of RAM
Multitasking
A processing activity that allows a user to run
more than one application at the same time

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


TYPES OF APPLICATION SOFTWARE

Proprietary
Designed to solve a unique and specific problem
In-house
Development of application software using the companys
resources
Contract
Developed for a particular company
Off-the-shelf
An existing software program that can be used without
considerable changes expected

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


Application
software

Proprietary Off-the-shelf
software software

In-house Customized Standard


Contract
developed package package

In-house Contract
customized customization

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.2 ALGORITHM.
A process or set of rules to be followed in calculations
or other problem-solving operations, especially by a
computer.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.2 ALGORITHM.
Starting from an initial
state, the instructions
describe a
computation that,
when executed, proceeds
through a finite number
of states, eventually
producing "output and
terminating at a final
ending state.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.2 ALGORITHM.
Flow Chart:
Is a type of diagram that represents an
algorithm, workflow or process, showing the
steps as boxes of various kinds, and their
order by connecting them with arrows.
Pseudocode:
A notation resembling a simplified
programming language, used in program
design.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


FLOWCHART PSEUDOCODE

Proceso arreglarLampara
Si LamparaConectada == True Entonces
Si BulboQuemado ==True Entonces
ReemplazarBulbo();
Sino
RepararLampara();
FinSi
Sino
ConectarLampara();
FinSi
FinProceso

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


The friendship algorithm

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


https://www.youtube.com/watch?v=k0xgjUhEG3U
Flow chart: Pseudocode:

Start
Task: add two numbers
Get 2 numbers Start
Get two numbers
Add them
Add them Print the answer
End

Print answer

End

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


WHAT ARE THOSE FUNNY SYMBOLS?

START/END

INPUT/OUTPUT

PROCESS

DECISION

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


WHAT ARE THOSE FUNNY SYMBOLS?

START/END
Used at the beginning
and end of each
flowchart.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


WHAT ARE THOSE FUNNY SYMBOLS?

INPUT/OUTPUT
Shows when
information/data comes
into a program or is
printed out.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


WHAT ARE THOSE FUNNY SYMBOLS?

PROCESS
Used to show
calculations, storing of
data in variables, and
other processes that
take place within a
program.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


WHAT ARE THOSE FUNNY SYMBOLS?
DECISION
Used to show that the
program must decide
whether something
(usually a comparison
between numbers) is true
or false. YES and NO (or Y
X>7?
T/F) branches are usually
shown. N

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


FlowChart
CALCULATING AGE ALGORITHM
Start

Pseudocode
Get yr
Start
Get year born Calc age
Calculate age
Print age Print age
If age > 50 print OLD
End Y
OLD Age>50?
N
End

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.3 PROGRAMMING LANGUAGES.
Programming languages
Coding schemes used to write both systems and
application software

Play Video

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


CATEGORIES OF PROGRAMMING LANGUAGES

Machine Language
1st generation programming language
Considered a low-level language because it involves basic
coding using the binary symbols 1 and 0
Assembly Language
2nd generation language
Replaced binary digits with mnemonics (e.g., ADD)
programmers could more easily understand
CATEGORIES OF PROGRAMMING LANGUAGES

Third Generation Languages


Continued trend to more symbolic code (e.g. COBOL)

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ


ENCINAS
CATEGORIES OF PROGRAMMING LANGUAGES

Fourth Generation Languages (4GLs)


Languages that are less procedural and even more English-like than third-generation
languages (e.g. Perl, PHP, Python, Ruby)
Fifth Generation Languages (5GLs)
is a programming language based on solving using constraints given to the program,
rather than using an algorithm written by a programmer. (ie: Prolog, OPS5 and
Mercury)

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


You do not need to study this slide

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS
PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS
PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS
PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS
1.4 SOFTWARE.
1.5 PROGRAMMING (CODING).
The action or process of writing computer programs.

Programming involves activities such as analysis,


developing understanding, generating algorithms,
verification of requirements of algorithms including their
correctness and resources consumption, and
implementation

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


COMPILED CODE VS INTERPRETED CODE
Some programming languages (like Java or C++) require the
code to be compiled (translated to binary) before it can be
started.
Others (like PHP or JavaScript) are interpreted, meaning that
each command is translated separately when the program is
started.
WHAT DOES PROGRAMMING
LOOK LIKE?

Here are some examples of an instruction to


print Hola mundo
PHP echo Hola mundo;
JavaScript alert(Hola mundo);
Python (v3) PRINT (Hola mundo)
BASIC PRINT Hola mundo
Java System.out.print(Hola mundo);
C++ printf(Hola mundo);
Pascal WRITELN(Hola mundo);
Assembly XPRNT MESSAGE1
Language MESSAGE1 DC Hola mundo

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


HOW DO YOU WRITE A PROGRAM?

Decide what steps are needed to complete the


task (THINK, this important step is usually
skipped)
Write the steps in pseudocode or using flowchart
(graphic symbols) if is necessary-
Translate into the programming language
Try out the program and debug it (fix if
necessary)

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


BASIC ELEMENTS OF A PROGRAM

All programming languages have certain features in common. For


example:
Variables
Commands/Syntax (the way commands are structured)
Loops
Decisions
Functions

Each programming language has a different


set of rules about these features.
VARIABLES
Variables are part of almost every program.
A variable is a place to put data and is usually represented by a letter or a word.
(Think of a variable as a Tupperware container with a label on it.)
Variable names cannot contain spaces.
Some programming languages have very specific limits on variable names.
Usually there are several ways to put information into a variable. The most common
way is to use the equal sign (=).
X=7
Sometimes you must specify the type of data that will be placed in a variable.
Here are some examples of data types:
Numeric (numbers of all kinds)
String (text, strings of letters)
Integer (whole numbers)
Long (large numbers)
Boolean (true/false)

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


COMMANDS/SYNTAX
Programming languages are truly languages.
They have rules about grammar, spelling, punctuation, etc.
You need to learn the rules of a programming language, just as you
learned to speak and write English.

LOOPS
A loop is a repetition of all or part of the commands in a program.
A loop often has a counter (a variable) and continues to repeat a
specified number of times.
A loop may also continue until a certain condition is met (e.g., until the
end of a file or until a number reaches a set limit)

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


DECISIONS
You saw a flowchart symbol for decisions.
A program often needs to decide whether something is true or
false in order to see which way to continue.
Programs often use IF (or IF THEN or IF THEN ELSE) statements to
show a decision.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


FUNCTIONS

In most programming languages, small sub-programs are used to perform


some of the tasks.
These may be called functions, subroutines, handlers, or other such terms.
Functions often have names (e.g., getName or calcularIva).
A function generally gets information from the main program, performs some
task, and returns information back to the program.
Functions follow the same rules of syntax, etc. as the main program.
JavaScript code is primarily made of a series of functions.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


DEBUGGING
To debug means to try a program, then fix any
mistakes.
Virtually no program works the first time you
run it. There are just too many places to make
errors.
When you are debugging a program, look for
spelling and punctuation errors.
Fix one error at a time, then try the program
again.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


Play video
Code stars

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.6 PROGRAMMING PARADIGMS.

Programming paradigm is a fundamental


style of computer programming

Paradigms differ in concepts and abstractions


used to represent the elements of program

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


FOUR MAIN PROGRAMMING PARADIGMS
Procedural/Imperative
Object-Oriented
Logic
Functional
IMPERATIVE PROGRAMMING
Derived from latin word imperare means to
command

It is based on commands that update


variables in storage

Is a programming paradigm that describes


computation in terms of statements that
change a program state.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


UNSTRUCTURED COMMANDS
The unstructured commands contains:
assignment command,
sequential composition of commands,
a provision to identify a command with a label,
unconditional and conditional GOTO commands

GOTO is the devil,


You should Keep
Away From It
CONTD..
The unconditional goto command has the form:
goto LABELi
The sequence of instructions next executed begin with the command labeled
with LABELi.

The conditional goto command has the form: <?php


if conditional expression then goto LABELi goto a;
echo 'Foo';

a:
echo 'Bar';
?>

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


STRUCTURED PROGRAMMING
The goal of structured programming is to provide control structures that
make it easier to reason about imperative programs.
an IF statement corresponds to an If condition then command and a DO
statement corresponds to a While condition Do command.

IF (something ==true) then command


DO --> command while (something ==true)

An imperative program can only be understood in terms of its execution


behavior.
Thus, the whole program may need to be examined in order to
understand even a small portion of code.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


PROCEDURAL PROGRAMMING
The program is built from one or more procedures

It provides a programmer a means to define


precisely each step in the performance of a task.

The ability to re-use the same code at different


places in the program without copying it.

An easier way to keep track of program flow than a


collection of "GOTO" or "JUMP" statements

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


DECLARATIVE PROGRAMMING
Declarative programming is a non-imperative
style of programming

Does not explicitly list command or steps that


need to be carried out to achieve the results.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


A GREAT EXAMPLE OF DECLARATIVE
VS. IMPERATIVE PROGRAMMING
For example:
List<int> collection = new List<int> {1,2,3,4,5 };

Imperative programming
List<int> results = new List<int>();
foreach(var num in collection)
{
if (num % 2 != 0)
results.Add(num);
}

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


EXAMPLE LANGUAGES
Procedural
Assembler, Fortran, Cobol, C, etc

Non-Procedural
SQL, Visual Basic, etc etc.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


FUNCTIONAL PROGRAMMING

It treats computation as the evaluation of


mathematical functions and avoids state and
mutable data.

It emphasizes the application of functions, in


contrast to the imperative programming style

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


LOGIC PROGRAMMING PARADIGM
It is the use of mathematical logic for computer programming

The problem-solving task is split between the programmer


and theorem-prover

Prolog is a general purpose logic programming language


associated with artificial intelligence and computational
linguistics

It is based on Facts and Rules

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


OBJECT ORIENTED PARADIGM
Object-oriented programming (OOP) is a programming
paradigm that uses "objects" data structures
consisting of datafields and methods together with
their interactions to design applications and computer
programs.
It is a paradigm where we focus real life objects while
programming any solution.
We actually write behaviors of our programming
objects, those behaviors are called methods in objected
oriented programming.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


PRINCIPAL ADVANTAGE
They enable programmers to create modules that do
not need to be changed when a new type of object
is added.

A programmer can simply create a new object that


inherits many of its features from existing objects.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.7 TEXT EDITORS.
Is a program designed
specifically for editing source
code of computer programs
by programmers.

Text editors are the most


fundamental programming
tool, as the fundamental job
of programmers is to write
and edit source code.
Developer-Poll: IDE/Editor

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.8 COMPILERS AND INTERPRETERS.
Interpreter Compiler

Scans the entire program and


Translates program one statement at
translates it as a whole into machine
a time.
code.

It takes large amount of time to


It takes less amount of time to
analyze the source code but the
analyze the source code but the
overall execution time is
overall execution time is slower.
comparatively faster.

No intermediate object code is


Generates intermediate object code.
generated.

Continues translating the program


It generates the error message only
until the first error is met, in which
after scanning the whole program.
case it stops.

Programming language like PHP, Programming language like C, C++


Python, Ruby use interpreters. use compilers.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


COMPILED INTERPRETED
1.9 EXECUTABLE.
Executable causes a computer "to perform indicated
tasks according to encoded instructions.

These instructions are traditionally machine code


instructions for a physical CPU. However, in a more
general sense, a file containing instructions (such as
bytecode) for a software interpreter may also be
considered executable; even a scripting language
source file may therefore be considered executable in
this sense

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS


1.10 COMMAND LINE.
A command-line interface (CLI), is a means of
interacting with a computer program where the user (or
client) issues commands to the program in the form of
successive lines of text (command lines).

The interface is usually implemented with a command


line shell, which is a program that accepts commands
as text input and converts commands to appropriate
operating system functions.
systems are less widely used by casual computer users,
who favor graphical user interfaces.

PROGRAMMING FUNDAMENTALS - HAZAEL GMEZ ENCINAS

You might also like