Types of Programming Languages

Jun 28, 2024

Types of Programming Languages Lecture

Importance of Learning Different Types of Languages

  • Necessary for understanding data structures, algorithms, and basic concepts.
  • Will be useful for studying in Java and other languages like Python or C++.

Basics of Programming Languages

  • Internally, computers operate using binary numbers (0s and 1s).
  • Programming languages translate human-readable code into machine-readable binary code.

Procedural Language

  • Early form of programming that specifies structured steps and procedures to compose a program.
    • Example: Input numbers, add them, then print the result.
  • Can involve loops, statements, functions, and commands.
  • Languages like Java, Python, C++ follow procedural principles.

Functional Language

  • Programs are written using pure functions.
  • Functions: Bundles of reusable code blocks.
  • Pure functions don’t modify variables but create new ones as output.
  • Useful for operations involving the same data set without modifying the original data.
  • Example: Python follows some functional programming principles.
  • First-class functions: Functions can be treated like variables (e.g., assigned to other functions).

Object-Oriented Programming (OOP)

  • Revolves around objects, which are combinations of code and data.
  • Classes define custom data types and properties; instances of classes are called objects.
  • Makes it easier to develop, debug, and maintain software.
    • Example: A car object can have separate sections of code for engine, steering, etc.
  • Languages like Java, Python, C++ support OOP.

Hybrid Languages

  • Languages can be a mix of procedural, functional, and OOP principles.
    • Example: Java and Python support multiple paradigms.

Static vs. Dynamic Languages

Static Languages

  • Type checking is performed at compile time.
  • Errors are detected before running the program.
  • Example: int a = 10; specifying the type beforehand.
  • Offers more control and reduces run-time errors.

Dynamic Languages

  • Type checking is performed at runtime.
  • Errors may not show until the program is running.
  • You don’t need to declare types explicitly.
  • Example: a = 10; a = "kunal" which will work in Python.
  • Saves time in writing code.

Memory Management

  • Two types of memory: Stack and Heap.
  • Stack Memory: Stores variables and function calls.
  • Heap Memory: Stores actual data or objects.
  • Variables in the stack point to objects in the heap.
  • Example: a = 10 where ‘a’ points to the value 10 in heap.
  • Multiple reference variables can point to the same object.
  • Objects without reference variables are cleaned up by Garbage Collection.

Final Notes

  • Objects and memory management will be covered in-depth in future modules.
  • Java will be used for learning OOP principles in detail, covering inheritance, polymorphism, encapsulation, etc.
  • Watch the next video for detailed explanations of the memory and reference variables concepts.

Make sure you like, share, and subscribe to stay updated!