Presentation is loading. Please wait.

Presentation is loading. Please wait.

Principles of Programming I (CIE 105)

Similar presentations


Presentation on theme: "Principles of Programming I (CIE 105)"— Presentation transcript:

1 Principles of Programming I (CIE 105)
Lecture 1

2 Coursework Attendance 10% Class Quizzes 10% WAC 5%
Lab Practice Exercises & Homework 15% Mid Term Exam % Final Exam % Total %

3 Purpose of a machine A central theme in computing is the design of a process for carrying out a task. Q: Could you suggest any tasks that could be carry by computers?

4 What is an algorithm? An algorithm is a finite sequence of steps for performing a task, such that: each step is a clear and unambiguous instruction that can be executed in a finite time; the sequence in which the steps are to be executed is clearly defined; the process is guaranteed to stop after a finite number of steps have been executed.

5 Try to create an algorithm for making a peanut butter and jelly sandwich?
1. Get out two slices of bread (and put the rest back). 2. Get out the peanut butter, the jelly, and a butter knife. 3. Spread the peanut butter on one slice of bread and the jelly on the other one. 4. Put the peanut butter and jelly away, and take care of the knife. 5. Put the slices together, put the sandwich on a plate, and bring it to me. Thanks!

6 Same, but for small kid and computer.
1. a) Locate bread. b) Pick up bread. c) Move to empty counter. d) Set down bread on counter. e) Open bag of bread. ... For computer. • Initialize item-to-location database. • If bread is in bread box: – Open bread box. – Pick up bread. – Remove hands from bread box. – Close bread box. …

7 What Is Programming? Programming is telling your computer how to do something. Large tasks must be broken up into smaller tasks, which must be broken up into still smaller tasks, down until you get to the most basic tasks that you don’t have to describe, the tasks your computer already knows how to do. (These are really basic things such as arithmetic or displaying some text on your screen.)

8 The Art of Programming An important part of programming is, of course, making a program that does what it’s supposed to do. Programs aren’t just built in one go, like a bridge. They are talked about, sketched out, prototyped, played with, refactored, tuned, tested, tweaked, deleted, rewritten.... A programmer not built; it is grown.

9 Programming Languages
There are many languages to choose from (C, Java, Ruby, Perl...), and some have a larger set of those basic elements than others. Ruby has a fine set and is one of the easiest to learn (as well as being elegant and forgiving and the name of my daughter, and so forth), so we’ll use that one.

10 Java Source code public class HelloWorld {
public static void main(String []args) { System.out.println("Hello World"); } Result Hello World

11 Ruby Source code puts ' Hello World‘ Result Hello World

12 Ruby Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features.

13 Getting Started We’ll be using three main tools when we program:
1. Text editor (to write your programs) 2. The Ruby interpreter (to run your programs), 3. And your command line (which is how you tell your computer which programs you want to run). (cmd)

14 Windows http://rubyinstaller.rubyforge.org/wiki/wiki.pl
Good text editor Bad Good!

15 Mac OS X , Linux Mac OS X Linux

16 First task. 1. Download installer 2. Install it
3. try to create and run you first program like this puts “Hello world”


Download ppt "Principles of Programming I (CIE 105)"

Similar presentations


Ads by Google