Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Good afternoon gentlemen and ladies, I'm so glad to be here. Today we will discuss about OOP. OOP is one of the main courses in the department of information systems. OOP is a new paradigm in programming techniques, almost all programming languages are currently using OOP concepts. The purpose of this course is students can understand the OOP concepts and they can make a program in accordance with the rules of OOP Okay, let's look at our topic today. I'll start from the definition of OOP, the reason why you should use OOP, classes and objects, and access modifier Let's look at the definition of OOP. There are many definitions of OOP. Are there any questions? Well, our class is finished, see you next week. Next week we will discuss about the making method and relationships between classes thank you, happy to learn OOP and success for all of us
  • OOP_1_TEG

    1. 1. Object Oriented Programming Teguh Sutanto Si | STIKOM Surabaya teguh@stikom.edu|+628563076813|http://teguhsutanto.blogspot.com|http://blog.stikom.edu/teguh
    2. 2. GOAL <ul><ul><li>Students can understand the Object Oriented Programming concepts </li></ul></ul><ul><ul><li>Students can make a program in accordance with the rules of Object Oriented Programming </li></ul></ul>
    3. 4. Object-oriented programming (OOP) is a programming paradigm using &quot;objects&quot; – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs
    4. 5. Object-oriented programming (OOP) is a programming language model organized around &quot;objects&quot; rather than &quot;actions&quot; and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data
    5. 6. Why OOP? <ul><ul><li>Object-oriented systems can be easily upgraded from small to large scale. </li></ul></ul><ul><ul><li>It is easy to partition the work in a project based on objects. </li></ul></ul><ul><ul><li>Object-oriented programming offers a new and powerful model for writing computer software. </li></ul></ul><ul><ul><li>It reduces software maintenance and developing costs. </li></ul></ul><ul><ul><li>Changes in user requirements or later developments have always been a major problem. </li></ul></ul><ul><ul><li>Object-orientation or object oriented programming (OOP) should help one in developing high quality software easily. </li></ul></ul>
    6. 7. Concept of Class and Object <ul><ul><li>“ Class” refers to a blueprint. It defines the variables and methods the objects support </li></ul></ul><ul><ul><li>“ Object” is an instance of a class. Each object has a class which defines its data and behavior </li></ul></ul>
    7. 8. Concept of Class and Object
    8. 9. Classes reflect concepts, objects reflect instances that embody those concepts Daria Jane Brittany Jodie girl class object
    9. 12. Class: A class can have three kinds of members:
    10. 13. Attribute/Field/Data Method
    11. 14. Field Declaration <ul><ul><li>a type name followed by the field name, and optionally an initialization clause </li></ul></ul><ul><ul><li>primitive data type vs. Object reference </li></ul></ul><ul><ul><ul><li>boolean, char, byte, short, int, long, float, double </li></ul></ul></ul><ul><ul><li>field declarations can be preceded by different modifiers </li></ul></ul><ul><ul><ul><li>access control modifiers </li></ul></ul></ul><ul><ul><ul><li>static </li></ul></ul></ul><ul><ul><ul><li>final </li></ul></ul></ul>
    12. 15. Acces Control Modifier <ul><ul><li>private : private members are accessible only in the class itself </li></ul></ul><ul><ul><li>package : package members are accessible in classes in the same package and the class itself </li></ul></ul><ul><ul><li>protected : protected members are accessible in classes in the same package, in subclasses of the class, and in the class itself </li></ul></ul><ul><ul><li>public : public members are accessible anywhere the class is accessible </li></ul></ul>
    13. 16. com Person <ul><ul><li>name: String </li></ul></ul><ul><ul><li>address: String </li></ul></ul><ul><li># age: int </li></ul><ul><li>+getName(): String </li></ul>Employee HRD X MainMenu X
    14. 17. <ul><li>public class Pencil { </li></ul><ul><li>public String color = “red”; </li></ul><ul><li>public int length; </li></ul><ul><li>public float diameter; </li></ul><ul><li>private float price; </li></ul><ul><ul><li>public static long nextID = 0; </li></ul></ul><ul><ul><li>public void setPrice (float newPrice) { </li></ul></ul><ul><ul><li>price = newPrice; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>public class CreatePencil { </li></ul><ul><li>public static void main (String args[]){ </li></ul><ul><li>Pencil p1 = new Pencil(); </li></ul><ul><li>p1.price = 0.5f; </li></ul><ul><ul><li>} </li></ul></ul><ul><li>} </li></ul>Pencil.java CreatePencil.java %> javac Pencil.java %> javac CreatePencil.java CreatePencil.java:4: price has private access in Pencil p1.price = 0.5f; ^