Session 1 - Introduction.pdf
Document Details

Uploaded by WelcomeBowenite6570
Tags
Related
- Introduction to Computing Science Lecture Notes PDF
- Introduction to Computing Using Python (2nd Edition) - Wiley 2015 PDF
- Computer Science Illuminated, 7th Edition PDF
- Programming for Computing Engineers PLA1001 PDF
- Computer Science Class 9th Textbook - PDF
- Tutorial Questions on Computer Science, Software, and Data | PDF
Full Transcript
A modern computer can be defined as machine that stores and manipulates information under the control of a changeable program. There are two key elements for this: Computers are devices for manipulating information. Computers operate under the control of a changeable program THE UNIVERSAL MACHINE A...
A modern computer can be defined as machine that stores and manipulates information under the control of a changeable program. There are two key elements for this: Computers are devices for manipulating information. Computers operate under the control of a changeable program THE UNIVERSAL MACHINE A computer program is a detailed, step-by-step set of instructions telling a computer what to do, then changing the program means that the computer will perform different tasks. Programs form what we know as Software, while the machine and its components are the Hardware. Then software is executed, or carried out, in the hardware The process of creating this software is called programming or, sometimes, coding. 9 Understanding programming helps you understand the strengths and limitations of computers, an ability which is becoming more and more important these days. WHY LEARN TO PROGRAM? In this same line, it helps you become a more intelligent user of computers Helps the development of Problem Solving Skills, especially in analyzing complex systems by reducing them to interactions between simpler systems. We are in the middle of the AI-hype era, and you may think that AI will replace programmers, but that is very unlikely to occur. It will probably become another tool in their toolbox that may help them deliver better software. In any case, to produce relevant output from IA and to understand it, you need to already know the topic, then 10 HARDWARE BASICS The central processing unit out all the basic operations on the data The memory stores programs and data. The CPU can only directly access information stored in main memory (RAM or Random Access Memory). The main memory is fast, but volatile, i.e. when the power is interrupted, the contents of memory are lost. Secondary memory provides more permanent storage: magnetic (hard drive), flash (SSD, USB memory), optical (CD, DVD), or solid state hard drives (SSD) 11 HARDWARE BASICS The information is passed to the computer through the Input devices, as keyboards, mice, Once processed the information is presented to the user through the output devices, as the monitor, the printer Altogether they are usually known as periphericals. Fetch-Execute Cycle: First instruction retrieved from memory; Decode the instruction to see what it represents Appropriate action carried out; Next instruction fetched, decoded, and executed; Lather, rinse, repeat! 12 Natural language has ambiguity and imprecision problems when used to describe complex algorithms. PROGRAMMING LANGUAGES Programs expressed in an unambiguous, precise way using programming languages. Every structure in programming language has a precise form, called its syntax. Every structure in programming language has a precise meaning, called its semantics. A programming language is like a code for writing the instructions the computer will follow, hence the name 13 The main difference we can do with programming languages is if they are designed to be understood by a computer or by a human, then we name them as PROGRAMMING LANGUAGES Low-level language is the language that a computer may understand. In the end, computer hardware can only understand a very low level language known as machine language, which in the end is just a sequence of bits (0s and 1s) High-level computer languages are designed to be used and understood by humans, it has instructions that may be translated into machine language. This process is made either with a compiler or an interpreter 14 In machine language this reads 01100110 00001010 PROGRAMMING LANGUAGES: EXAMPLE, ADDING TWO NUMBERS In Assembly this could be (next in order of low-level) section.data a db 10 b db 6 section.text global _start _start: mov al, [a] add al, [b] In a high-level language, as Python, this is a = 10 b = 6 a + b 15 PROGRAMMING LANGUAGES: COMPILERS Compilers convert programs written in a high-level language into the machine language of some computer. Examples of compiled languages are C, C++, 16 PROGRAMMING LANGUAGES: INTERPRETER Interpreters simulate a computer that understands a high-level language. The source program is not translated into machine language all at once. An interpreter analyses and executes the source code instruction by instruction. Python is an example of interpreted language Well, actually, Python IS compiled but not to machine language, just to something middle way known as bytecode which is then run by the interpreter. 17 Once program is compiled, it can be executed over and over without the source code or compiler. If it is interpreted, the source code and interpreter are needed each time the program runs PROGRAMMING LANGUAGES: COMPILED VS. INTERPRETED Compiled programs generally run faster since the translation of the source code happens only once Interpreted languages are part of a more flexible programming environment since they can be developed and run interactively Interpreted programs are more portable, meaning the executable code produced from a compiler for a Pentium run on a Mac, without recompiling. If a suitable interpreter already exists, the interpreted code can be run with no modifications. 18 Software quality: its design focused is on readability, coherence and software quality in general sets. Being readable implies reusability and ease of maintenance Developer productivity: the length of the codes is usually way smaller than the same on the big languages as C++ or Java Program portability: most programs will run without any change on any platform: Windows, MacOS, Linux, WHY PYTHON? Support libraries: There is a large collection of libraries that support many different tasks Component integration: It is easy to communicate Python scripts with other parts of a larger program. For example, we can invoke C or C++ code from Python and C or C++ can call Python code. The same is true for Java,.NET, A major downside, however, is that its execution speed is usually lower than that of fully compiled lower-level languages as C or C++ 19 WHAT CAN WE DO WITH PYTHON? The common tasks where we find Python today are too many to be mentioned here, but : Systems programming (administration tools), GUI programming, Internet Scripting, Component integration, Database Programming, Prototyping, Numeric and Scientific Programming, Machine Learning, Data Mining, Games Programming, Robots Programming, Natural Language Processing, Artificial Intelligence, Well known Python uses, partially or completely, are Google web search systems, YouTube, Dropbox, EVE Online, Industrial Light & Magic, Pixar and others use it in their productions, Civilization IV scripted events, Netflix and Yelp, JPMorgan Chase, NASA, Fermilab, So well, you can do a lot of things with it 20