You are on page 1of 6

Focus of the course Object-oriented software development problem solving program design and implementation object-oriented concepts objects

classes interfaces inheritance polymorphism graphics and Graphical User Interfaces the Java programming language CPE-101 Programs are written to solve problems! The general steps in problem solving are: Understand the problem What is the problem? What is not part of the problem? Dissect the problem into manageable pieces. Design a solution Have you seen this problem before? Have you seen a similar one? Can you restate the problem? Can you solve it? Part of it? Consider alternatives to your first solution and refine it. Implement the solution

Check each step as you proceed. Test the final solution. If necessary, fix any problems that exist, and repeat the previous step. Reflect on what you learned from the problem What did you learn from the problem? the solution? What did you learn from any difficulties you encountered? CPE-101 More on Problem Solving Many software projects fail because the developer didn't really understand the problem to be solved. We must avoid assumptions and clarify ambiguities. As problems and their solutions become larger, we must organize our development into manageable pieces. This technique is fundamental to software development. We will dissect our solutions into pieces called classes, objects and methods, taking an object-oriented approach. CPE-101 Brief Java History 1990-95: James Gosling at Sun began to develop a new programming language for consumer electronics software. It was originally known as Oak It was small, reliable, and architecture independent. 1990-94: Tim Berners-Lee at CERN in Geneva began to develop the World Wide Web. It was powerful, global, and architecture independent. ~1993: The Java team wrote a browser called HotJava. It was the first web browser to support Java applets. It demonstrated the power of Java to the rest of the programming world.

CPE-101 But what is Java? A high-level programming language. Object-oriented. Architecture-neutral and portable. Sort of interpreted, sort of compiled.

CAUTION: 101-102-103 now focus on object-oriented (OO) design. C++ permits an OO approach, but... Java REQUIRES an OO approach!

CPE-101 Interpret or Compile? BASIC is interpreted: High-level source code is run by an interpreter on a specific microprocessor. Every time the program is run, it must be re-interpreted. C and C++ are compiled: High level source code is run through a compiler. Each compilation is specific to a given microprocessor. To run the program, you run the appropriate compiled code. Java is a hybrid: High level source code is run through a compiler to create bytecode. To run the bytecode, you can: Interpret that through a specific Java bytecode interpreter, OR

Compile that into specific machine-code.

CPE-101 Compilers and Interpreters We write source code files in the Java language. Human beings can read those files.

We then compile the source file down to Java bytecode using a Java compiler: javac MyFile.java yields MyFile.class

Our Java bytecode file can be run in one of two ways: It can be run on a Java interpreter. It can be further compiled to native machine code for a particular machine.

CPE-101 Executing a Java Program When someone invokes the java MyFile command...

The Java runtime environment first invokes a class loader. The class loader loads the bytecodes for all the required classes from disk. Once they are loaded, two operations are performed: A bytecode verifier confirms that all bytecodes are valid. All bytecodes are checked to see that they do not violate Javas security restrictions. The bytecodes are then passed to: A Java interpreter,

Or to a Java just-in-time compiler (faster execution). CPE-101 Programming Language Levels Four levels of programming language: machine language assembly language high-level language procedural (e.g., Algol, Basic, C, Cobol, Fortran, Interlisp, Pascal) functional (e.g., APL, Lisp, Scheme) parallel (e.g., High Performance Fortran, Linda) logic (e.g., Duck, Prolog) combos (e.g., procedural+parallelAda or procedural+OOLoops) object-oriented (e.g., C++, Java, Scheme, Visual Basic) fourth-generation language Each type of CPU has its own specific machine language The levels beyond that were created to make it easier for a human being to write programs Three Types of Program Errors Compile-time errors: problems with syntax and other basic issues that are found by the compiler. If compile-time errors exist, an executable version of the program is not created in our case, bytecode is not produced, right? Run-time errors: a problem that occurs during program execution and causes a program to terminate abnormally, such as trying to divide by zero. Logical Errors: a program may run, but still produce incorrect results. What would you suspect incorrect means in this case?

You might also like