1/16/2008ITK 1681 HardwareSoftware Theory 1800 AD Architecture 1945 AD What is Computer Science? Languages 1960 AD
1/16/2008ITK 1682 Alan Turing ( ) – The Enigma The man who invented the computer Image from Turing Machines Turing Award: the Nobel Prize in CS
1/16/2008ITK 1683 Said: “Turing Machines are human that compute.” “ In logic nothing is accidental ” Ludwig Wittgenstein ( ) Image from
1/16/2008ITK 1684 Hardware = Software
1/16/2008ITK 1685 Hardware Input deviceOutput device Central Processor Unit: Internal Storage Control Unit + Arithmetic-Logic Unit (ALU)
1/16/2008ITK 1686 Logical Gates for an Adder (half adder) A +)B c S ABcS AND OR AND NOT B A S c Half-Adder
1/16/2008ITK bits Adder Full Adder Full Adder Full Adder Full Adder A B )
1/16/2008ITK 1688 Software: 1.Operation systems 2.Applications XP, Unix, VAX Words Excel E.I. Hello Java Hello.java javac Hello.class (class loader) Eclipse, NetBean IDE, SunSun
1/16/2008ITK 1689 IDE ( Integrated Development Environment ) 1.A customized plain text editor 2.Compiler 3.Loader 4.Debugging tool Java 2 Software Development Kit (J2SDK) Eclipse 1.notepad 2.javac hello 3.java hello
1/16/2008ITK Solving a problems by computers = ? = sum1; sum1+2=sum2 sum2+3=sum3 sum3+4=sum4 sum4+5=sum5 sum5+6=sum sum = sum =1 1+2=3 3+3=6 6+4= = = =5050
1/16/2008ITK Solving a problems by computers = sum1 sum1+2=sum2 sum2+3=sum3 sum3+4=sum4 sum4+5=sum5 sum5+6=sum sum = sum100 sum = 0 sum = sum+1 sum = sum+2 sum = sum+3 sum = sum +4 sum = sum sum = sum+100 computer can do the same thing again and again fast
1/16/2008ITK Algorithm: a procedure of calculating (manipulate) data = ? sum = 0 sum = sum+1 sum = sum+2 sum = sum+3 sum = sum +4 sum = sum sum = sum+100 sum = 0; i = 1; while (i <= 100) do the following { sum = sum + i; i = i+1; } sum is the answer;
1/16/2008ITK Problems Solutions cycle Problems System analyst, Project leader Algorithms Senior Programmers Programs in JAVA (or any high level Programming Language) compiler Assembly Assembler Machine code linker Results Customers Programmers Syntax Semantics (human) IDE (computers)
1/16/2008ITK How much effort in using an IDE IDE Helps? 2 week from now
1/16/2008ITK How much effort in solving a problem This is more important and difficult; data structures, algorithm analysis This is a basic requirement. We need to reduce this portion 1 year from now
1/16/2008ITK Procedure vs Object To solve a program is: To find a way to manipulate data -- We design procedures Procedure-Oriented Programming Statements + functions programs To find objects to model the problem – We choose data (object) Object-Oriented Programming Classes + Objects programs (interfaces, methods, attributes…)
1/16/2008ITK What is “model”? X models an ideal style of Y X objectsY problem
1/16/2008ITK Class A class is a concept of something Vehicle 4 wheels, seat, engine, windows…… Truck ………… Sedan ………… SUV …………
1/16/2008ITK Objects: an instance of some class Vehicle SUV Honda Pilot 011-JAV instantiation Class Object
1/16/2008ITK Method & Attribute Each class: Method & Attribute The class designer should determine what kind of methods and attribute its object should have Method: behaviors, service, operation, and functionalities of the object. Field (attribute): the information, status, and properties of the object.
1/16/2008ITK JAV Honda Pilot Plate: 011-JAV Color: Blue Engine size: 3.0 L... Start the engine() Stop() Turn (direction) Air()... Services, methods Attributes UML (Unified Modeling Language) class diagram Class name Z.Turn(right) Z
1/16/2008ITK Robot int street int avenue Direction direction ThingBag backback... Robot(City aCity, int aStreet, int aAvenue, Direction aDir) void move() void turnLeft() void pickThing() void putThing()... Services, methods Attributes UML class diagram for Robot Class name Constructor
1/16/2008ITK Modeling what? Modeling Robots with Software Objects - the title o 1.3 But this phrase does not make too much sense to me... Should be: Modeling Robots in a City with Software Classes. Robot int street int avenue Direction direction ThingBag backbag... Robot(City aCity, int aStreet, int aAvenue, Direction aDir) void move() void turnLeft() void pickThing() void putThing()... City String name int stree_No City( )....
1/16/2008ITK Task: deliver X from (1,2) to (3,1) and step away X import becker.robot.*; public class DeliverX{ public static void main(String args[]){ // set up Initial situation City A = new City(); Thing X = new Thing(A,1,2); Robot karel = new Robot(A,0,0, Direction.East); // direct the robot karel.move(); karel.turnLeft(); karel.move(); karel.pickThing(); karek.move(); karel.move(); karel.turnLeft(); karel.move(); karel.putThing(); karel.move(); } named Karel