Gen-AI Developer Classroom notes 06/Oct/2025

Object Oriented Programming

  • An object can be anything with
    • contents
    • capabilities
  • Examples
  • Bank Account
    • contents
      • number
      • name
      • bank info
      • contact info
      • balance
    • capabilities:
      • withdraw
      • transfer
  • Car
    • Contents:
      • engine
      • seats
      • make
    • capabilities:
      • commute
      • drive
  • Contents become members and capabilities become methods (functions)
  • In python
class BankAccount:

    def withdraw(amount: int):
        pass

    def transfer(amount: int, to: BankAccount):
        pass

  • Class will have three types of methods
    • class methods
    • instance methods
    • static methods
  • members will also be at levels

    • instance members
    • class members
  • Objects can be related to each other, we have two major types of relationships

    • is-a (inheritence)
    • has-a (Composition)

Lets discuss object oriented library

  • Library has a catalog
  • Catalog will have books which you can
    • search by title
    • search by id
  • Each Book can be loaned (Transaction)
  • Loan will have
    • Person
    • Book
  • Each Book will have a unique id by college

  • Book:

    • contents:
      • title
      • isbn
      • author
      • genre
  • Person:
    • content:
      • id
      • name
      • mobilenumber
      • email
    • capability:
      • loan
      • return
  • Loan:
    • contents:
      • id
      • start_datetime
      • end_datetime
      • student

Preview

  • Exercise: Try implementing inventory for grocery store.

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading