270 likes | 332 Views
Java Chapter 1 – Java Introduction. Basic computer concepts Different types of and programming languages Java SDK development environment Distributed and network computing Introduce OOP We will not cover UML in this class. What is a computer. A PC, mainframe, PDA
E N D
Java Chapter 1 – Java Introduction • Basic computer concepts • Different types of and programming languages • Java SDK development environment • Distributed and network computing • Introduce OOP • We will not cover UML in this class
What is a computer • A PC, mainframe, PDA • A device that performs calculations • It must have Input, processing and output • PC computer organization • Input, Output, Memory, ALU, CPU, Secondary storage
Parts of a computer • The microprocessor is a silicon chip designed to manipulate data. • Its speed is determined by: • Clock speed • Word size • Cache size
Computer memory • Computer memory is a set of storage locations on the motherboard. There are four types of memory: • Random access memory (RAM) • Virtual memory • Read-only memory • Complementary metal oxide semiconductor memory (CMOS)
Types of computers Personalcomputers are used for general computing tasks. Hand-heldcomputers fit in the palm of your hand and run on batteries. Mainframes are used by companies to provide centralized storage, processing, and management for large amounts of data. Supercomputers are the largest and fastest of computers, and can process an enormous volume of data.
What is a computer • Parts
How does a computer work? • Computer understand electronic pulses, High or low voltage, 1’s or 0’s. • We abstract these pulses as 1 and 0 and use binary to encode them. • Early computers did not have fancy I/O devices and did a lot of work in batch or off-line applications.
How computers store data • Bytes can represent numbers in Binary • 00010000 = 16 • Or characters in ASCII • 01000001 = A • Storage and memory capacity is the amount of data the storage device can handle. • Kilobyte (KB) is about one thousand bytes • Megabyte (MB) is about one million bytes • Gigabyte (GB) is about one billion bytes
Programming computers • Hard wired computers of the past… • At the machine level • Machine language binary codes to control the computer. • Simplified in Hexadecimal to store a byte of data. • ASCII encoding to represent characters • What a task…… • Programs on punch cards and tapes • Magnetic tapes • Disk…
Role of the operating system • Early computers had very basic operating systems • They allowed for simple job scheduling. • Newer OS allow for multitasking, multiprocessing, virtual memory even GIU development • The OS provides programming layers to allow programs to run without direct interface with the hardware
Software • The programs that run on the computer including the operating system. • Used to provide instructions. • First generation: machine language • Second generation: Assembler • Third generation: C/C++, Java, Cobol,… • Fourth generation: report generators, visual builders, code generators, query languages
What about C/C++ • C++ evolved from C • C evolved from B used to create unix • Developed in 1967 • Java is derived from C/C++ syntax with differences
What about Java • It is a fully OOP language. • With the exception of primitive data types • In C/C++ you can always go back to basic C • Java is a side-effect of a failed project by Sun to create a set top box called a star-7. • The Java then called oak was the language used to program the content for the box. • The box was kind of a canned internet package. • The internet browser killed its value, but java lived on. • Formally announced at Java on in 1995 (I was there)
Why Java • A special niche in the internet for delivering application like web content called applets. • Animations and interactive user input where its big values. • Plus a programming model that was more sophisticated then HTML and JavaScript. • PS JavaScript and java are not related. • Netscape licensed the name for it scripting language from Sun (formerly known as livescript) • Both have similar syntax but do not be confused they are different.
Why Java • Web Niche • Portability • Write once run(test) everywhere • Familiar syntax (like C/C++) • OOP • A rich API with built in GUI and networking C does not have built in. • Lots of marketing and hype
What about other languages • There are more then we could count • Ansi C,Fortran, Pascal, Ada, Cobol, Abap • Basic Visual Basic, Visual C++, C# and .Net • Some are language and some are just IDE’s with libraries • Some are interpreted and some are compiled. • Some are procedural and some are object oriented
Structured programming • Algorithms and syntax • The Systems Development Life Cycle (SDLC) • 1. Planning • 2. Analysis • 3. Design • 4. Implement • 5. Maintain
What is OO • First what is procedural programming • Object oriented is a Programming language type. • Programming constructs are created in terms of classes • A class is a definition for a group of objects. • Like a blueprint or cookie cutter • Classes define an object behavior (method) and attributes (variables) • We will discuss this a lot more later
Distributed computing • The internet • Web pages, HTML • Client Server computing • Client makes a request of the server over a network. • Client has user interface • Server has data • Client and/or server can have application logic • Examples: • Database server • File Servers • Web servers
The Java environment • Visual Builder tools: • J++, Symantec, Jbuilder, Moca, Others. • The command line IDE tool from Sun • It has all of the power but no visual IDE
Using Java SDK • Is interpreted and compiled. • Lets install the SDK 2.2 • From the CD • The SDK is a DOS command line tool • You will need to open a command window to use it. • Lets use notepad to write our Java application • Notepad Jtest.java • Lets compile it (creates Jtest.class) • Javac Jtest.java • Lets run it (this in the interpreter) • Java Jtest • Not that hard. Hu?
DOS primer • Change current drive • a: • C: • Change directory • Cd \chapter1 • List files in a directory 8.3 names • Dir • Mkdir \chapter1 • To set the path to find the java programs you will need to execute this following command each time you open a Dos prompt window • path C:\J2SDK1.5.0_06\BIN;%path% • Type in javac to confirm the path is correct
Hello program public class hello { public static void main( String args[] ) { System.out.println("Hello\n"); } } We will talk about this code. You will not understand it all now but more so later.
Steps to create your program • 1. Edit • 2. Compile (javac hello.java) • 3. Load, verify, execute (java hello)
Homework #1 • Download and install the J2SDK from www.javasoft.com • Complete any 2 of the programming exercises on page 35 numbered 6-10 • Be sure that the programs follow the required naming conventions and include comments.