- If you've started doing some research
on programming languages
and are trying to decide which language to learn,
it's highly likely you've started to hear phrases
like object-oriented programming
or functional programming thrown around.
In this lesson, I'm going to teach you
some of the key characteristics
of these different programming paradigms
and why it matters in your exploration
of JavaScript and Python.
So what is a programming paradigm anyway?
A programming paradigm is just an agreed upon approach
to writing and organizing your code.
Some popular programming paradigms
that you might've heard of
are object-oriented programming and functional programming.
Object-oriented programming involves organizing your code
into individual classes which combine state and behavior.
Think of classes as providing a blueprint,
like that of a house,
and then your code instantiates these blueprints
in the form of objects.
Objects can send messages to each other,
but they don't need to know
what is actually happening inside.
Functional programming involves organizing your code
into pure functions that always return the same result
and avoid side effects.
A necessary feature of functional programs
is that functions are first-class objects,
which means that they can be stored as variables
and passed to and returned from other functions.
While some programming languages have been written
for a specific paradigm,
that is not the case for Python or JavaScript.
You can write object-oriented programs
with Python and JavaScript
and you can write functional programs
with Python and JavaScript.
All this to say, if learning a specific paradigm
is what you're interested in,
you may want to explore languages
that were written specifically with that paradigm in mind.
However, if more flexibility in how you organize your code
sounds like a bonus,
Python and JavaScript are great options.