- Computer programming
- Programming paradigms
- Evolution of programming languages
- C++ characteristics
- Compiling and interpreting. Debugging
- Knowledge assessment test
- Programming is an IT activity to develop program products, software programs required.
- Programming includes the following activities: product specification, projection, implementation, documentation and maintenance.
- It is a process that leads from formulating a problem (calculus) to an executable program on a computer.
- Related tasks are testing, debugging, source-code maintenance, implementation of the built system, its management etc; they can be considered as part of the programming process,
but most often they are associated with software development.
- Software Engineering (Programming Engineering) combines engineering techniques with software development practices.
- In software engineering, programming (implementation) is seen as one of the software development process phases.
- There is a permanent debate if writing programs is a form of art, craftsmanship or engineering discipline.
Programming paradigms are a way to classify programming languages according to their characteristics.
- Structured programming is a programming paradigm that emerged in the 1970 due to the growing complexity of computer programs It has appeared as a new programming model in order to create new programming techniques capable of producing programs that are safe and durable at the same time.
- Unstructured vs structured programming example.
- Imperative programming, in contrast with declarative programming, is a paradigm that describes calculus as instructions that alter the state of a program. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Procedural programming is a common method of executing imperative programming, and therefore the two terms are often used as synonyms.
- Declarative programming is a programming style that describes the logic of a calculation, without showing how it was executed; declarative programming is about what needs to be calculated not how is made.
- Functional programming is a programming paradigm that treats calculus as an evaluation of mathematical functions and avoids mutable status and data. Emphasis is placed on the application of functions, as opposed to imperative programming, which mainly uses state changes.
- Logic programming, functional programming, and rule-based programming are part of the declarative programming paradigm.
- Logic programming example.
- Object Oriented Programming is a programming paradigm, focused on the idea of encapsulation, that is, the grouping of data and code that operates on them in a single structure. Another important concept associated with object-oriented programming is polymorphism.
Video presentation of programming paradigms
Evolution of programming languages
Discussion about evolution of programming languages
The genealogy tree of programming languages
History and origins
- It is one of the 2000 programming languages
- C++ origins
- low level programming languages (machine code, assembly languages)
- high level programming languages (C, ADA, COBOL, FOTRAN)
- object oriented programming
- 1979: Bjarne Stroustrup – Simula, C with classes … ->
- 1983: C++ (compared with C)
- inlining (inline keywords and Class Member Functions)
- implicit arguments for functions
- strong verification of types
- virtual functions
- overloading functions
- references with symbol &
- keyword const
- 1998: STL, C++98 – first C++ standards
- 2003, 2005, 2011, 2014 – C++03, C++0x, C++11, C++14
- 2017 – a new revision is planned
- easy to program (less time for writing, shoter and easier to read); debate in classroom
- portable – programms can run on different computers without modifications or with little or no changes
- strongly typed unsafe language (the programmer has to know exactly what to do)
- accepts both explicitly defined and deduced variables
- accepts static verification (at compilation) but also type dynamics (during program execution)
- offers a wide range of programming paradigms
- a very large collection of libraries
- language that accepts more programming paradigms:
- generic: you can use types that will be specified later and will be instantiated as needed
- structured: intuitive control (the order in which the instructions are executed)
- imperative: how (instruction sequences to be executed by the computer)
- object oriented: objects + attributes + procedures (methods)
- declarative: what (what calculations should be made and not how to be made)
- functional: programs seen as evaluating some mathematical functions
- Powerful, flexible (conversions)
- Portabiliy (Windows, Apple, Linux, UNIX)
- Efficient, elegant
- Perspectives in other programming languages (discussion)
- Programmer’s language
Why Code::Blocks ?
- you are accustomed to it from highschool (discussion)
- simple and suggestive editor
- allows automatic code arrangement (Format use AStyle)
Compiling and interpreting. Debugging
A source code file can be compiled or interpreted.
- Compilation: the source code is translated by a program (called compiler) into machine code, after which it can be executed
- Interpretation: A program is executed directly from source code through a program (called interpreter) that translates and executes the source code instruction after instruction
- Course example
Differences between compiler and intrepreter
|1||The compiler takes the entire program as input.||The interpreter takes each instruction as input. (It translates instruction with instruction.)|
|2||An intermediate object code is generated.||No intermediate object code is generated.|
|3||Conditional control instructions run faster.||Conditional control instructions run slower.|
|4||Memory needed: Higher (because an object code is generated)||The required memory is reduced.|
|5||The program must be compiled every time.||Every time a high-level program is converted into a low-level program.|
|6||Errors are displayed after checking the entire program.||Errors are displayed for each interpreted instruction (if any)|
|7||Example : C Compiler||Example: BASIC Interpreter|
C ++ compilation scheme
- Bug – programming error, hard to grasp
- Compilation errors:
- problems identified by the compiler, generally resulting from violation of syntax rules
- or by misusing data types, memory allocation
- errors in the link-editing phase;
- Runtime Errors: The program does not do what you expect it to do („the computer does what you told it to do, not what you want it to do”
If programming languages would be vehicles…
C has been the great multi-functional: compact, powerful, going anywhere and trustful in situations where your life depends on it.
C ++ is the new C – twice as strong, twice as powerful, working in hostile environments, but if you try to use it without care and without special training, you probably will crash.
C♯ is C ++ with many security features so that ordinary civilians can use it as well. Looks a little stupid, but it has mostly the same power, as long as you stay close to fuel pumps, car shops, and the comfort of civilization.
Java is another attempt to improve C. In a way it does its job, but it’s much slower, more voluminous, it pollutes everywhere, and people will think you’re a peasant.
Knowledge assessment test
Discussion with students
- ocw.mit.edu/courses/ electrical-engineering-and-computerscience/6-096-introduction-to-c-january-iap-2011/
- kickassinfographics.com/history/ the-evolution-of-computerlanguages-infographic/