COMP 480 D R . E SMAIL B ONAKDARIAN F RANKLIN U NIVERSITY W INTER - - PDF document

comp 480
SMART_READER_LITE
LIVE PREVIEW

COMP 480 D R . E SMAIL B ONAKDARIAN F RANKLIN U NIVERSITY W INTER - - PDF document

27-Jan-10 P ROBLEM S OLVING WITH C OMPUTING COMP 480 D R . E SMAIL B ONAKDARIAN F RANKLIN U NIVERSITY W INTER 2010 27-Jan-10 COMP 480 - Winter 2010 1 Todays Menu Overview Class Policies Introductions Basic Terminology


slide-1
SLIDE 1

27-Jan-10 1

PROBLEM SOLVING WITH COMPUTING COMP 480

  • DR. ESMAIL BONAKDARIAN

FRANKLIN UNIVERSITY WINTER 2010

27-Jan-10 COMP 480 - Winter 2010 1

Today’s “Menu”

Overview Class Policies Introductions Basic Terminology A ‘bit’ of binary A bit of Python Exploration paper + Reflection Paper

27-Jan-10 COMP 480 - Winter 2010 2

slide-2
SLIDE 2

27-Jan-10 2

Announcements

Famous Programmer/CS – bonus points! Practice Practice Practice! (note: no books, notes, calculators etc during exams) Review Checkpoints in text (solutions on CD) Don’t forget about Proctors

27-Jan-10 COMP 480 – Winter 2010 3

Overview

What this class is:

Introduction to Programming for “newbies” Focused on concepts, not language specifics

27-Jan-10 COMP 480 - Winter 2010 4

slide-3
SLIDE 3

27-Jan-10 3

Overview

What this class is:

Introduction to Programming for “newbies” Focused on concepts, not language specifics

What this class is not:

“kinder & gentler” != no/little work “easy A” Don’t fall behind! Road vs. High-rise building … Advanced Programming or Python

27-Jan-10 COMP 480 - Winter 2010 5

Overview (2)

Who you are:

Curious about programming No (or very little) experience with programming Willing to put in the effort to work hard Considering COMP 111 or ITEC 136

Who am I?

Enthusiastic about this class (proposed + designed it) Lots of experience teaching “newbies” High expectations of students Enjoy teaching (esp newbies) + programming

27-Jan-10 COMP 480 - Winter 2010 6

slide-4
SLIDE 4

27-Jan-10 4

Overview (2)

Who you are:

Curious about programming No (or very little) experience with programming Willing to work hard Considering COMP 111 or ITEC 136

Who am I?

Enthusiastic about this class (proposed + designed it) Lots of experience teaching “newbies” High expectations of students Enjoy teaching (esp newbies) + programming

27-Jan-10 COMP 480 - Winter 2010 7

Why Python?

Minimal syntactic overhead Easy to learn, lots of on-line resources/tutorials Clean, intuitive and friendly syntax Free and multi-platform (incl. IDE) Many additional libraries freely available (e.g, PIL) Proven to appeal to new programmers Fun (can be used interactively too) Not a toy: Used by Google, NASA, YouTube, …

COMP 480 - Winter 2010 8 27-Jan-10

slide-5
SLIDE 5

27-Jan-10 5

Hello World

// Hello World in Java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World."); } }

COMP 480 - Winter 2010 9 27-Jan-10

Hello World

// Hello World in C++ #include <iostream> using namespace std; int main(void) { cout << "Hello World\n"; return 0; }

COMP 480 - Winter 2010 10 27-Jan-10

slide-6
SLIDE 6

27-Jan-10 6

Hello World

// Hello World in Python 2.6 print 'Hello World'

COMP 480 - Winter 2010 11 27-Jan-10

Misc Items

Distinguish between our ‘class’ web page (dynamic) vs. FU web page (somewhat static) Important to keep an eye on both – but especially the ‘class’ page e-mail works better! Esp if done right Read all materials written up for you. Expect e-mails Mon/Tue

27-Jan-10 COMP 480 - Winter 2010 12

slide-7
SLIDE 7

27-Jan-10 7

Introductions

Your name? (special preferences?) Where you are from? Why are you here? Job and/or major? Hobby and/or major surprise.

27-Jan-10 COMP 480 - Winter 2010 13

A bit of Binary (1)

Bit – binary digit Byte – 8 bits Meaning of bits open to interpretation Use of positional notation Base 10 (decimal), 2 (binary), 8 (octal) and 16 (hexadecimal) are common Powers of 2 used for binary

27-Jan-10 COMP 480 – Winter 2010 14

slide-8
SLIDE 8

27-Jan-10 8

Decimal

Powers of 10 used for decimal (a.k.a. base 10) Each ‘digit’ position is a power of 10 Valid digit values: 0 – 9 (note, 0 to base-1) Example:

132 = 1 x 100 + 3 x 10 + 2 x 1 = 1 x 102 + 3 x 101 + 2 x 100 So each value in a position is multiplied by a power of 10 .. Another view: 1 3 2

x x x

100 + 10 + 1 = 132

27-Jan-10 COMP 480 – Winter 2010 15

A bit of Binary (2)

Powers of 2 used for binary (base 2) Each ‘digit’ position is a power of 2 Valid digit values: 0 – 1 (note, 0 to base-1) Example: 11012 = 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1

= 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 So each value in a position is multiplied by a power of 10 .. Another view: 1 1 0 12

x x x x

8 + 4 + 2 + 1 = 1310

27-Jan-10 COMP 480 – Winter 2010 16

slide-9
SLIDE 9

27-Jan-10 9

Examples

0 1 1 0 12 = 1 1 02 =

27-Jan-10 COMP 480 – Winter 2010 17

More examples

All binary numbers: 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1

27-Jan-10 COMP 480 – Winter 2010 18

slide-10
SLIDE 10

27-Jan-10 10

Summary/Recap

Questions?

27-Jan-10 COMP 480 - Winter 2010 19