Programming Languages: Part 1. Robert M. Dondero, Ph.D. Princeton University

Size: px
Start display at page:

Download "Programming Languages: Part 1. Robert M. Dondero, Ph.D. Princeton University"

Transcription

1 Programming Languages: Part 1 Robert M. Dondero, Ph.D. Princeton University 1

2 Objectives You will learn/review: Subsets of C, Java, and Python... That are appropriate for COS Through example programs Example 1 in C, Java, Python Example 2 in C, Java, Python 2

3 Objectives Note: Comprehensive coverage is impossible! Please supplement with reading 3

4 Objectives Specifically: Overview Program structure Building and running Multiple functions/methods Using library code 4

5 C Overview Who: AT&T Bell Labs Dennis Ritchie When: 1972 Why: Build Unix 5

6 C Overview Characteristics: Low level Strongly typed Minimal standard library Two-word description: Fast: Close to the OS and hardware Eccentric: Unless you know the underlying assembly/machine lang 6

7 Why Study C? Why study C? The world's most popular/influential lang Illustrates some of the course's material Provides strong contrast with other langs I know it You know it from COS 217 We'll do a quick review 7

8 Java Overview Who: Sun Microsystems Team led by... James Gosling 8

9 Java Overview When: 1990 Why: Embedded systems ("Oak"), and then... "The language of the Web", and then... Robust portable server-side software 9

10 Java Overview Characteristics: Medium level Strongly typed Large standard library Two-word description: Rich: Large language and standard library Verbose: I/O is especially so 10

11 Why Study Java? Why study Java? Elegant and popular Illustrates most of the course's material I know it You know it from COS 126/226 But maybe not some of the advanced features We'll do a quick overview 11

12 Python Overview Who: Guido Van Rossum 12

13 Separated at Birth? 13

14 Python Overview When: ~1990 Why: "I was looking for a 'hobby' programming project that would keep me occupied during the week around Christmas. My office would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus)." Van Rossum 14

15 Python Overview Characteristics: High level Weakly typed No variable declaration statements "Scripting language" Rich standard library But inconsistent programming conventions 15

16 Python Overview Two-word description: Expressive: Can accomplish much work with little code Immature: Still evolving; ill-documented 16

17 Why Study Python? Why study Python? Reasonably elegant and getting more popular Esp. vs. Perl Illustrates most of the course's material Python/Django is popular I'm new to it; I want to learn it You also are new to it??? Thus the first part of the course won't be entirely review??? 17

18 Why Study that Combination? Among high level languages: Good for computers C Java Python Good for pgmmers The three languages cover the spectrum well 18

19 Our Approach Approach: sequence of example programs For each example: Examine/run code Note important features Generalize Incidentally... No function/method comments Bad style but saves paper 19

20 "Hello World" Programs Illustrate Program structure Building and running 20

21 "Hello World" in C See hello.c Overall structure Comments #include preprocessor directive Definition of main() function printf() function String literal (" ") 21

22 "Hello World" in C Generalizations: A C program consists of functions Exactly one must be named "main" 22

23 "Hello World" in C Building and executing: hello.c C preprocessor/compiler/ assembler/linker At run-time OS hello (executable binary code) Source code is portable (to some extent) Executable binary code is not portable 23

24 "Hello World" in C Long procedure: File: hello.c File: hello.i Preprocess $ gcc -Wall -ansi -pedantic -E hello.c > hello.i Compile $ gcc -Wall -ansi -pedantic -S hello.i 24

25 "Hello World" in C File: hello.s File: hello.o Assemble $ gcc -Wall -ansi -pedantic -c hello.s File: hello Link $ gcc -Wall -ansi -pedantic hello.o -o hello Run $ hello 25

26 "Hello World" in C Short procedure: File: hello.c File: hello Preprocess, compile, assemble, link $ gcc -Wall -ansi -pedantic hello.c -o hello Run $ hello 26

27 "Hello World" in Java See Hello.java Overall structure Comments Class definition Definition of main() method "static" => class level, not object level System.out.println() method String literal (" ") 27

28 "Hello World" in Java Generalizations: A program consists of classes Define one public class per file Can define other non-public classes in same file A class consists of methods (and fields) 28

29 "Hello World" in Java Building and executing: Hello.java Java compiler At run-time OS Java interpreter (JVM) Hello.class (bytecode) Source code is portable Bytecode is portable 29

30 "Hello World" in Java Procedure: File: Hello.java File: Hello.class Compile $ javac Hello.java Run $ java Hello 30

31 "Hello World" in Python See hello1.py Overall structure (minimal!) #!/usr/bin/env python Comments print statement String literal (' ') No semicolons!!! Commands OS to... Use the Python interpreter Search the PATH env var to find it 31

32 "Hello World" in Python Generalizations: Program consists of statements (and other things; stay tuned) String literal: ' ' or " " 32

33 "Hello World" in Python Building and executing: OS Python interpreter At run-time hello1.py hello1.pyc (bytecode) Python compiler Source code is portable Bytecode is portable 33

34 "Hello World" in Python Procedure 1 (works with/without #! line) $ python hello1.py Procedure 2 (works only with #! line) $ chmod 700 hello1.py $ hello.py Procedure 3 (works with/without #! line) $ python >>> import hello1 Procedure 3 is valuable for learning 34

35 "Hello World" in Python See hello2.py Function definitions and calls name == ' main ' True iff this module is the "main" module True iff this module is compiled/interpreted directly from the command-line False iff this module is loaded into interpreter by another module Indentation matters!!! 35

36 "Hello World" in Python Generalizations: Program consists of statements and functions Indentation indicates nesting Better to avoid global code Global code can hide errors in local code 36

37 "Hello World" in Python Procedure 1 (works with/without #! line) python hello2.py Procedure 2 (works only with #! line) chmod 700 hello2.py hello2.py 37

38 "Hello World" in Python Procedure 3 (works with/without #! line) $ python >>> import hello2 Makes all names defined in the hello2 module accessible within this (the main) module >>> hello2.main() Can use those names using "hello2." prefix 38

39 "Hello World" in Python Procedure 4 (works with/without #! line) $ python >>> from hello2 import main >>> main() Imports "main" from the hello2 module into this (the main) module Can use "main" as if it were defined in this module 39

40 "Square" Programs Illustrate: Multi-function/method programs Function parameters 40

41 "Square" in C See square1.c One source code file defines multiple functions Parameters are passed by value Compiler does one pass only Compiler must see function definition (or declaration) before function call 41

42 "Square" in C See square2.c Function declaration Compiler must see function definition or declaration before function call 42

43 "Square" in Java See Square.java One source code file (one class) defines multiple methods Parameters are passed by value Compiler does two passes Can define methods in any order 43

44 "Square" in Python See square1.py One source code file defines multiple functions Weakly typed Parameters are typeless Compiler/interpreter does one pass only Compiler/interpreter must see function def before function call 44

45 "Square" in Python However... Python does not compile/interpret code until necessary 45

46 "Square" in Python See square2.py OK to define sqr() after main() See square3bad.py Compiler/interpreter attempts to interpret call of sqr() before seeing def of sqr() Error

47 "Square" in Python See square4bad.py Compiler/interpreter does not attempt to interpret call of non-existing function No error detected! Dangerous!!!

48 "SquareRoot" Programs Illustrate: Using library code 48

49 "SquareRoot" in C See squareroot.c #include <math.h> Provides compiler with declaration of sqrt() Allows compiler to check calls of sqrt() 49

50 "SquareRoot" in C To build: $ gcc -Wall -ansi -pedantic squareroot.c -o squareroot -lm -lm commands linker to search libm.a for function defs Experiment: Required on many/most systems, but not on ours Remove #include directive What happens? 50

51 "SquareRoot" in Java See SquareRoot1.java Uses full class name in code Fine, but sometimes awkward See SquareRoot2.java import java.lang.math; Commands compiler to resolve "Math" to "java.lang.math" Actually, not necessary: "java.lang.*" is imported by default 51

52 "SquareRoot" in Python See squareroot1.py import math Makes all names defined in the math module accessible within this (the main) module Can use those names using "math." prefix Bad: Sometimes awkward to use prefix Good: No conflicts with names in this module 52

53 "SquareRoot" in Python See squareroot2.py from math import sqrt Imports "sqrt" from the math module into this module Can use "sqrt" as if it were defined in this module Good: No need to specify prefixes Bad: Potential name conflicts New def overwrites old def 53

54 Summary We have covered: In Java, C, and Python... Program structure Building and running Multiple functions/methods Using library code 54

Programming Languages Part 1. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Programming Languages Part 1. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University Programming Languages Part 1 Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1 For Your Amusement Java is C++ without the guns, knives, and clubs. James Gosling Python is the most powerful

More information

Programming Language Basics

Programming Language Basics Programming Language Basics Lecture Outline & Notes Overview 1. History & Background 2. Basic Program structure a. How an operating system runs a program i. Machine code ii. OS- specific commands to setup

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 6: Introduction to C (pronobis@kth.se) Overview Overview Lecture 6: Introduction to C Roots of C Getting started with C Closer look at Hello World Programming Environment Schedule Last time (and

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (yaseminb@kth.se) Overview Overview Roots of C Getting started with C Closer look at Hello World Programming Environment Discussion Basic Datatypes and printf Schedule Introduction to C - main part of

More information

PROGRAMMAZIONE I A.A. 2017/2018

PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMING LANGUAGES A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages

More information

#include <stdio.h> int main() { printf ("hello class\n"); return 0; }

#include <stdio.h> int main() { printf (hello class\n); return 0; } C #include int main() printf ("hello class\n"); return 0; Working environment Linux, gcc We ll work with c9.io website, which works with ubuntu I recommend to install ubuntu too Also in tirgul

More information

Lecture 1. basic Python programs, defining functions

Lecture 1. basic Python programs, defining functions Lecture 1 basic Python programs, defining functions Lecture notes modified from CS Washington CS 142 Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0

More information

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva

Software Project. Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva Software Project Lecturers: Ran Caneti, Gideon Dror Teaching assistants: Nathan Manor, Ben Riva Emails: (canetti/benriva)@post.tau.ac.il nathan.manor@gmail.com gideon@mta.ac.il http://www.cs.tau.ac.il/~roded/courses/soft-project10.html

More information

Lecture 1: Overview of Java

Lecture 1: Overview of Java Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

More information

27-Sep CSCI 2132 Software Development Lecture 10: Formatted Input and Output. Faculty of Computer Science, Dalhousie University. Lecture 10 p.

27-Sep CSCI 2132 Software Development Lecture 10: Formatted Input and Output. Faculty of Computer Science, Dalhousie University. Lecture 10 p. Lecture 10 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 10: Formatted Input and Output 27-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor:

More information

CSE 421 Course Overview and Introduction to Java

CSE 421 Course Overview and Introduction to Java CSE 421 Course Overview and Introduction to Java Computer Science and Engineering College of Engineering The Ohio State University Lecture 1 Learning Objectives Knowledgeable in how sound software engineering

More information

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 1 BIL 104E Introduction to Scientific and Engineering Computing Lecture 1 Introduction As engineers and scientists why do we need computers? We use computers to solve a variety of problems ranging from evaluation

More information

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006 C Compilation Model Comp-206 : Introduction to Software Systems Lecture 9 Alexandre Denault Computer Science McGill University Fall 2006 Midterm Date: Thursday, October 19th, 2006 Time: from 16h00 to 17h30

More information

Spring 2018 NENG 202 Introduction to Computer Programming

Spring 2018 NENG 202 Introduction to Computer Programming Spring 2018 NENG 202 Introduction to Computer Programming Introductory programming course based on the C language Course Website: http://www.albany.edu/~yx152122/neng202-18.html Instructor: Prof. Y. Alex

More information

The C Programming Language

The C Programming Language The C Programming Language What is C? "High-level" programming language developed by Dennis Ritchie with Brian Kernighan Bell Labs, New Jersey, 1970s Developed in conjunction with Unix Intended to provide

More information

Senthil Kumaran S

Senthil Kumaran S Senthil Kumaran S http://www.stylesen.org/ Agenda History Basics Control Flow Functions Modules History What is Python? Python is a general purpose, object-oriented, high level, interpreted language Created

More information

Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9

Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9 http://xkcd.com/353/ Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9 Python Python is a general-purpose programming language, meaning you can write any kind

More information

EE 209: Programming Structures for Electrical Engineering

EE 209: Programming Structures for Electrical Engineering EE 209: Programming Structures for Electrical Engineering 1 Goals for Today s Class Course overview Introductions Course goals Resources Grading Policies Getting started with C C programming language overview

More information

C++ Spring Break Packet 11 The Java Programming Language

C++ Spring Break Packet 11 The Java Programming Language C++ Spring Break Packet 11 The Java Programming Language! Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation

More information

CISC 124: Introduction To Computing Science II

CISC 124: Introduction To Computing Science II CISC 124: Introduction To Computing Science II instructor: Margaret Lamb instructor's home page: www.cs.queensu.ca/home/malamb office: Goodwin 527 current office hours are always on my home page 1 Moodle

More information

CS 3813/718 Fall Python Programming. Professor Liang Huang.

CS 3813/718 Fall Python Programming. Professor Liang Huang. CS 3813/718 Fall 2012 Python Programming Professor Liang Huang huang@cs.qc.cuny.edu http://vision.cs.qc.cuny.edu/huang/python-2012f/ Logistics Lectures: TTh 9:25-10:40 am SB B-141 Personnel Instructor

More information

Python Workshop. January 18, Chaitanya Talnikar. Saket Choudhary

Python Workshop. January 18, Chaitanya Talnikar. Saket Choudhary Chaitanya Talnikar Saket Choudhary January 18, 2012 Python Named after this : Python Slide 1 was a joke! Python Slide 1 was a joke! Python : Conceived in late 1980s by Guido van Rossum as a successor to

More information

Programming in C. What is C?... What is C?

Programming in C. What is C?... What is C? C Programming in C UVic SEng 265 Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version

More information

Programming in C UVic SEng 265

Programming in C UVic SEng 265 Programming in C UVic SEng 265 Daniel M. German Department of Computer Science University of Victoria 1 SEng 265 dmgerman@uvic.ca C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier,

More information

Programming in C. What is C?... What is C?

Programming in C. What is C?... What is C? Programming in C UVic SEng 265 C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version

More information

Crash Dive into Python

Crash Dive into Python ECPE 170 University of the Pacific Crash Dive into Python 2 Lab Schedule Today Ac:vi:es Endianness Python Thursday Network programming Lab 8 Network Programming Lab 8 Assignments Due Due by Mar 30 th 5:00am

More information

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input CpSc Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input Overview For this lab, you will use: one or more of the conditional statements explained below scanf() or fscanf() to read

More information

The current topic: Python. Announcements. Python. Python

The current topic: Python. Announcements. Python. Python The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax

More information

Is it ever useful to be confident that a problem is hard?

Is it ever useful to be confident that a problem is hard? CS26: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 9: Low-Level Programming Menu Complexity Question Low-Level Programming Exam Out Wednesday,

More information

Compilation I. Hwansoo Han

Compilation I. Hwansoo Han Compilation I Hwansoo Han Language Groups Imperative von Neumann (Fortran, Pascal, Basic, C) Object-oriented (Smalltalk, Eiffel, C++) Scripting languages (Perl, Python, JavaScript, PHP) Declarative Functional

More information

Topic 6: A Quick Intro To C

Topic 6: A Quick Intro To C Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Outline Introduction What Is a Computer? Computer Hardware Computer Software Computer Programming Languages Machine Code, Assembly Languages and High-Level Languages. The History

More information

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

Python. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline

Python. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline Python Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar December 28, 2011 1 Outline Introduction Installation and Use Distinct Features Python Basics Functional Example Comparisons with

More information

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions Index Course Outline Grading Policy Lab Time Distribution Important Instructions 2 Course Outline Week Topics 1 - History and Evolution of Java - Overview of Java 2 - Datatypes - Variables 3 - Arrays 4

More information

CSCI 2132 Software Development. Lecture 8: Introduction to C

CSCI 2132 Software Development. Lecture 8: Introduction to C CSCI 2132 Software Development Lecture 8: Introduction to C Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 21-Sep-2018 (8) CSCI 2132 1 Previous Lecture Filename substitution

More information

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java Chapter 1 Introduction to Computers, Programs, and Java 1.1 What are hardware and software? 1. A computer is an electronic device that stores and processes data. A computer includes both hardware and software.

More information

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? Overview For this lab, you will use: one or more of the conditional statements explained below scanf()

More information

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what can be computed what processes a computer can execute

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 04: Introduction to C Readings: Chapter 1.5-1.7 What is C? C is a general-purpose, structured

More information

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java Goals Understand the basics of Java. Introduction to Java Write simple Java Programs. 1 2 Java - An Introduction Java is Compiled and Interpreted Java - The programming language from Sun Microsystems Programmer

More information

EE 209: Programming Structures for Electrical Engineering. (Many Slides Borrowed from Princeton COS 217)

EE 209: Programming Structures for Electrical Engineering. (Many Slides Borrowed from Princeton COS 217) EE 209: Programming Structures for Electrical Engineering (Many Slides Borrowed from Princeton COS 217) 1 Goals for Today s Class Course overview Introduction Course goals Resources Grading Policies Getting

More information

assembler Machine Code Object Files linker Executable File

assembler Machine Code Object Files linker Executable File CSCE A211 Programming Intro What is a Programming Language Assemblers, Compilers, Interpreters A compiler translates programs in high level languages into machine language that can be executed by the computer.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 22, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers ords Data Types And Variable Declarations

More information

by Pearson Education, Inc. All Rights Reserved.

by Pearson Education, Inc. All Rights Reserved. Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation steps. Computer languages may be divided into three

More information

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz tabbasum.naz@ciitlahore.edu.pk Course Outline Course Title Object Oriented Concepts and Course Code Credit Hours 4(3,1) Programming

More information

M2 Instruction Set Architecture

M2 Instruction Set Architecture M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. Translating and starting a program. High level languages, Assembly languages and object code. Subroutine

More information

Topic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History

Topic 6: A Quick Intro To C. Reading. goto Considered Harmful History Topic 6: A Quick Intro To C Reading Assumption: All of you know basic Java. Much of C syntax is the same. Also: Some of you have used C or C++. Goal for this topic: you can write & run a simple C program

More information

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of

Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

More information

What s next. Computer Systems A Programmer s Perspective

What s next. Computer Systems A Programmer s Perspective What s next Computer Systems A Programmer s Perspective 198 The role of the operating system Protect the computer from misuse Provide an abstraction for using the hardware so that programs can be written

More information

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective

ENCE Computer Organization and Architecture. Chapter 1. Software Perspective Computer Organization and Architecture Chapter 1 Software Perspective The Lifetime of a Simple Program A Simple Program # include int main() { printf( hello, world\n ); } The goal of this course

More information

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program.

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program. Language Translation Compilation vs. interpretation Compilation diagram Step 1: compile program compiler Compiled program Step 2: run input Compiled program output Language Translation compilation is translation

More information

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Introduction to C. Winter 2019 CSCI 2132: Software Development Introduction to C Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 The C Programming Language Originally invented for writing OS and other system

More information

2 Introduction to Java. Introduction to Programming 1 1

2 Introduction to Java. Introduction to Programming 1 1 2 Introduction to Java Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Describe the features of Java technology such as the Java virtual machine, garbage

More information

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved.

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved. 1 1 Introduction to OOP Using Java 2 Introduction Sun s implementation called the Java Development Kit (JDK) Object-Oriented Programming Java is language of choice for networked applications Java Enterprise

More information

COS 217: Introduction to Programming Systems!

COS 217: Introduction to Programming Systems! COS 217: Introduction to Programming Systems! 1 Goals for Today s Class! Course overview" Introductions" Course goals" Resources" Grading" Policies" Getting started with C" C programming language overview"

More information

Introduction to Python Part 1. Brian Gregor Research Computing Services Information Services & Technology

Introduction to Python Part 1. Brian Gregor Research Computing Services Information Services & Technology Introduction to Python Part 1 Brian Gregor Research Computing Services Information Services & Technology RCS Team and Expertise Our Team Scientific Programmers Systems Administrators Graphics/Visualization

More information

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. COMP1917 12s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/12s2 Please check this Web Site regularly for updated information,

More information

CS 113: Introduction to

CS 113: Introduction to CS 113: Introduction to Course information MWF 12:20-1:10pm 1/21-2/15, 306 Hollister Hall Add/drop deadline: 1/28 C Instructor: David Crandall See website for office hours and contact information Prerequisites

More information

CS11 Java. Fall Lecture 1

CS11 Java. Fall Lecture 1 CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering?

Lecture 1. Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Lecture 1 Introduction to course, Welcome to Engineering, What is Programming and Why is this the first thing being covered in Engineering? Welcome to ENGR 102 Syllabus review Your Time Expectations (in

More information

Lec 3. Compilers, Debugging, Hello World, and Variables

Lec 3. Compilers, Debugging, Hello World, and Variables Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 2: Hello World! Cristina Nita-Rotaru Lecture 2/ Fall 2013 1 Introducing C High-level programming language Developed between 1969 and 1973 by Dennis Ritchie at the Bell Labs

More information

C Introduction. Comparison w/ Java, Memory Model, and Pointers

C Introduction. Comparison w/ Java, Memory Model, and Pointers CS 261 Fall 2018 Mike Lam, Professor C Introduction Comparison w/ Java, Memory Model, and Pointers Please go to socrative.com on your phone or laptop, choose student login and join room LAMJMU The C Language

More information

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

CS133 C Programming. Instructor: Jialiang Lu   Office: Information Center 703 CS133 C Programming Instructor: Jialiang Lu Email: jialiang.lu@sjtu.edu.cn Office: Information Center 703 1 Course Information: Course Page: http://wirelesslab.sjtu.edu.cn/~jlu/teaching/cp2014/ Assignments

More information

Outline. Compiling process Linking libraries Common compiling op2ons Automa2ng the process

Outline. Compiling process Linking libraries Common compiling op2ons Automa2ng the process Compiling Programs Outline Compiling process Linking libraries Common compiling op2ons Automa2ng the process Program compilation Programmers usually writes code in high- level programming languages (e.g.

More information

1. Introduction. Course Web Site. COMP1917: Computing 1. Textbook. Occupational Health and Safety (OHS)

1. Introduction. Course Web Site. COMP1917: Computing 1. Textbook. Occupational Health and Safety (OHS) COMP1917 14s2 Introduction 1 COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. Course Web Site http://www.cse.unsw.edu.au/~cs1917/14s2 Please check this Web Site regularly for updated information,

More information

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995

History of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995 Java Introduc)on History of Java Java was originally developed by Sun Microsystems star:ng in 1991 James Gosling Patrick Naughton Chris Warth Ed Frank Mike Sheridan This language was ini:ally called Oak

More information

COS 217: Introduction to Programming Systems!

COS 217: Introduction to Programming Systems! COS 217: Introduction to Programming Systems! 1 Goals for Today s Class! Course overview" Introductions" Course goals" Resources" Grading" Policies" Getting started with C" C programming language overview"

More information

COS 217: Introduction to Programming Systems

COS 217: Introduction to Programming Systems COS 217: Introduction to Programming Systems 1 Goals for Todayʼs Class Course overview Introductions Course goals Resources Grading Policies Getting started with C C programming language overview 2 1 Introductions

More information

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher COP4020 ming Languages Compilers and Interpreters Robert van Engelen & Chris Lacher Overview Common compiler and interpreter configurations Virtual machines Integrated development environments Compiler

More information

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp) A software view User Interface Computer Systems MTSU CSCI 3240 Spring 2016 Dr. Hyrum D. Carroll Materials from CMU and Dr. Butler How it works hello.c #include int main() { printf( hello, world\n

More information

CSE 303: Concepts and Tools for Software Development

CSE 303: Concepts and Tools for Software Development CSE 303: Concepts and Tools for Software Development Dan Grossman Spring 2007 Lecture 19 Profiling (gprof); Linking and Libraries Dan Grossman CSE303 Spring 2007, Lecture 19 1 Where are we Already started

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 7: Introduction to C (pronobis@kth.se) Overview Overview Lecture 7: Introduction to C Wrap Up Basic Datatypes and printf Branching and Loops in C Constant values Wrap Up Lecture 7: Introduction

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Programming and Data Structure

Programming and Data Structure Programming and Data Structure Sujoy Ghose Sudeshna Sarkar Jayanta Mukhopadhyay Dept. of Computer Science & Engineering. Indian Institute of Technology Kharagpur Spring Semester 2012 Programming and Data

More information

Informática Ingeniería en Electrónica y Automática Industrial

Informática Ingeniería en Electrónica y Automática Industrial Informática Ingeniería en Electrónica y Automática Industrial Introduction to C programming language V1.1 Alvaro Perales Eceiza Introduction to C programming language Introduction Main features Functions

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization C/C++ Language Review Prof. Michel A. Kinsy Programming Languages There are many programming languages available: Pascal, C, C++, Java, Ada, Perl and Python All of these languages

More information

Welcome to... CS113: Introduction to C

Welcome to... CS113: Introduction to C Welcome to... CS113: Introduction to C Instructor: Erik Sherwood E-mail: wes28@cs.cornell.edu Course Website: http://www.cs.cornell.edu/courses/cs113/2005fa/ The website is linked to from the courses page

More information

Introduction. A. Bellaachia Page: 1

Introduction. A. Bellaachia Page: 1 Introduction 1. Objectives... 2 2. Why are there so many programming languages?... 2 3. What makes a language successful?... 2 4. Programming Domains... 3 5. Language and Computer Architecture... 4 6.

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions

More information

CS 61C: Great Ideas in Computer Architecture Introduction to C

CS 61C: Great Ideas in Computer Architecture Introduction to C CS 61C: Great Ideas in Computer Architecture Introduction to C Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Agenda C vs. Java vs. Python Quick Start Introduction

More information

Python Programming, bridging course 2011

Python Programming, bridging course 2011 Python Programming, bridging course 2011 About the course Few lectures Focus on programming practice Slides on the homepage No course book. Using online resources instead. Online Python resources http://www.python.org/

More information

1/14/2014. Introduction to CSE 1325 Object Oriented Programming (Using Java) Introduction (Cont.) Introduction

1/14/2014. Introduction to CSE 1325 Object Oriented Programming (Using Java) Introduction (Cont.) Introduction Introduction (Cont.) Introduction to CSE 1325 Object Oriented Programming (Using Java) Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University

More information

introduction week 1 Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 imperative programming about the course

introduction week 1 Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 imperative programming about the course week 1 introduction Ritsumeikan University College of Information Science and Engineering Ian Piumarta 1 / 20 class format 30 minutes (give or take a few) presentation 60 minutes (give or take a few) practice

More information

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016

CS 31: Intro to Systems Binary Arithmetic. Martin Gagné Swarthmore College January 24, 2016 CS 31: Intro to Systems Binary Arithmetic Martin Gagné Swarthmore College January 24, 2016 Unsigned Integers Suppose we had one byte Can represent 2 8 (256) values If unsigned (strictly non-negative):

More information

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor

CS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static

More information

COS 217: Introduction to Programming Systems. Goals for Todayʼs Class. Introductions

COS 217: Introduction to Programming Systems. Goals for Todayʼs Class. Introductions COS 217: Introduction to Programming Systems 1 Goals for Todayʼs Class Course overview Introductions Course goals Resources Grading Policies Getting started with C C programming language overview 2 Introductions

More information

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation 1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation Administrivia Lecturer: Kostis Sagonas (kostis@it.uu.se) Course home page: http://www.it.uu.se/edu/course/homepage/komp/h18

More information

ANSI C. Data Analysis in Geophysics Demián D. Gómez November 2013

ANSI C. Data Analysis in Geophysics Demián D. Gómez November 2013 ANSI C Data Analysis in Geophysics Demián D. Gómez November 2013 ANSI C Standards published by the American National Standards Institute (1983-1989). Initially developed by Dennis Ritchie between 1969

More information

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011 Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Spring 2011 Outline Using Secure Shell Clients GCC Some Examples Intro to C * * Windows File transfer client:

More information

Introduction. CS 2210 Compiler Design Wonsun Ahn

Introduction. CS 2210 Compiler Design Wonsun Ahn Introduction CS 2210 Compiler Design Wonsun Ahn What is a Compiler? Compiler: A program that translates source code written in one language to a target code written in another language Source code: Input

More information

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018 Fundamentals of Programming (Python) Basic Concepts Ali Taheri Sharif University of Technology Outline 1. What is a Computer? 2. Computer System Organization 3. What is a Computer Program? 4. Programming

More information

Language Design COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science

Language Design COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science Language Design COMS W4115 Katsushika Hokusai, In the Hollow of a Wave off the Coast at Kanagawa, 1827 Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science Language Design

More information