OOP Content

Object-Oriented Programming (OOP)
  • Abstraction: Focuses on essential traits, hiding unnecessary details to simplify systems.

  • Encapsulation: Integrates data and methods into a single unit (class), preventing direct data access.

  • Data Types: String is suitable for storing telephone numbers as character sequences.

  • Framework: A reusable platform with libraries, tools, and guidelines for building applications (e.g., .NET Framework, React, Angular).

  • Unit Test: Tests individual components to ensure designed performance, improving code quality and reliability through early bug detection.

  • UML Class Diagram: Visual representation of a system's static structure, detailing classes, attributes, operations, and relationships.

Unit Testing
  • Assert.IsTrue(): Validates boolean conditions to confirm code assumptions.

  • Assert Class Purpose: Validates code behavior by offering assertion methods that test specific aspects.

  • Base Class Library (BCL): Provides reusable classes, interfaces, and types for key functionalities within the .NET Framework.

  • Early Error Detection: Reduces costs and efforts to correct bugs, improving software quality and dependability.

  • Dictionary vs. List: Dictionary is preferred for key-based lookups due to its efficient hash table.

  • UML Class Diagram: Details a class's structure, including methods and attributes, vital for object-oriented design.

  • .NET Base Class Library (BCL): Offers optimized code for routine tasks, streamlining development with varied functionalities.

  • Assert.AreEqual(expected, actual): Checks expected and actual values for equality, ensuring valid code results.

  • Unit Tests: Confirm that code components function as expected during application development.

Object Collaboration and Memory
  • Object Collaboration: Interactions between objects achieve common goals through message exchanges.

  • Memory: Manages object and data storage during runtime, including allocation and deallocation.

  • UML Sequence Diagrams: Shows sequences of object interactions, highlighting message flows and temporal relationships.

  • Lifelines: Represent an object's existence over time in UML diagrams, noting activity and participations.

  • Stack vs. Heap: Value types store on the stack, while reference types link to data on the heap.

  • Method Execution: After a method runs, its stack frame clears, returning control to the caller.

  • Object relationships: Reduce work and refactoring by enhancing code use and upkeep.

  • Aggregation relationship: Classes include instances of others, using 'has-a' to signal weaker ownership than composition.

Inheritance and Polymorphism
  • Inheritance: Child classes inherit methods and properties from parent classes, creating an IS-A relationship.

  • Polymorphism: Objects from different classes are treated as from a common base, boosting adaptability and extension.

  • Method Overriding: Revising inherited methods in derived classes, customizing actions to meet specific needs.

  • Polymorphism: Utilizes identical method names across classes for varied outcomes, boosting dynamic dispatch.

  • Inheritance: Allows inheriting attributes and behavior from parent classes, promoting a hierarchical structure.

Interfaces and Exceptions
  • Interface: Defines properties and methods that classes must have, supporting testing, polymorphism, and multiple inheritances.

  • Exception: Runtime errors disrupt apps, requiring management to avoid termination.

  • Custom Exception Class: Allows tailored error procedures by inheriting from the Exception class.

  • Try-Catch Blocks: Manage errors, preventing program crashes by enabling graceful error handling.

  • Finally Block: Executes no matter what, cleaning up via resource release and preventing issues.

  • Polymorphism: Interfaces allow object work based on capabilities, promoting adaptable designs.

Responsibility Driven Design
  • Composition: Builds through component integration, each with unique roles, offering alternatives to inheritance.

  • Responsibility-Driven Design (RDD): Emphasizes object responsibilities, focusing on 'what' instead of 'how'. Promotes clear and maintainable code by assigning clear responsibilities to each object, leading to a more modular and understandable design. RDD encourages developers to think about what an object should do