Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP-3330: Object Oriented Programming Course Introduction May 14, 2012 Eng. Hector M Lugo-Cordero, MS.

Similar presentations


Presentation on theme: "COP-3330: Object Oriented Programming Course Introduction May 14, 2012 Eng. Hector M Lugo-Cordero, MS."— Presentation transcript:

1 COP-3330: Object Oriented Programming Course Introduction May 14, 2012 Eng. Hector M Lugo-Cordero, MS

2 Syllabus Link to syllabus As of now my webpage will have all material for the course – http://www.eecs.ucf.edu/~hlugo I will try to get a WebCT session

3 The Programming World Couple of programming paradigms exists – Imperative: Structural: C, FORTRAN – Functional: Scheme, Nodejs – Object Oriented: Objective-C, C++, C#, Java

4 What is this course about? Developing programs using the object oriented paradigm Allows abstraction of low level details giving more powerful tools to concentrate on the higher level tasks Sentences are composed of Subject, Verb, Predicate or Object – Mary eats the apple Subject: Mary Verb (action): eats Object: the apple Object oriented programming is composed of “sentences” var.addTo(temp); – Subject (an object): var – Action (method): addTo – Object (another object): temp

5 Problem Solving 1.Understand the problem 2.Dissect the problem into manageable pieces. 3.Design a solution. 4.Consider alternatives to the solution to refine it. 5.Implement the solution. 6.Test the solution and fix any problems that exist.

6 History of Java Java was developed in 1995 be James Gosling who works at Sun Microsystems. Java's ability to execute programs on the WWW caused an initial buzz. However, the language has continued to gain in popularity because of its object-oriented design. This design is very well-suited for very large programming projects. Many academics even feel that Java is an excellent first programming language to learn. Java teaches the concept of objects very well. Other languages, such as C++, do not reinforce the concept quite as well. Although C++ is good for learning memory management. Recently Sun was bought by Oracle.

7 A Java Program 1. // Knights.java 2. // Arup Guha 3. // 1/9/07 4. // A very simple Java program that prints to the screen. 5. public class Knights { 6./* 7.This is the main function of the program 8.*/ 9.public static void main(String[] args) { 10.System.out.println("GO KNIGHTS!!!!!!!"); 11.} 12. }

8 Understanding the code (comments) Single line comments are written as shown on lines 1 – 4, that is “//with some text” – It is good practice to keep your code clean and commented such that you may go back to understand it after some time – Lines 1 – 4 contain the author and some info about the code, e.g. logs, known bugs, etc. Multi line comments follow the C convention of /* anything between this is a comment */, as shown on lines 6 – 8

9 Class Definition Line 5 presents the definition of a class – All java code resides within classes, and each class must have a name. In main class the name should be the same filename – We shall go more into classes as the course moves on

10 The Main Function Line 9 presents the main function of a Java program It is not necessary to have a main function in order to have a complete Java Class – For now all classes shall have one – As in C, this is the first function that is called

11 Understanding Main There are several keywords on the definition of main – 1) public: access from everywhere – 2) static: the method is the same for all instances of the class – 3) void: return type, in this case none – 4) String[] args: parameters to main. Equivalent to C’s int argc, char** argv We shall go more into detail on this

12 System.out.println On line 10 we our first line to write something to the stdout or console in this case System.out.println works as printf in C, however it is much simpler to use since it does not require format specifiers (i.e. %c, %s, %d, %f, etc.) System.out.printf does exits as well and it is used just liked in C Other standard streams include System.in and System.err

13 Primitive Data Types Data TypeWrapper Class byteByte shortShort intInteger longLong floatFloat doubleDouble boolean Boolean char Character voidVoid

14 Variable Names Are case sensitive Can contain letters, underscores, and numbers Should not start with numbers Should be descriptive of the task, they can have any number of characters

15 Compilers and Interpreters Compilers translate code into machine code to generate a binary file (e.g..exe) Interpreters run the code as it reads it Java is an interpreted language, the Java Virtual Machine (JVM) runs a.class code

16 Creating.class files The command javac may be used as gcc with C to “compile” or create.class files which can be run by the JVM Consider the code Knights.java, to compile it javac Knights.java The above creates a.class file which may be run using java Knights Notice no.class is used (why?)


Download ppt "COP-3330: Object Oriented Programming Course Introduction May 14, 2012 Eng. Hector M Lugo-Cordero, MS."

Similar presentations


Ads by Google