¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Object-Oriented Programming (OOP)

Madalyn Lueken Inglés

Object-Oriented Programming (OOP)

Contenido del mapa

Object-Oriented Programming (OOP)

  1. Objects

    • Has attribute(s) (fields) and can perform action(s) (methods)
    • To create objects, you need classes
    • Creating objects
      • Instantiate: instantiating the Employee is the same as creating an instance of Employee
      • Most common way to create an object is by using the "new" keyword
        • Example: to create an Employee object
      • Assign the created object to an object variable (or a reference variable) to manipulate the object later
      • You can call an object's methods and access its fields by using the object reference that was assigned the object. You use a period (.).
  2. Classes

    • Determines what kind of objects you get
    • Tool that enable programmers to create the abstraction of a problem
      • Abstraction is the act of using programming objects to represent real-world objects
    • Blueprint/template to create objects of identical type
    • ALL program elements in Java must reside in a class
    • Consider 3 things when writing a class:
      • 1. the class name
      • 2. the fields
      • 3. the methods
    • General Syntax
        • Use Pascal naming convention (ex: Employee, DateUtility, RegularRateCalculator)
  3. Fields

    • Variables
    • Can be primitive or references to objects
    • Can refer to another object
      • Example: an Employee class may have an address field of type Address, which is a class that represents a street address
    • Follows the camel naming convention (ex: maxAge, age, numberOfRows)
  4. Methods

    • Define actions that a class's objects (or instances) can do
    • Consists of a declaration part and a body
      • Declaration part consists of a return value, the method name, and a list of arguments
      • Body contains code that perform the action
    • Declaring a method: syntax
    • If a method takes more than one argument, two arguments are separated by a comma
      • Example: the following add method takes two ints and return an int
  5. The Method main

    • Special method called main provides the entry point to an application
    • An application normally has many classes; only one of the classes needs to have a main method
    • The signature of the main method:
    • You can pass arguments to main when using Java to run a class:
        • All arguments MUST be passed as strings
  6. Constructors

    • Every class must have at least one constructor
      • If your class does not explicitly define a constructor, the compiler adds one for you
    • Used to construct an object
    • Does not have a return value, not even void
    • Must have the same name as the class
    • Syntax
    • no-argument (no-arg) constructors have zero argument
  7. Class Members in UML Class Diagrams

    • A field and its type is separated by a colon
    • A method's argument list is presented in parentheses and its return type is written after a colon
  8. The null Keyword

    • When a reference variable does not refer to an object, it has a null value
    • If you declare a local reference variable within a method but do not assign an object to it, you will need to assign null to it to satisfy the compiler
      • Class-level reference variables will be initialized when an instance is created, therefore you do not need to assign null to them
    • Trying to access the field or method of a null variable reference raises an error
      • You can test if a reference variable is null by using the == operator

Imágenes y archivos del mapa

  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)
  • Object-Oriented Programming (OOP)

Información

Descripción
Mapa Mental sobre Object-Oriented Programming (OOP), creado por Madalyn Lueken el 19/05/2021.
Creado por
Madalyn Lueken
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?