Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 1.77 KB

401-04.md

File metadata and controls

49 lines (30 loc) · 1.77 KB
layout title permalink
page
401.04 Reading Notes
/401-R04/

Object-Oriented Programming (OOP)

Objects

  • In software, objects are collections of data that include states and behaviors.

    • States: Changable attributes of the object. Stored in fields (variables in many languages).
    • Behaviors: Functions/methods that perform based on the object's state.
    • Data encapsulation: Principle of OOP where an object's state is only expressed/interacted with via behaviors.
  • Advantages of OOP include:

    • Reusability of code

    • Portability of code to other code bases

    • Obscurity of internal data (as interactions happen on outer functional bases)

    • Can be replaced with other objects as needed

Classes

  • In programming, a class is a category of objects-- an individual object may be an instance of a given class.

  • Classes are not independent applications, but are declared and called.

  • Declarations include:

    • Modifiers for access

    • A capitalized name

    • A single parent class (if applicable), with syntax extends Parent

    • Interface(s), with syntax implements firstInterface, subsequentInterface

    • Code block for the body of the class within curly braces {}

Number Systems

  • Binary : "Base-two" numeral system. Conventionally represented with characters "0" and "1". Used in computing as most basic analogue to on/off or unpowered/powered state.

  • Decimal : "Base-ten" numeral system. Characters usually used are "0", "1" through "9". Extremely common for most types of measurement in the contemporary world.

  • Hexadecimal : "Base-sixteen" numeral system (contemporary characters used are : "0", "1" through "9", and "A" through "F").

    • Computing uses are common due to easier conversion from binary than to decimal notation.