Introduction to Programming
Introduction to Programming
Types of Software
- Desktop applications
- Web applications (via Firefox, Chrome, MS Edge)
- Mobile applications
- CLI - Command Line Interface
- Embedded applications (space shuttle, car, fridge, pacemaker)
Computer Hardware Architecture
-
CPU
-
CPU - Central Processing Unit (Single core, multi-core), (clock speed in GHz), instruction set (386, Pentium, i3, i7, ...)
-
RAM - Random Access Memory (in phones a few Gbs, in PCs 4-16 Gb, in servers it can reach a few hundred Gbs as well)
-
Hard disk (spinning disks or SSD - Solid State Drive) - Phone: 16, 32, 64 Gb; Computer a 1-2-3 TBs of spinnig disk or 128,256,512 Gb of SSD. Spinnning disks are slower but much cheaper than SSD.
-
Input: keyboard, mouse, microphone, scanner, touchpad
-
Output: Screen, printer
-
External connectors
connectors
- PS/2
- Video Connectors: VGA, DVI, SDI, HDMI, DisplayPort, ...
- USB 2,3
- RJ45 - Ethernet
- Wireless
- Bluetooth
- Audio cables (3.5mm jack)
- RJ11 - phone cable
- Firewire
- Thunderbolt
bits and bytes
base 10: 42
base 2: 00101010
1 bit 0 or 1 (transistor)
8 bit 256 = 1 byte
16 bit 65,536 = 64 kbyte
32 bit 4,294,967,296 = 4 Gb
64 bit ~ 10 ** 20 = a lot
Y2K problem
- Y2K
Y2K problem (time represented as the last two digit of the year.
Instead of 1985 we wrote 85 saved space, looked clear. You also knew that the year 86 was after the year 85 becasue 86 > 85. It worked until 1999, but when 2000 came it was (supposed to be) represented as 00.
Suddenly tomorrow was before yesterday.
Year 2038 problem
- Year 2038 problem
- 32 bit systems
Incorrect floating point number representation
e.g. in python:
1.2 - 1.0
0.19999999999999996
Operating Systems
Desktop / Server
- Microsoft Windows
- MacOS - Apple
- Linux
- Unix (Solaris, AIX, HP-UX)
- ...
Mobile
- iOS - Apple
- Android (Linux)
- Windows Mobile (discontinued)
- ...
Embedded
-
Other Unix and Linux flavors
-
Routers (and other networking equipment)
-
What do weapon systems run?
Programming paradigms
-
imperative (global state, no functions)
-
procedural - imperative (C, Bash)
-
object oriented - imperative (Java, C#, C++)
-
declarative (SQL)
-
functional - declerative (Haskell)
-
logic - declerativ (Prolog)
-
mathematical - declerative (Fortran)
-
...
Multi-paradigm: (e.g. Python, Perl)
Different OOP systems
- Java - Hello World needs a class, but numbers and strings by themselves are not objects.
- Python - Even strings and numbers are objects, but you can just write a single line to print.
print("Hello World")
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
"abc".upper()
Compiled vs Interpreted languages
- Compiled: C, C++
- Interpreted: Basic, Shell
- Python, Perl, ...?
- Java, C#, ...?
Open Source
- What is Open Source
- Why does it matter?
- Cost
- Support
- Freedom
- License! GPL - BSD
- Open Source Initiative
Why create Open Source?
Why do people create and maintain them? Why do companies contribute to Open Source and why do they release under OS license?
- Fun, creative work
- I wrote this thing, but I don't want to sell it so why not?
- Get feedback
- Contribute
Open Source business models
-
Undermine competitors (Google, now even Microsoft does it)
-
Create a huge user-base, a small fraction of it will pay money for hosting (MongoDB, Redis) or extra features (GitLab).
-
Get paied for support (e.g. RedHat)
-
Dual licenses (one version as GPL, other as some corporate-friendly license)
-
Get developer mind-share (VS Code by Microsoft, React by Facebook, ...)
Open Source languages
- Are there multiple compilers/interpreters for the language?
- Is the language definition free?
- Are the compilers/interpreters Open Source?
- IDEs ?
- Profilers?
Version Control
- Fearless experimentations
- Fearless deletition
- Easier (smoother) collaboration
- History
- git, mercurial; subversion; cvs; rcs
Software testing
- Is it still working?
- Fearless changes
- Fearless upgrades
- Regression testing!
- Acceptance testing
- capacity, load, security etc.
ASCII - Unicode
Complexity
O(n)
O(n^2)
O(n log n)
What is the Internet?
- Computers
- Networking equipment (routers, bridges, ...)
- Cables
- Wireless transmitters
- Client-Server applications
- Web Servers, Database servers, ...
- ...
What is the Cloud?
- The computer of some other people.
- Server where you can rent some processing power.
- More sofisticated if you can rent the use of an application.
- Gmail
- Google docs
- Dropbox
- Google Cloud Service, Amazon Web Services (AWS), Microsoft Azure