1 / 72

Introduction To Programming

Introduction To Programming. About me. Prof. Lyon, vc (203)641-6293 cell. Fax (203)877-4187 lyon@docjava.com Office Hours; appt only (for now). About the Book. Java for Programmers: by D. Lyon, Pren. Hall. Grading: 1/3, homework 1/3 midterm 1/3 final. Homework. weekly or bi-weekly

Download Presentation

Introduction To Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction To Programming

  2. About me • Prof. Lyon, • vc (203)641-6293 cell. • Fax (203)877-4187 • lyon@docjava.com • Office Hours; appt only (for now).

  3. About the Book • Java for Programmers: • by D. Lyon, Pren. Hall. • Grading: • 1/3, homework • 1/3 midterm • 1/3 final

  4. Homework • weekly or bi-weekly • Due on time • You loose 10 points per day late! • Midterms are due in class with a demo. • Final is due in class with a demo. • Tests are take home.

  5. Course Info • Web page: • http://www.docjava.com • Distributed Computing • multiple computers working on a single task. • Network gaming • client-server • browser – web-server

  6. Examples of Distributed Computing • Services provided by a server • ftp server • print server • file server • mail server • echo server • ssh server • telnet server

  7. Services • Where are services listed? • /etc/services • gives you a list of “ports” • Distributed Computing is Network Computing • You study Network Programming to do Network Computing

  8. Cluster Computing • Group(s) of computers that are geographically co-located. Typically central administration using a master-work paradigm.

  9. Cluster Problems • hard to load balance • need benchmark • need a mechanism to register a volunteer • Configuration problem – need a compute server on every machine. • need to detect when idle.

  10. Cluster Problems • Need a way to partition a problem. • I need a way to transfer jobs from one machine to another. • How do you run a program on demand? • Java Web Start!

  11. Examples of Cluster Computing • File System • SETI • etc…

  12. What is Java? • A programming language • A technology that supports the language

  13. What is a Programming Language? • A language that can run on a computer. • An invention that helps facilitate communication. • Generally, it helps people communicate with a computer.

  14. What is a Computer? • A machine that processes data. • E.g. Brain= bio-computer

  15. What is a machine? • A device that transforms energy. • Computers use energy to perform information processing. • E.g., Wheel, human, brain=biological computer!

  16. Can Machines Think? • Humans think that they can think. • Human brain is a kind of machine. • Therefore machines can think.

  17. Example Application of A programming Language • recipe • ingredients – data structures (<-input) • procedure to follow - algorithms • results - output

  18. So Java Can • Take input • Fill Data structures • Run algorithms • Generate Output

  19. What is HTML? • Hypertext Markup Language • Used by a Browser • Presentation of content

  20. What is a browser? • a program that decodes HTML and presents it to the user. • For example: • Explorer • Netscape • Lynx

  21. What is the Internet? • a collection of local area networks. • It is often viewed using a browser.

  22. What is a Computer network? • A means of communicating between computers. Computer1 Computer2

  23. Internet=Internetwork • Collection of Networks • Message forwarding on a data packet net Node Computer1 Computer2

  24. What is the Web? • GUI on the Internet • Can use HTML for presentation of content • Browsers decode presentation data for display

  25. What is the HTML Model? • Browsers present data embedded in HTML • HTML • Images • GIF, JPEG, PNG, .... • Audio • AIFF, AU,... • PLUGINS

  26. What’s a Plugin • A program that helps a browser process data. • Shockwave • RealPlayer • Quicktime

  27. Java Model • Add to the number of formats we can decode. • Run the Java program automatically when we visit a web page using a browser with Java.

  28. Would you run a program on Demand? • A big security risk? • Feature Limits help us to be secure. • trusted programs can do anything • untrusted programs have big limits. • no file access • no access across the net to other machine. • Other restrictions too.

  29. What is a Compiler? • Is a program that inputs a programming language and outputs another programming language! • Output language is lower level than input language.

  30. What is Javac? • The java compiler • Inputs java source code • outputs BYTE CODES

  31. How do I run BYTE CODES? • java is the command that invokes the JVM. • java inputs BYTE CODES and RUNs them!

  32. Java Environment/ Life Cycle of Java Code Java Interpreter Just in Time Compiler Runtime Environment Compile-time Environment Class Loader Bytecode Verifier Java Class Libraries Java Source (.java) Java Bytecodes move locally or through network Java Virtual machine Java Compiler Runtime System Java Bytecode (.class ) Operating System Hardware

  33. Lifecycle of Java Code

  34. Whats a Byte? • a collection of 8 bits

  35. Primitive Data Types • What is a Data type? • It is a structured record that hold bits in a format that is defined by either the programmer or the language designer. • Eg. The bit is a data type.

  36. What is a bit? • Binary Digit = bit • It is symbolized by the numbers 0 or 1. • When you use a bit to count, you use a two-state numbering system. • Binary is a BI (two) state numbering (nary) system

  37. What is Binary? • Two numbered system • Generally S={0,1} • 00, 01, 10, 11 (binary) • 0, 1, 2, 3 (decimal)

  38. What is Hexidecimal? • 16 symbols in a numbering system. • Generally S={0,1,2,3,4,5,6,7,8,9,A, B,C,D,E,F} • (DEAD) base 16 (hexidecimal) • (CAB) • (7F) • (FF)

  39. What is Octal? • A Base 8 numbering system • 8 symbols • generally S={0,1,2,3,4,5,6,7} • (177) (10) • (7) + (1) = (10) base 8 • (10)+(7)=(17) base 8 • (17)+(1)=(20) base 8

  40. What is a base? • The number of symbols in a numbering system. • Radix of a numbering system is the base

  41. Why do they call it the base? • In decimal we write: 42. • 42 = 4 * 10**1 + 2*10**0 • In binary we write: 1101 • 1101 = 1 * 2 ** 3 + 1 * 2**2+0*2**1+1*2**0=8 + 4 +1=13 base 10

  42. What is a primitive data type? • Is a built in (to the language) data type. • That means that the language comes with the primitive data type.

  43. Why do I need a primitive data type? • Holds some value represented by bits in computer memory. • It helps with computations by storing data.

  44. What is an example of a PDT? • boolean – true, false. • boolean b = true; • boolean t = false; • boolean theChairsAreHard = true; • boolean theExampleIsGettingSilly = true; • The = sign means assignment. • Variables are on the left hand side of the = sign.

  45. There are 8 primitive data types. • boolean • char • SignedFixedPoint (byte, short, int, long) • SignedFloatingPoint (float, double)

  46. Two types of primitive data types • Signed • Unsigned

  47. Two types of unsigned data types • boolean • char • example: • char c = ‘t’; • char qwerty = ‘q’; • char thisIsGettingSilly = ‘w’;

  48. What is a Java statement? • Some Java code followed by a ‘;’ • char fooBar = ‘e’;

  49. How many fixed point PDTs are there? • 4, byte, short, int, long • byte uses 8 bits to store values. • short uses 16 bits • int uses 32 • long uses 64

  50. What are some examples? • byte b = 127; • byte b = 128; // does not work! • bytes range from –128...127 • The most significant bit is the sign bit. • byte thisIsGettingSilly = -128;

More Related