Learn All The Programming Principles

(Mainly from McFarlin’s series)

  • Object Oriented Programming (OOP)
    • Objects
      • A noun is an object, an adjective an attribute (property), a verb is a method (function).
    • Classes
      • Provides the blueprints for create a specific type of object.
    • Instantiation
      • The act of creating an object.
    • Types
      • Things like strings, arrays, objects.
      • Simple Data Types
        • Stores one piece of information in a single variable.
      • Complex Data Types
        • Ex: Arrays, Objects
        • Stores multiple pieces of information in a single variable.
        • Arrays – Store multiple pieces of info. in a collection.
        • Associated Arrays – Store key value pairs, as opposed to numerically.
        • Objects – A combination of everything.
        • Other Complex: Resources, Callbacks, Pseudo-Types.
    • Control Structures
      • Things like loops and conditionals.
      • Describes how we can control how the code flows through the program based on various factors.
      • Conditionals
        • Sub-Types: if/then (if/else, if/elseif/else), switch/case
        • The condition of a conditional is any statement that can be evaluated as a boolean expression (true/false).
      • Loops:
        • The act of iterating through.
        • Sub-Types: for, foreach, do, while
    • Functions
      • Present in procedural/oop/functional programming.
      • May also be called methods or routines.
      • Simple Functions
        • Can have no input/out outside of itself.
        • Can have input outside itself via arguments.
        • We can return information via the return statement.
    • Attributes
      • Can be thought as the adjectives describing a class.
      • Are at the class level and available to all the classes functions without adding as an argument.
      • Attributes are different from regular variables in that they are accessed using the $this keyword.
    • Constructors
      • A special type of function for initializing a class, it is oftentimes also used to initialize values.
      • PHP uses a reserved function called __construct.
    • Scope
      • How one controls what attributes and functions of a class can be accessed and how by third party objects or child objects.
      • Public – Available to every type of object attempting to access the attribute or function.
      • Protected – Available within own class, but not by third party classes, except their sub-classes.
      • Private – Only available within the class, no third party classes or sub-classes have access.
    • Encapsulation
      • Hiding of the details of how something is performed; revealing through public functions.
        • Thus the details are abstracted.
    • Inheritance

 

  • Strongly Typed Language – Most have a data type declared and can only hold data of that type.
  • Weakly Typed Language – Can hold multiple data types, no need to declare type.