Programming Paradigms

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

9 Terms

1
New cards

Programming Paradigms

  • A style or approach to writing and structuring code, defining how problems are solved and how the program is organised.

2
New cards

Turing Complete

  • A programming language is Turing complete if it can be used to simulate any Turing machine, meaning it can perform any function that a computer is theoretically capable of.

  • Most modern programming languages are Turing complete.

3
New cards

The use of different paradigms

  • Different programming paradigms are chosen to suit the problem type, enhance code quality, and make programs easier to maintain and understand by providing clear principles and structures for writing code.

4
New cards

Procedural Programming

  • Code is written as a sequence of instructions executed step by step.

  • Code is organised into procedures (functions or subroutines), each performing a specific task.

  • Focus is on actions or procedures rather than objects or data.

5
New cards

Advantages

  • Structured approach: Code is organized into procedures, improving readability and comprehension.

  • Reusability: Procedures can be reused in multiple parts of a program.

  • Ease of debugging and testing: Step-by-step execution simplifies error detection.

  • Ideal for simple, sequential tasks: Best suited for straightforward problems.

6
New cards

Disadvantages

  • Difficult to maintain for large programs: Managing numerous procedures becomes complex as code grows.

  • Not ideal for complex or real-world problems: Harder to model objects and their relationships.

  • Limited reusability across projects: Procedures often depend heavily on program context.

7
New cards

Object-Oriented Programming

  • A programming paradigm where programs are structured around objects that contain data (attributes) and methods (functions).

  • OOP emphasizes modeling real-world entities, code reusability, and encapsulation through principles like inheritance and polymorphism (using objects interchangeably through shared interfaces).

8
New cards

Advantages

  • Modularity: Code is organized into objects, making it easier to manage and understand.

  • Reusability: Classes and objects can be reused in multiple programs.

  • Encapsulation: Data and methods are bundled together, protecting internal state.

  • Abstraction: Implementation details are hidden, allowing focus on high-level design.

  • Inheritance: New classes can reuse and extend existing code.

  • Polymorphism: Objects of different types can be used interchangeably through shared interfaces.

  • Better modeling of real-world problems: Objects represent real-world entities, making programs more intuitive.

9
New cards

Disadvantages

  • Complexity: Designing objects, classes, and relationships can be more complicated than procedural code.

  • Slower performance: Extra layers of abstraction can lead to slightly lower execution speed.

  • Larger program size: Object structures can increase memory usage.

  • Steep learning curve: Understanding principles like inheritance, polymorphism, and encapsulation can take time.

  • Overhead for small/simple programs: For straightforward tasks, OOP can be unnecessarily complicated.