- [Instructor] If there are good patterns in software
that we should follow and include in our applications,
then there also must be bad patterns
that we should avoid using at all costs.
These negative patterns are called anti-patterns.
Anti-patterns define a bad solution,
as well as how they can negatively impact your application.
Understanding anti-patterns can be equally as important
as understanding design patterns.
When you see an anti-pattern in some code,
we can say that that code smells,
and we'll need to find a way to change it
and make the code less stinky.
There are several anti-patterns
in JavaScript that we try to avoid.
It's an anti-pattern in JavaScript
to change or extend the prototype on an instance.
This code really smells and can create
all sorts of havoc in our applications.
In Node, it's an anti-pattern to use synchronous execution
after you've initialized your app.
JavaScript has only one thread, so we shouldn't block it.
This code would make our application slow
for all of our connected users.
Or how about this code smell?
This is a very popular anti-pattern named callback hell.
We will discuss some ways around this design pattern
in the last chapter of this course.
Design patterns and anti-patterns
represent the do's and don'ts in the world of programming.
A good code reviewer can spot code smells and anti-patterns
just as quickly as they could spot
good techniques in design patterns.