Lecture02

Preview:

DESCRIPTION

 

Citation preview

Knowledge Representationin

Digital HumanitiesAntonio Jiménez Mavillard

Department of Modern Languages and LiteraturesWestern University

Lecture 2

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard

* Contents: 1. Why this lecture? 2. Discussion 3. Chapter 2 4. Assignment 5. Bibliography

2

Why this lecture?

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard

* This lecture... · outlines programming languages as the highest type of formal languages, which makes them ideal for KR · describes how computers, the essential tool for DHers, work at programming level

3

Last assignment discussion

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard

* Time to... · consolidate ideas and concepts dealt in the readings · discuss issues arised in the specific solutions to the projects

4

Chapter 2

Principles of Computing

1. Overview on computers2. Programming languages

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard5

Chapter 2

1 Overview on computers 1.1 What is a computer? 1.2 Computer components 1.3 How does a computer work?

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard6

Chapter 2

2 Programming languages 2.1 User vs programmer 2.2 What is a programming language? 2.3 Classification 2.4 History of programming languages

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard7

Overview on computers

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard8

What is a computer?

* Definition · A computer is a programable machine that processes input data and produce output information

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard9

What is a computer?

* Computers in History · Abacus + Calculating device + Three arithmetic functions: + - x + Dated from 2700 to 2300 BC

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard10

What is a computer?* Computers in History · Antikythera mechanism + Analog computer + Calculates astronomical positions + Dated to the early 1st cent. BC

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard11

What is a computer?

* Computers in History · Pascaline + Adder machine + Invented by Blaise Pascal in 1640s

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard12

What is a computer?* Computers in History · The Stepped Reckoner + Mechanical calculator + Four arithmetic functions: + - x % + Invented by Leibniz in 1673

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard13

What is a computer?

* Computers in History · Difference Engine & Analytical Engine & Difference Engine No. 2

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard14

What is a computer?* Computers in History · Difference Engine & Analytical Engine & Difference Engine No. 2 + First programable computer + Memory & Processing Units & Punched-card Input + Invented by Charles Babbage from 1821 to 1848

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard15

What is a computer?* Computers in History · ENIAC + Electronic calculator + Vacuum tubes + Invented by John Mauchly in 1942

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard16

What is a computer?* Computers in History · Turing Machine + Theoretical + Equivalent to any computer + Invented by Alan Turing in 1937

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard17

What is a computer?

* Computers in History · Modern computers + Turing-complete + Von Neumann architecture + Integrated circuits

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard18

References

“Computer History Museum.” N. p., n.d. Web. 30 Nov. 2013.

De la Rosa, Javier. “Computer Tools for Linguists.” Yutzu. N. p., n.d. Web. 16 Sept. 2013.

Georges Ifrah. “Chapter 5: From Clockwork to Computer: The History of Automatic Calculation.” The Universal History of

Computing: From the Abacus to the Quantum Computer. Wiley, 2001. Print.

Georges Ifrah. “Chapter 6: What is a Computer?” The Universal History of Computing: From the Abacus to the Quantum

Computer. Wiley, 2001. Print.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard19

Computer components

* The architecture describes a computer in terms of its componentes and their relationships* It also defines the instruction set* Most of modern computers follow Von Neumann's architecture

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard20

Computer components

* Von Neumann's architecture:

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard21

Computer components* Hardware: · CPU · Memory · Input/Output* Operating System* Software · Applications · Programming software

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard22

Computer components

* CPU (Central Processing Unit) or Processor 1. Read an instruction from memory 2. Read data from memory if needed 3. Execute the instruction 4. Write the result into memory if needed 5. Get ready for next instruction

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard23

Computer components* RAM (Random Access Memory) · Area where the system holds data (values and program code) waiting to be processed by the CPU · This area can be seen as a huge “table” where the rows are memory positions and the columns are offsets with respect to each memory position

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard24

Computer components* RAM (Random Access Memory)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard25

Computer components

* HD (Hard Disk/Drive) · Area where the system stores information · The way in which the Operating System controls how information is stored and retrieved is called file system · The file format specifies how information is encoded in a digital storage medium

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard26

Computer components

* RAM vs HD · RAM: small, fast and temporal · HD: big, slow and permanent · The OS moves from the HD to the RAM only the data (vales and program code) it needs to run a program

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard27

Computer components* Input · Keyboard · Mouse · Microphone* Output · Screen · Printer · Speakers

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard28

Computer components

* Operating System · Examples: + OS X + Ubuntu + Android + Windows 8

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard29

Computer components* Operating System · Connects software with hardware and handles everything between both: + Memory + File system + I/O + ... · Examples: Ubuntu, Android, OS X, Windows 8...

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard30

Computer components

* Operating System · The file system is the way in which the OS controls how information is stored and retrieved · The file format specifies how information is encoded information in a digital storage medium

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard31

Computer components

* Operating System · Two types of files: + Text file - Contains human readable plain text - Encoded in a encoding scheme (UTF-8, Latin 1...) - Examples: txt, HTML, CSV

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard32

Computer components

* Operating System · Two types of files: + Binary file - Contains any type of data - Encoded in binary - Examples: zip, JPEG, AVI

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard33

Computer components

* Operating System · Size units:

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard34

1 B 8b1 KB 1024 B1 MB 1024 KB1 GB 1024 MB1 TB 1024 GB

b bit

B byte

KB kilobyte

MB megabyte

GB gigabyte

TB terabyte

Computer components

* Applications · An application is a computer software designed to help people to perform a task · Examples: word processor, spreadsheet, image editor, videogame, web browser...

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard35

Computer components

* Programming software · A programming tool or software development tool is a program or application that software developers use to create, debug, maintain, or otherwise support other programs and applications

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard36

Computer components* Programming software • An IDE (Integrated Development Environments) combines the features of many tools into one package + source code editor + build automation tools + debugger · Examples: Eclipse, Jbuilder, Komodo

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard37

References

Andrew S. Tanenbaum. “Chapter 1: Introduction.” Modern Operating Systems. 2nd edition. Pearson, 2001. Print.

Barata, Kimberly. Understanding Computers: An Overview for Records and Archives Staff. International Records

Management Trust/International Council on Archives, 1999. Print.

De la Rosa, Javier. “Computer Tools for Linguists.” Yutzu. N. p., n.d. Web. 16 Sept. 2013.

John Hennessy, and David Patterson. “Chapter 1: Fundamentals of Quantitative Design and Analysis.” Computer

Architecture: A Quantitative Approach. 5th Edition. Morgan Kaufmann, 2011. Print.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard38

How does a computer work?

* The computer... 1. accepts input data 2. performs pertinent operations with input and stored data (processing) 3. stores data and keep processing while needed 4. produces output information

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard39

How does a computer work?

* How does a modern computer work? The concrete behaviour depends on the particular application

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard40

How does a computer work?* How does a modern computer work?

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard41

Type of program

Input What does the program does

Output

Word processor Characters typed from the keyboard

Formats the text, corrects the spelling...

Displays and prints neatly organized text

Video game Keystrokes, joystick movements

Calculates how fast and far to move a cartoon figure on-screen

Moves a cartoon figure on-screen

How does a computer work?* How does a modern computer work?

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard42

Type of program

Input What does the program does

Output

Web browser HTML codes on other computers

Converts the HTML codes into text and graphics

Displays web pages on-screen

OCR software Text from a scanner

Recognizes shapes of characters

Converts scanned documents into a text file

Programming languages

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard43

User vs programmer

* Tipically, to use a computer, someone can: · Use an application previously developed by a programmer (user rol) · Develop their own application by using a programming software (programmer rol)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard44

What is a programming language?

* Definition · A programming language is a formal language designed to communicate instructions to a computer · Formal/Artificial vs Human/Natural

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard45

What is a programming language?

* Definition · A formal language: + has a formalized morphology, syntax and semantics + is computationally processable

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard46

What is a programming language?* Definition · morphology: keywords (vocabulary) + Example: var, defun, if · syntax: grammar rules + Example: x = y + 1; (assignment) · semantics: meaning + Example: x * 2 + 1 ≡ (x * 2) + 1 (operator precedence and associativity)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard47

Classification

* Language levels · Low-level languages + Close to machine · High-level languages + Close to human

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard48

Classification

* Programming paradigms · Imperative (how) + Procedural (statements) + Object-oriented (interacting objects) · Declarative (what) + Logic (logical sentences) + Functional (mathematical functions)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard49

Classification* Compiled vs Interpreted · Compiled language + Program translated (compiled) into machine language instructions by a compiler and executed by a hardware · Interpreted language + Program executed (interpreted) by an interpreter (run-time environment)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard50

History of programming languages

* Prehistory of programming languages · Programmers of Babylon (1790 BC) + Written language to describe computational procedures

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard51

History of programming languages* Prehistory of programming languages · Muhammad Al-Khwarizmi (762 AD) + Inventor of algorithms + Wrote Kitâ al-jabr wa'l-muqabâla + Translated into Latin as Algoritmi de numero Indorum

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard52

History of programming languages

* Prehistory of programming languages · Augusta Ada, Lady Lovelace + First programmer in history (1842) + Wrote a program for Babbage Engine

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard53

History of programming languages

* Prehistory of programming languages · Konrad Zuse + Designed Plankalkül (1945) + Never implemented as a real language + Many modern languages share Plankalkül's features

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard54

History of programming languages

* Prehistory of programming languages · Konrad Zuse + Plankalkül's features - expressions, assignments - types: bit, integer, real, arrays - conditionals, loops, subrutines

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard55

History of programming languages

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard56

History of programming languages

* Fortran (1957) · Paradigm: imperative · First high-level language · Scientific-oriented computing

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard57

History of programming languages

* Fortran (1957) · Introduced + variables + loops + procedures + datatypes: boolean, integer, real...

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard58

History of programming languages

* Fortran (1957) · Introduced + variables + loops + procedures + datatypes: boolean, integer, real...

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard59

History of programming languages

* Algol 58/60 (1958/1960) · Paradigm: imperative · Ancestor of contemporary languages · Introduced + block structure + recursion + formal definition

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard60

History of programming languages

* Lisp (1958) · Paradigm: functional · Good for symbolic computing · Language for Artificial Intelligence · Syntax and computing based on lists

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard61

History of programming languages

* Cobol (1959) · Paradigm: object-oriented · Business-oriented computations · Non-academic language · Elaborate data structures · Introduced + Record type as data structure

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard62

History of programming languages

* PL/I (1964) · Paradigm: imperative · Combination of the best features of Fortran, Algol 60 and Cobol · First language for general applications · Introduced + event handling

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard63

History of programming languages

* Basic (1964) · Paradigm: unstructured · First language for personal computing · Easy to learn · Simple, limited, general-purpose

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard64

History of programming languages

* Simula 67 (1967) · Paradigm: object-oriented · Extension of Algol 60 · For concurrent processes · Introduced + Object Orientation: classes and encapsulation

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard65

History of programming languages

* Algol 68 (1968) · Paradigm: imperative · Extension of Algol 60 · General purpose language · For academia

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard66

History of programming languages

* Pascal (1970) · Paradigm: imperative · Sucessor of Algol 60 · Academic language: excellent to teach structured programming and good habits

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard67

History of programming languages

* C (1972) · Paradigm: imperative · For system programming (implementation language of Unix) and personal computing · Very fast · High-level and low-level language

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard68

History of programming languages

* Prolog (1972) · Paradigm: logic · Very high-level language · Based on logic with proofs · Very powerful: + Backtracking + Pattern matching

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard69

History of programming languages

* Smalltalk (1972) · Paradigm: object-oriented · Sucessor of Simula 67 · The purest object-oriented language · Very powerful

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard70

History of programming languages

* Ada (1983) · Paradigm: imperative · For general applications · Completely standard · Supports concurrency

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard71

History of programming languages

* C++ (1983) · Paradigm: object-oriented · Extension of C, based on Simula · Introduced + Assignment operator overloading

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard72

History of programming languages

* Haskell (1990) · Paradigm: funcional · Purely functional: no side effects · Very high-level

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard73

History of programming languages

* Java (1995) · Paradigm: object-oriented · Based on C++ · Portable · Full object-oriented language · For internet programming but general-purpose

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard74

History of programming languages

* Perl (1987) · Paradigm: object-oriented · Interpreted language · For text processing

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard75

History of programming languages

* Python (1991) · Paradigm: object-oriented · Interpreted language · For text processing

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard76

History of programming languages

* Ruby (1995) · Paradigm: object-oriented · Interpreted language · Dinamically-typed

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard77

History of programming languages

* Javascript (1995) · Paradigm: object-oriented · Interpreted language · For web programming

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard78

History of programming languages

* PHP (1997) · Paradigm: imperative · Interpreted language · For web programming · Dinamically-typed

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard79

References

Bergin,Jr., Thomas J., and Richard G. Gibson,Jr., eds. History of Programming Languages II. New York, NY, USA:

ACM, 1996. Print.

Fuegi, J., and J. Francis. “Lovelace & Babbage and the Creation of the 1843 ‘Notes.’” IEEE Annals of the History of

Computing 25.4 (2003): 16–26. IEEE Xplore. Web.

History of Programming Languages III. New York, NY, USA: ACM, 2007. Print.

Sammet, Jean E. “Programming Languages: History and Future.” Commun. ACM 15.7 (1972): 601–610. ACM Digital Library.

Print.

Wexelblat, Richard L., ed. History of Programming Languages I. New York, NY, USA: ACM, 1981. Print.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard80

Assignment

* Assigment 2: Programming the Abacus · Readings + Algorithm (Design And Analysis Of Algorithms) + How to Program an Abacus (http://baptiste.meles.free.fr/site/B.Meles-Abacus_presentation.pdf)

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard81

Assignment* Assigment 2: Programming the Abacus · Project Let us have a 9-wired abacus with 9 beads on each wire: + Identify the CPU, memory and I/O + Define the instruction set + Write an algorithm that calculates the sum of any two numbers

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard82

References

A.A.Puntambekar. “Algorithm.” Design And Analysis Of Algorithms. Technical Publications, 2010. Print.

Baptiste Mélès. “How to Program an Abacus.” N. p., n.d. Web. 5 Jan. 2014.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard83

Bibliography

A.A.Puntambekar. “Algorithm.” Design And Analysis Of Algorithms. Technical Publications, 2010. Print.

Andrew S. Tanenbaum. Modern Operating Systems. 2nd edition. Pearson, 2001. Print.

Baptiste Mélès. “How to Program an Abacus.” N. p., n.d. Web. 5 Jan. 2014.

Barata, Kimberly. Understanding Computers: An Overview for Records and Archives Staff. International Records

Management Trust/International Council on Archives, 1999. Print.

Bergin,Jr., Thomas J., and Richard G. Gibson,Jr., eds. History of Programming Languages II. New York, NY, USA:

ACM, 1996. Print.

“Computer History Museum.” N. p., n.d. Web. 30 Nov. 2013.

De la Rosa, Javier. “Computer Tools for Linguists.” Yutzu. N. p., n.d. Web. 16 Sept. 2013.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard84

Bibliography

Fuegi, J., and J. Francis. “Lovelace & Babbage and the Creation of the 1843 ‘Notes.’” IEEE Annals of the History of

Computing 25.4 (2003): 16–26. IEEE Xplore. Web.

Georges Ifrah. The Universal History of Computing: From the Abacus to the Quantum Computer. Wiley, 2001. Print.

History of Programming Languages III. New York, NY, USA: ACM, 2007. Print.

John Hennessy, and David Patterson. “Chapter 1: Fundamentals of Quantitative Design and Analysis.” Computer

Architecture: A Quantitative Approach. 5th Edition. Morgan Kaufmann, 2011. Print.

Sammet, Jean E. “Programming Languages: History and Future.” Commun. ACM 15.7 (1972): 601–610. ACM Digital Library.

Print.

Wexelblat, Richard L., ed. History of Programming Languages I. New York, NY, USA: ACM, 1981. Print.

Knowledge Representation in Digital HumanitiesAntonio Jiménez Mavillard85