Podcast
Questions and Answers
Which of the following best describes a programming paradigm?
Which of the following best describes a programming paradigm?
- The process of translating source code into machine code.
- A specific set of tools used for software development.
- A way (or) style of thinking to solve a problem. (correct)
- The hardware architecture on which software is run.
Why is it beneficial for a programmer to understand multiple programming paradigms?
Why is it beneficial for a programmer to understand multiple programming paradigms?
- It allows them to write code that runs faster on specific operating systems.
- It reduces the amount of code needed to solve any given problem.
- It guarantees that the programmer will always use the most efficient algorithm.
- Different problems are better suited to different styles of approach. (correct)
In which programming paradigm is the programmer most concerned with instructing the computer on how to solve a task?
In which programming paradigm is the programmer most concerned with instructing the computer on how to solve a task?
- Logical.
- Functional.
- Declarative.
- Imperative. (correct)
Which programming paradigm focuses on defining what result is desired, rather than how to achieve it?
Which programming paradigm focuses on defining what result is desired, rather than how to achieve it?
Which of the following paradigms treats data and procedures as distinct entities?
Which of the following paradigms treats data and procedures as distinct entities?
Which feature is a characteristic of the Procedural Programming Paradigm?
Which feature is a characteristic of the Procedural Programming Paradigm?
In the context of Procedural Programming, what is the significance of 'events'?
In the context of Procedural Programming, what is the significance of 'events'?
Which of the following is an example of a procedural programming language?
Which of the following is an example of a procedural programming language?
In the context of parallel computing, what characterizes the execution of processes?
In the context of parallel computing, what characterizes the execution of processes?
Which of the following describes a key advantage of parallel computing?
Which of the following describes a key advantage of parallel computing?
Which factor can be a limitation of parallel computing?
Which factor can be a limitation of parallel computing?
In what area is parallel computing commonly applied?
In what area is parallel computing commonly applied?
What is a fundamental characteristic of object-oriented programming (OOP)?
What is a fundamental characteristic of object-oriented programming (OOP)?
Which of the following is a key feature of object-oriented programming?
Which of the following is a key feature of object-oriented programming?
Which concept is NOT a basic component of Object Oriented Programming?
Which concept is NOT a basic component of Object Oriented Programming?
What best describes a 'class' in object-oriented programming?
What best describes a 'class' in object-oriented programming?
What is the primary role of 'attributes' in object-oriented programming?
What is the primary role of 'attributes' in object-oriented programming?
How does 'inheritance' contribute to code reusability in object-oriented programming?
How does 'inheritance' contribute to code reusability in object-oriented programming?
What is the purpose of 'abstraction' in object-oriented design?
What is the purpose of 'abstraction' in object-oriented design?
What does 'encapsulation' achieve in object-oriented programming?
What does 'encapsulation' achieve in object-oriented programming?
What is 'polymorphism' in the context of object-oriented programming?
What is 'polymorphism' in the context of object-oriented programming?
Which of the following is a characteristic of the Logic Programming paradigm?
Which of the following is a characteristic of the Logic Programming paradigm?
What is a key advantage of logic-oriented programming?
What is a key advantage of logic-oriented programming?
Which language is most closely associated with the Logic Paradigm?
Which language is most closely associated with the Logic Paradigm?
In the Functional Paradigm, what is the primary means of computation?
In the Functional Paradigm, what is the primary means of computation?
How does the Functional Paradigm handle data modification?
How does the Functional Paradigm handle data modification?
What is a potential disadvantage of the Functional Paradigm?
What is a potential disadvantage of the Functional Paradigm?
Which language does NOT support the Functional Paradigm?
Which language does NOT support the Functional Paradigm?
What characterizes the Database/Data-Driven programming approach?
What characterizes the Database/Data-Driven programming approach?
What role does a database program play in a business information system?
What role does a database program play in a business information system?
What is a key requirement of functionality in the Database Paradigm?
What is a key requirement of functionality in the Database Paradigm?
Which of the following languages does NOT support a data-driven paradigm?
Which of the following languages does NOT support a data-driven paradigm?
What is a potential disadvantage of the Database Paradigm?
What is a potential disadvantage of the Database Paradigm?
Which choice best describes a key goal of Aspect-Oriented Programming (AOP)?
Which choice best describes a key goal of Aspect-Oriented Programming (AOP)?
Which of the following describes how the AOP paradigm relates to OOP?
Which of the following describes how the AOP paradigm relates to OOP?
What mechanism in AOP weaves the aspects and the core modules of a program together?
What mechanism in AOP weaves the aspects and the core modules of a program together?
In AOP, what does a 'join point' represent?
In AOP, what does a 'join point' represent?
In AOP, what is the purpose of 'advice'?
In AOP, what is the purpose of 'advice'?
Which paradigms relies on flows determined by external events?
Which paradigms relies on flows determined by external events?
Which of the following languages is most closely associated with being event driven?
Which of the following languages is most closely associated with being event driven?
In Event-Driven Programming, what role does the 'scheduler' play?
In Event-Driven Programming, what role does the 'scheduler' play?
In event-driven programming, why is the order of execution not always clear?
In event-driven programming, why is the order of execution not always clear?
What is the purpose of an 'event queue' in event-driven programming?
What is the purpose of an 'event queue' in event-driven programming?
In Imperative Programming, which is emphasized?
In Imperative Programming, which is emphasized?
Which of the following is an example of abstraction in the Declarative Paradigm?
Which of the following is an example of abstraction in the Declarative Paradigm?
Flashcards
What is a Paradigm?
What is a Paradigm?
A way, or style, of thinking to solve a problem.
What is a Programming Language Paradigm?
What is a Programming Language Paradigm?
A way a computer language views a problem to be solved.
What is Imperative Programming?
What is Imperative Programming?
A programming style where you instruct the computer in a step-by-step process on how to solve a task.
What is Declarative Programming?
What is Declarative Programming?
Signup and view all the flashcards
What is Procedural Programming?
What is Procedural Programming?
Signup and view all the flashcards
What is Parallel Computing?
What is Parallel Computing?
Signup and view all the flashcards
What is Object-Oriented Programming (OOP)?
What is Object-Oriented Programming (OOP)?
Signup and view all the flashcards
What is a Class in OOP?
What is a Class in OOP?
Signup and view all the flashcards
What is an Object in OOP?
What is an Object in OOP?
Signup and view all the flashcards
What are Attributes in OOP?
What are Attributes in OOP?
Signup and view all the flashcards
What is Inheritance in OOP?
What is Inheritance in OOP?
Signup and view all the flashcards
What is Abstraction in OOP?
What is Abstraction in OOP?
Signup and view all the flashcards
What is Encapsulation?
What is Encapsulation?
Signup and view all the flashcards
What is Polymorphism?
What is Polymorphism?
Signup and view all the flashcards
What is Logic Paradigm?
What is Logic Paradigm?
Signup and view all the flashcards
What is the Functional Paradigm?
What is the Functional Paradigm?
Signup and view all the flashcards
What is Database/Data-Driven Programming?
What is Database/Data-Driven Programming?
Signup and view all the flashcards
What is Aspect Oriented Programming?
What is Aspect Oriented Programming?
Signup and view all the flashcards
What is Event-Driven Programming?
What is Event-Driven Programming?
Signup and view all the flashcards
What are Aspects in AOP?
What are Aspects in AOP?
Signup and view all the flashcards
What is a Join Point in AOP?
What is a Join Point in AOP?
Signup and view all the flashcards
What is Advice in AOP?
What is Advice in AOP?
Signup and view all the flashcards
What are Pointcuts?
What are Pointcuts?
Signup and view all the flashcards
Study Notes
Programming Language Paradigms
- A programming language paradigm is the approach a language takes to solve problems.
What is Paradigm?
- A paradigm is a style or method of thinking to solve a problem.
What is Programming Language Paradigm?
- A programming language paradigm is how a computer language addresses problem-solving.
Types of Programming Language Paradigms
- Imperative and declarative programming are the two main paradigms.
- Imperative paradigms include procedural, object-oriented, and parallel processing.
- Declarative paradigms include logic, functional, and database.
Why So Many Paradigms?
- Using different paradigms aids in the facilitation of different styles of approach to meet the requirements of various problems.
- Some problems need mathematical models and clear flow, others just need a straightforward solution.
Which to Learn First?
- It is important to learn the paradigm of a subject before diving into the language itself.
- This enables coding that aligns with the compiler's assumed control flow, leading to optimized coding.
Imperative Paradigm
- Focuses on the "how" of solving a task through a step-by-step process.
- Programming involves instructing the computer in a specific manner to achieve a task.
Declarative Programming Paradigm
-
Focuses on "what" the desired result is, rather than detailing the steps.
-
Code focuses on building the logic of the software without detailing flow.
-
HTML, XML, CSS, SQL, Prolog, Haskell, F#, and Lisp are languages that fall under the declarative paradigm.
-
Programs often compile to efficient binary executables.
-
Statements are grouped into sections using blocks for simplicity.
-
C, C++, C#, and Java are imperative languages.
Procedural Programming Paradigm
-
Writing instructions step-by-step to get the final result.
-
A process that directly instructs a device to execute logical steps to finish a task.
-
Approached in a linear, top-down manner.
-
Data and procedures are treated as separate entities.
-
Programs are divided into procedures/routines/functions which each contain a series of steps.
-
Languages derived in third-generations.
-
Contrasted with event-driven programming.
-
Procedures are called/executed only in response to events.
-
Events are unpredictable.
-
Procedures to handle unpredictable events cannot be executed linearly.
Key Features of Procedural Programming
- Utilizes predefined functions, local and global variables, modularity, and parameter passing.
Procedural Programming Languages
- Common Business Oriented Language (COBOL)
- Formula Translation (FORTRAN)
- Algorithmic Language (ALGOL)
- Programming Language One (PL/I)
- Beginners All-purpose Symbolic Instruction Code (BASIC)
- C
Parallel Computing
- Computation where calculations or processes are executed simultaneously.
- Problem-solving using multiple processing elements at the same time.
- Problems are broken down into instructions solved concurrently by multiple resources.
- An example of parallel computing can be illustrated by a scenario where two cashiers give movie tickets to people waiting in two queues at the same time.
Why Parallel Computing?
- It is useful for real-world, dynamic simulations.
- Offers time and money savings by providing concurrency.
- Effectively manages complex, large datasets.
- Ensures effective utilization of resources and hardware.
- It is impractical to implement real-time systems using serial computing.
Limitations of Parallel Computing
- Communication and synchronization between multiple sub-tasks is difficult.
- Algorithms need proper managing that can be handled in a parallel mechanism.
- Algorithms/programs must have low coupling and high cohesion, which is difficult to achieve.
- Requires skilled and expert programmers.
Applications of Parallel Computing
- Used in databases, data mining, real-time simulations, science, engineering, advanced graphics, augmented reality, and virtual reality.
Object-Oriented Programming
- Based on objects containing data and methods.
- Aims to incorporate advantages of modularity and reusability.
- Object-instances of classes interact with each other.
- Examples of languages: C++, Java, Python, Ruby.
Important Features of Object-Oriented Programming
- Bottom-up approach in program design.
- Programs are organized around objects grouped into classes.
- Centers on data with methods for object operations.
- Enables interaction between objects through functions.
- Provides design reusability through new classes that add to existing classes
Basic Concepts of Object-Oriented Programming
- Includes classes, objects, attributes, methods, inheritance, abstraction, encapsulation, information hiding, and polymorphism.
Class
- An abstract data type and a blueprint describing the nature of something.
- A data structure may contain different fields.
- An object defined to contain procedures that act on it.
- Attributes / fields are like data.
- Operations / methods are like functions.
Object
- An individual instance of a class created at runtime.
- The state of an object consists of values assigned to its attributes.
- Behaviour is defined in the class.
- Initialized by implicitly calling its constructor.
- A member function is one of the methods an object has.
Attributes
- Data members or member variables that are encapsulated within a class or object.
- Variables are initialized using a constructor.
- Represent the state of an object
Inheritance
- Compartmentalizes code, making it reusable.
- Based on collections of attributes and behaviors from previously defined classes.
- Subclasses inherit attributes and behaviors from superclasses.
- This relationship creates a hierarchy.
- A single class can inherit from 2 classes that have members bearing the same names but different meanings.
Abstraction
- Simplifying complex reality by modeling classes appropriately to the problem.
- Object-oriented programming provides abstraction through composition and inheritance.
- A Class Car, can be viewed as a composition of engine, gearbox, and steering.
- When driving, there is no need to know how different components work internally.
Encapsulation and Information Hiding
- Bundling of data members and member functions.
- Choosing whether to expose or hide members of a class.
- Achieved by specifying which classes may use the members.
- Prevents unauthorized objects from changing the state of an object.
Polymorphism
- "Poly" means many and "morph" means forms.
- The ability of a message to be displayed in more than one form.
- For example, a man as a Father, husband, and employee
- The same person possesses different behaviors in different situations.
- One interface, multiple implementations.
Types of Declarative Paradigm
- Divided into Logic, Functional and Database paradigms
Logic Paradigm
- Program statements express facts and rules within a formal logic system.
- Divided into definitions, facts, and a declaration of aims as a request
- Deducible answers to a query are returned, built entirely from relations.
Advantages of Logical Programming
- The programming steps are minimal since the system solves the problem.
- Demonstrating the rationality of a given program is easy.
Languages using Logic Paradigm
- Datalog
- ASP
- Prolog
Functional Paradigm
- The key principle is the execution of a series of mathematical functions.
- Functions can be replaced with their values without changing the program's meaning.
- Math operations are based on inputs, avoiding temporary variables to store results between inputs.
Advantage of Funtional Paradigm
- The code is more readable and easily understandable.
- Testing and debugging is easier.
- Useful for pure function concurrency.
- Values are stored only when needed.
- Provides a protected environment with no side effects.
Disadvantage of Functional Paradigm
- Recursion can decrease performance.
- Functional programming can be less efficient than other styles.
- Requires large amounts of time and memory.
- Purely functional languages are not widely used in commercial software development.
Programming Language using Functional Paradigm
- Haskell
- JavaScript
- Scala
- Lisp
- ML
- Clojure
- Common Lisp
Database/Data Driven Programming Approach
- Database programming methodology based on data and its movement.
- Program statements are defined by data.
- Database programs are the heart of information systems, offering creation, entry, update, query, and reporting functions.
Database or Datadriven Programming Language
- AWK
- Oz
- Perl
- sed
- Lua
- Clojure
Advantages of Database Paradigm
- Requires awareness of the abstract data type.
- Functions and interfaces can be used on all objects with the same data field.
- Data of objects/entities can be grouped without consequences.
Disadvantage of Database Paradigm
- Dealing with abstract data types may lead to poor object-oriented programming.
- Modifying object structures can break functions.
Minor Paradigms
- Aspect-oriented programming
- Event-driven programming
Aspect Oriented Programming
- AOP is complementary to OOP.
- AOP modularizes code into processes, while OOP modularizes into objects.
- Provides separation of concern in code.
- Facilitates cross-cutting concerns.
- Adds behavior to code without modifying the code.
Need for AOP
- Provides cross-cutting concerns and creates cleaner, reusable code.
- The common purposes of usage can include security, transactions, and logging.
- Increases code understanding and is applied using an aspect weaver.
Basic Terminologies of AOP
-
Aspects are parts of the application that cross-cut core concerns of objects.
-
Join points are behaviors like exception handling or method execution of objects.
-
Advice is an action taken by an aspect at a join point, either before or after its execution.
-
Pointcuts determine the join points where advice should be applied.
-
AOP enhances OOP.
-
AOP and OOP can be utilized at the same time.
-
Programs where the flow of execution is determined by events.
-
Designed to detect and handle them via Event Handling Procedures
-
Extension of interrupt-driven programming found in DOS, Embedded Systems
-
The majority of object-oriented and visual languages support event-driven programming, such as Visual Basic, Visual C++, and Java.
-
VB is specifically designed for event-driven approach and provides IDE.
-
VB provides much of the code for detecting events automatically that the programmer designs interface design and other event handling code
Background of Event Driven Programming
-
Before its evolution, procedural programs determined flow.
-
Modern event-driven programs have no discernible control flow.
-
Event loops wait for events and invoke appropriate routines.
-
Code for the event loop provided by event-development environment.
-
Change from procedural to event-driven is accelerated by the introduction of Graphical User Interface (GUI).
-
It emerged during the introduction of Object Oriented Programming in the late 1970s.
-
Software at the time had user interfaces and a set of event handling procedures to deal with queries and updates.
Working of Event Driven Programming
-
Scheduler determines the event type and calls the appropriate handler.
-
Centralized element of event applications.
-
Event handlers deal with specific occurrences using blocks of procedural code.
-
Causes a visual response and a state change of the system, that encompasses both data used and the user interface.
-
Leads to the invocation of a second event handler.
-
Event handlers can also discard series of events.
Event Queue
- Series of events cannot be processed at the same time.
- Events are handled by an Event Queue
- Priority scheme enables fast tracking by the scheduler.
- Queue length and processing time depend on processor speed, RAM, and simultaneously running applications.
Imperative vs Declarative Paradigm
Imperative Paradigm
- Focuses on "how" to do something, detailing exactly how to achieve the result.
- Provides more flexibility but sometimes involves complexity.
Var numbers=[1,2,3];
Var doubledNumbers= [];
for(var i=0;i<numbers.length;++i){
doubledNumbers.push(numbers[i]*2);
}
console.log(doubledNumbers)
- -----> {2,4,6}
- It is a strategy involved to use a condition for initialization to create a new array.
Declarative Paradigm
- Expresses the logic of a computation without describing its control flow.
- Provides simplicity and hides complexity.
Var Numbers=[1,2,3];
Var doubleNumbers= numbers.map (function(number)){
return number *2;
console.log(doubledNumbers)--------> {2,4,6}
- Map functions iterate over an array and push items into a new array before returning the computed array.
- Increases the readability and compactness of the program.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.