Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Computer Programs

&
Programming Languages
Computer Programs & Programming Languages

Computer programs

Computer program = Software = Application

= Logical sequence of instructions or expressions to be


interpreted and executed by computers in order to produce
certain results

= Data Structures + Algorithms (turn inputs into outputs)


Computer Programs & Programming Languages

Computer programs
Problem / Computer
Input data Output data
Domain programs
- Student average
Student grades
Individual grades
management - Pass/Fail reports
- Scholarship reports
- Total amount
Order - Product names/IDs - Discount
management - Product quantities Process inputs - VAT
Compute outputs - Grand total
- Invoices - Account balance
received/issued - Balance sheet
- Payment - Cash flow statement
Accounting
documents - P&L account
received/issued
- Loan contracts
Computer Programs & Programming Languages

Phases in development of computer programs


- Analysis Detailed study of the problem/domain for which the future
application is intended; outcomes: application requirements and goals.

- Design Provides a solution that is programming language-neutral;


outcome: detailed software specification (textual & graphical) = how
the application is expected to perform

- Implementation = programming > Specifications are translated into


actual code, using a particular programming language

- Testing The application is validated against previously specified


requirements

- Exploitation and maintenance The actual using of the application


by its beneficiaries. Maintenance is directed at remedying eventual
errors and continuously updating the program in order to comply with
changes in user requirements.
Computer Programs & Programming Languages

Programming languages

= Communication techniques used for human-computer


interaction

Consist of:

- VOCABULARY > a set of reserved, language-specific


words

- SYNTAX > rules used for combining vocabulary


elements into executable instructions or expressions +
punctuation rules

- SEMANTICS > the meaning of vocabulary words and


instructions
Computer Programs & Programming Languages

Programming languages
VB.NET EXAMPLES
Reserved words: Dim, String, Or, AndAlso, If ..........
RIGHT WRONG
Variable declaration:
Dim City, CustomerType As String Dim City; CustomerType As String
dim city as string Dim city as String.
Dim InvoiceTotal as Double Dim Invoice Total as Double
Changing a variables value:
City = Sibiu City = Sibiu, InvoiceDate = 2/2/2008
InvoiceDate = #2/2/2008# InvoiceTotal := 1.19 (VAT not included)
InvoiceTotal /= 1.19 VAT not included
Alternative structure (condition):
If City = Bucuresti AndAlso If City = Bucuresti And Also
CustomerType = individual Or CustomerType = individual Or
CustomerType = organization Then organization Then
Computer Programs & Programming Languages

Generations of programming languages

Low-level languages:
- 1GL / machine languages use binary coding system;
depend on the type of the processor
- 2GL / assembly languages use instructions made up of
symbolic instruction codes, converted by an assembler into
machine language

High-level languages:
- 3GL / procedural languages
- 4GL / non-procedural languages
- 5GL
Computer Programs & Programming Languages

Generations of programming languages


Low-level languages:
- 1GL / machine languages
- 2GL / assembly languages
High-level languages:
- 3GL / procedural languages provide a set of instructions
derived from the natural language, which are independent of
the processor type; make use of compilers and interpreters in
order to get translated into machine language; e.g. Fortran,
Cobol, Pascal, C, C++, Java, Basic
- 4GL / non-procedural languages closer to the natural
language; directed at certain type of applications e.g. SQL
is used for managing relational databases
- 5GL provide visual (graphical) interfaces for creating
source code that is usually compiled with a 3GL or 4GL
compiler e.g. VB.NET
Computer Programs & Programming Languages

Compilers & Interpreters


= Software applications used for translating the source
code of an application into machine code
Compilers:
- Convert the entire source program into machine code before
executing it
- Produce executables (object programs) which can be run on
any machine that is compatible (processor & platform) with the
one on which the executable was created
- Once the executable is built, the program runs faster than
interpreted programs
- Ensure the protection of the source code, which is
inaccessible from the executable file
- Specific to most high-level programming languages: Pascal,
C, C++, C#, Visual Basic, etc.
Computer Programs & Programming Languages

Compilers & Interpreters


= Software applications used for translating the source
code of an application into machine code
Interpreters:
- Translate and execute one code line at a time; the time
necessary to launch the execution of a program is significantly
reduced (vs compiled programs)
- Deficient in terms of execution duration (considerable > each
instruction is interpreted and then executed for each running
program) and resources employed (both the program and the
interpreter are loaded in the internal memory)
- Ensure application portability as the program can be executed
on any machine that has an interpreter installed
- Do not produce executables, so programs can only be run if the
source code is available
- Typically used for scripting languages: PHP, JavaScript, Perl,
VBScript, etc.

You might also like