Paradigms Flashcards
What is a programming language
A programming language is a computer language
that is used by programmers to communicate
with computers. It is a set of instructions written
in any specific language to perform a specific
task.
Define the term “Programming Paradigmn”
A programming paradigm is the
classification, style or way of
programming. It is an approach to solving
problems by using programming
languages.
OR
A programming paradigm is a way to classify programming languages
based on their features.
List the features of Procedural Programming
- Local variables
- Global variables
- Modularity
- Top-down
approach - Predefined
functions - Parameter passing
Explain local variables
A local variable is a programming variable that has a local scope of use.
This means the variable only functions in the function in which the
developer defines it. Local variables only work in this capacity, so they
can cause code to fail, leaving a task unfinished if a professional or user
attempts to use the variable in a method outside of its scope.
Explain global variables
Global variables increase functionality when local
variables are insufficient. Developers can use global
variables in nearly all functions. When defined globally, a
variable makes itself available to all methods and functions
in the code, allowing the developer to access key data
throughout the program’s many procedures.
Define Modularity
Modularity is a structure in which a developer divides the functionality of its code into a
series of smaller blocks. The programmer can then call these blocks, often called
methods or functions in procedural programming languages, in their code to access
them.
This makes important functions repeatable to create a more efficient setup code,
compared to one that requires the programmer to reuse the same code at multiple points
when including a task that they need more than once.
What is a Pre-defined function
A predefined function is a function available in a procedural
programming language from a library of available functions.
These functions allow a programmer to complete common
tasks without creating the required code themselves. This
can help a developer save time during production.
List atleast 3 Examples of Procedural languages
- ALGOL
2.BASIC
3.C
4.COBOL
5.Pascal
List and explain the advantages of procedural programming languages
- Versatility
Procedural programming is a versatile paradigm that allows
developers to create coding projects that accomplish
significantly varied goals. With procedural programming
languages designed for many different types of development
projects, including software and web development, there’s
likely an effective procedural programming language you can
use to accomplish your goals. - Simplicity
Procedural programming is a relatively simple approach to
computer programming. Therefore, many developers start working
with procedural programming languages, as they provide a
foundation for coding that the developer can apply as they learn
other languages, such as object-oriented language. - Accesibility
Many popular programming languages use procedural
programming, so there are many resources available to an
aspiring developer hoping to learn them. This includes
both paid courses and free online resources and
communities you can access when you encounter
challenges, which can help expedite your development.
List and explain the disadvantages of procedural programming
Complexity:
The simplicity of procedural programming
languages can create a challenge when
you’re attempting to make complex
programs. Often, choosing a language with
an object-oriented approach may be easier
for more in-depth projects.
Trouble Shooting
The use of global data in procedural
programming languages can make it
challenging to identify the source of errors in
your code. This can cause a complex
debugging process, adding time to your
development schedule.
Strict Data types
Data in procedural programming
languages are immutable. This means
you can’t change its structure or
functionality after creation, which can be
limiting, compared to the nearby option
in other languages.
What is Object Oriented Programming?
Object-oriented programming (OOP)
is a computer programming
paradigm that organizes software
design around objects, rather than
functions and logic.
List and Explain the properties of Object Oriented Programming
Classes
Class are blueprints for
creating objects.
Attributes
Attributes store data about an
object and are defined in the
class template.
Methods
Methods are functions that
are defined inside a class
that describe the behaviors
of an object.
Objects
Objects are instances of a class
created with specifically defined
data.
Class are blueprints for
creating objects.
List and explain the characteristics of object oriented programming
Inheritance
Inheritance means classes
can gain methods and
attributes from another
classes allowing developers
to reuse code in another
part of a program or use
external libraries to gain
functionally in a program.
Encapsulation
Encapsulation is a way to
restrict the direct access to
some components of an object,
so users or other classes cannot
access state values for all of
the variables of a particular
object.
Abstraction
Objects only reveal internal
mechanisms that are relevant
for the use of other objects,
hiding any unnecessary
implementation code. The
derived class can have its
functionality extended. This
concept can help developers
more easily make additional
changes or additions over time.
List atleast 3 examples of OOP
1.Python
2. Java
3. Ruby
4. C#
5.C++
List and explain the advantages of OOP
Flexibility
Functions defined in class
can be used in many
different objects
Reusability
Code can be reused through
inheritance, meaning a team
does not have to write the
same code multiple times.
Modularity
Objects can be self-contained,
making troubleshooting and
collaborative development
easier.
Scalable
Larger teams of programmers can
work independently on system
components by braking them into
objects.