gnmijk - github pages · 2019. 11. 8. · 3 ur ilw 5 hs r uwlq j ' % 2 q olq h 6 k r s '...
TRANSCRIPT
Programming Computers
Oliver Sturm • @olivers • [email protected]
Computers Are EverywhereObvious: PC, Mac
Mobile: laptops, tablets, phones
Small: watches, wearables
Integrated/embedded: controllers in cars, radios, home electronics, USB sticks
Sometimes the term "computer" is interpreted to include components other than theprocessor: memory, I/O chips, storage
Programming Computers 2 / 18
Computers Are EverywhereObvious: PC, Mac
Mobile: laptops, tablets, phones
Small: watches, wearables
Integrated/embedded: controllers in cars, radios, home electronics, USB sticks
Sometimes the term "computer" is interpreted to include components other than theprocessor: memory, I/O chips, storage
All processors require program code!
Programming Computers 2 / 18
Program DeliveryDesktop: installers
Mobile: app stores
Web: download in browser
Controllers: factory preload, and/or developer upload through interfaces
Programming Computers 3 / 18
Programming Languages - AssemblerAssembler "keywords" are translated (almost) directly into processor opcodes
iNumVec EQU [esp + 16]pResult EQU [esp + 20]
mov ecx,iNumVecmov eax,pMatrixlea edx,[ecx*8]neg ecx
Programming Computers 4 / 18
Programming Language BabylonWikipedia lists 694 "notable programming languages"
694!
Many languages are "special purpose"
Many general-purpose languages have evolved and replaced one another
StackOver�ow survey 2019 still shows 11 languages used by at least 20% of thesurvey audience
Programming Computers 5 / 18
Programmable Controllers: Arduinohttps://arduino.cc
Arduino IDE (Integrated Development Environment) free to download
Lots of tutorials
Basic principle of programming: IPOInput / process / output
Programming Computers 6 / 18
Programmable Controllers: Arduino
Programming Computers 7 / 18
Arduino Sample - TinkerCad
Programming Computers 8 / 18
A Look At The Code (Main Loop IPO, cut to size)void loop() { int readings[buttonsHandled];
for (int i = 0; i < buttonsHandled; i��) { �� Input: Read all the button states readings[i] = digitalRead(buttonIndexBase + i);
�� Process: find out whether output should be switched if ((millis() - debounceStartTime[i]) > debounceDelay) { �� Output: set the new state digitalWrite(outputIndexBase + i, outputStates[i]); } }}
Programming Computers 9 / 18
Other Small Programming PlatformsMicrobit (https://microbit.org)
Great for learning
Visual Programming
JavaScript
Raspberry PiComplete computer, but cheap and small
Linux, Windows (IoT Core), and others
Automation, network systems, entertainment
PocketChipAll-in-one mini computer
Programming Computers 10 / 18
Writing "real" computer applicationsUser interfaces required
View description languages
Native vs cross-platform
Most popular application platform now: HTML/CSS/JS
Learn in sandbox environments, e.g. https://codepen.io
Programming Computers 11 / 18
Sample HTML<p> <button onclick="button_clicked()">Do something��button>��p>
<p> <input type="text" id="name" placeholder="Please enter your name" ��
<button onclick="sayhi()"> Click here once you've entered your name ��button>��p>
<p id="output">��p>
Programming Computers 12 / 18
Sample CSSbutton:hover { background�color: red;}
Programming Computers 13 / 18
Sample JavaScriptfunction button_clicked() { alert('Thanks for clicking the button');}
function sayhi() { const nameField = document.getElementById('name'); const outputField = document.getElementById('output'); outputField.innerHTML = 'You said your name is <b>' + nameField.value + '��b>';}
Programming Computers 14 / 18
Frameworks And LibrariesProgrammers are lazy
Code can be distributed and reused
ExamplesUI libraries
Network functionality
Working with persistent data
Science and math functionality
Hardware interaction
Programming Computers 15 / 18
Software Architecture
Client
Message Queue /Event Bus
ProfitReporting
DB
OnlineShopDataDB
CustomerData
Db
Web Server
CommandProcessorEvent Store
Loaddata
Access Web App
Send commands
Load data
Load data
Programming Computers 16 / 18
Questions?
Thank YouPlease feel free to contact me about the content anytime.
Oliver Sturm • @olivers • [email protected]