Presentation is loading. Please wait.

Presentation is loading. Please wait.

ZObject-Oriented Software Development yproblem solving yprogram design and implementation yobject-oriented concepts xobjects xclasses xinterfaces xinheritance.

Similar presentations


Presentation on theme: "ZObject-Oriented Software Development yproblem solving yprogram design and implementation yobject-oriented concepts xobjects xclasses xinterfaces xinheritance."— Presentation transcript:

1 zObject-Oriented Software Development yproblem solving yprogram design and implementation yobject-oriented concepts xobjects xclasses xinterfaces xinheritance xpolymorphism ythe Java programming language Focus of the Course

2 Problem Solving zThe purpose of writing a program is to solve a problem zThe general steps in problem solving are: yUnderstand the problem y Design test cases yDissect the problem into manageable pieces yDesign a solution yConsider alternatives to the solution and refine it yImplement the solution yTest the solution and fix any problems that exist

3 Problem Solving zMany software projects fail because the developer didn't really understand the problem to be solved zWe must avoid assumptions and clarify ambiguities zAs problems and their solutions become larger, we must organize our development into manageable pieces zThis technique is fundamental to software development zWe will dissect our solutions into pieces called classes and objects, taking an object-oriented approach

4 zA variable either holds a primitive type, or it holds a reference to an object zA class name can be used as a type to declare an object reference variable String title; zNo object has been created with this declaration zAn object reference variable holds the address of an object zThe object itself must be created separately Creating Objects

5 Software Categories zOperating System ycontrols all machine activities yprovides the user interface to the computer ymanages resources such as the CPU and memory yWindows 98, Windows NT, Unix, Linux, Mac OS zApplication program ygeneric term for any other kind of software yword processors, missile control systems, games zMost operating systems and application programs have a graphical user interface (GUI)

6 *** Binary Numbers *** zOnce information is digitized, it is represented and stored in memory using the binary number system zA single binary digit (0 or 1) is called a bit zDevices that store and move information are cheaper and more reliable if they only have to represent two states zA single bit can represent two possible states, like a light bulb that is either on (1) or off (0) zCombinations of bits are used to store values

7 Storage Capacity zEvery memory device has a storage capacity, indicating the number of bytes it can hold zCapacities are expressed in various units: z ****LOOK THESE UP !!! **** UnitSymbolNumber of Bytes kilobytemegabytegigabyteterabyte

8 The Central Processing Unit zA CPU is also called a microprocessor zIt continuously follows the fetch-decode- execute cycle: z This means that each instruction must be fetched from memory and decoded before it can be executed.

9 **** Errors **** zThere are three types of errors occurring in programs zThe compiler will find problems with syntax and other basic issues (compile-time errors) yIf compile-time errors exist, an executable version of the program is not created zA problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) zA program may run, but produce incorrect results (logical errors) zBe able to give examples of each of these

10 Syntax and Semantics zThe syntax rules of a language define how we can put symbols, reserved words, and identifiers together to make a valid program zThe semantics of a program statement define what that statement means (its purpose or role in a program) zA program that is syntactically correct is not necessarily logically (semantically) correct zA program will always do what we tell it to do, not what we meant to tell it to do

11 White Space zSpaces, blank lines, and tabs are collectively called white space zWhite space is used to separate words and symbols in a program zExtra white space is ignored zA valid Java program can be formatted many different ways zPrograms should be formatted to enhance readability, using consistent indentation

12 Reserved Words zThe Java reserved words: abstract boolean break byte byvalue case cast catch char class const continue default do double else extends false final finally float for future generic goto if implements import inner instanceof int interface long native new null operator outer package private protected public rest return short static super switch synchronized this throw throws transient true try var void volatile while

13 Comments zComments in a program are also called inline documentation zThey should be included to explain the purpose of the program and describe processing steps zThey do not affect how a program works zJava comments can take two forms: // this comment runs to the end of the line /* this comment runs to the terminating symbol, even across line breaks */

14 **** Bit Combinations **** zEach combination can represent a particular item zThere are 2 N combinations of N bits zTherefore, N bits are needed to represent 2 N unique items zGiven a number, be prepared to tell how many bits are required to represent it.

15 Java Program Structure zIn the Java programming language: yA program is made up of one or more classes yA class contains one or more methods yA method contains program statements zThese terms will be explored in detail throughout the course  A Java application always contains a method called main

16 16 Java Program Structure public class MyProgram {}{} // comments about the class class header class body Comments can be added almost anywhere

17 17 Java Program Structure public class MyProgram {}{} public static void main (String[] args) {}{} // comments about the class // comments about the method method header method body

18 18 **** Identifiers **** zIdentifiers are the words a programmer uses in a program zAn identifier can be made up of letters, digits, the underscore character (_), and the dollar sign zThey cannot begin with a digit  Java is case sensitive, therefore Total and total are different identifiers zIdentifiers name: constants, variables, methods, classes, etc.

19 Identifiers  Sometimes we choose identifiers ourselves when writing a program (such as Lincoln )  Sometimes we are using another programmer's code, so we use the identifiers that they chose (such as println ) zOften we use special identifiers called reserved words that already have a predefined meaning in the language and cannot be used in any other way (specifically, they cannot be used as names of variables, methods, classes, or constants).


Download ppt "ZObject-Oriented Software Development yproblem solving yprogram design and implementation yobject-oriented concepts xobjects xclasses xinterfaces xinheritance."

Similar presentations


Ads by Google