4.17 out of 5
4.17
33 reviews on Udemy

Mastering Clean Code in JavaScript

Learning the JavaScript framework is good and cleaner JavaScript is even better
Instructor:
Packt Publishing
248 students enrolled
English [Auto-generated]
Structure better code in modules with ease
Write pure functions, avoid side-effects, and go functional
Explore design patterns and practices and how to use them
Get familiar with unit testing
Proper error handling in JavaScript

Alongside HTML and CSS, JavaScript is one of the three core
technologies of World Wide Web content production. You can write
terrible code in any language, but if you wanted to try to write
terrible code that works, JavaScript would be your language of choice.

In this course, you will learn various concepts and techniques,
essential principles, patterns, and practices for writing clean code in
JavaScript. You will be introduced to some general guidelines on how to
better structure your JavaScript code. You will then learn about clean
code best practices while working with variables, functions objects, and
the latest ES6 classes. Next, you will discover functional programming,
how to write pure functions, and how to use built-in functional
methods. You will then move on to modular JavaScript and explore the
various ways you can structure your modules. After that, you will master
various design patterns and programming principles. Unit testing is
very important and you will learn to do this with Jasmine and Karma, to
make handling errors easy.

By the end of the course, you will have learned to learn clean coding
with functional programming, explored various modules in JavaScript,
and designed patterns and principles. Overall you will learn to write
better code with improved readability.

About the Author :

Dimitris Loukas is a software engineer currently writing Single Page Applications and using the latest version of JavaScript with Aurelia and Angular for a trading software firm. He is also finishing his Computer Science studies at the University of Athens. He has worked for two start-ups in the past, is active in the open source community, and loves taking up small side projects. He has mastered Angular, Aurelia, and VueJS and is now interested in entering the ReactJS world. He is fascinated by modern JavaScript and where the web is going.

Clean Code with JavaScript

1
The Course Overview

This video provides an overview of the entire course.

2
Clean Variables

We have to begin the journey to cleaner code from somewhere and variables is the perfect place to start.

3
Lexical Scope and let

Developers often have mistaken ideas surrounding lexical scope.

4
Clean Functions

Functions form the majority of a developer’s JavaScript code. Functions need to be as clean as possible.

5
All about this

The this keyword is a common source of bugs for developers who often produce bad code because of it.

6
Clean Objects and Classes

The viewer would benefit from a few tips on how to more effectively work with objects and ES6 classes.

7
Using a linter

JavaScript code can often become chaotic, especially in big projects.

Clean Code with Functional Programming

1
Introduction to Functional Programming
Some viewers may not know what is functional programming.
2
Writing a Pure Function

Pure functions are fundamental to functional programming.

3
Object.assign and the Spread Operator

ES6 came with some really nice features that help you transform your code with functional programming.

4
Forget the Loop with Map and ForEach

Using a typical for loop is a thing of the past in JavaScript.

5
Reducing an Array
Map and forEach are good only for certain cases.
6
Filtering an Array
Sometimes you need to only accept some of the items from an array.

Modules in JavaScript

1
Why Modules

JavaScript has evolved massively during the last decade and modules have been an integral part to this evolution.

2
The Module Pattern

All module definitions like CommonJS and AMD have their roots in the module pattern.

3
The Node Package Manager

Nearly all modern JavaScript applications make use of npm. There cannot be clean code without npm.

4
CommonJS
CommonJS is the module definition most widely adopted by NodeJS projects.
5
AMD

AMD came as a solution to the synchronous nature of CommonJS not being optimal for a browser environment.

6
ES6 Modules

ES6 modules are the solution to multiple problems and come time they will be the norm in most JavaScript projects.

7
Tree-Shaking with Webpack

ES6 modules in combination with webpack 3 and the uglifyJS plugin offer the ability to remove unused code from the final bundle.

Design Patterns and Principles

1
The Single Responsibility Principle

Classes should be designed to do one thing. This is not often the case in JavaScript applications.

2
The Open/Closed Principle

JavaScript functions, modules and classes should be closed to modification but open to extension.

3
The Liskov Substitution Principle

The Liskov substitution principle is often overlooked in JavaScript apps.

4
The Interface Segregation Principle

An interface should not force a class to implement methods and functionality that it does not need.

5
The Dependency Inversion Principle

Dependency Injection can really transform your applications to something great.

6
The Singleton Pattern
Sometimes you need to have a single instance of something available in your code.
7
The Observer Pattern
The observer pattern is useful when you want to watch properties.
8
The Strategy Pattern
Sometimes you want to hot-swap similar algorithms at runtime.

Testing

1
Introduction to Unit Testing

Beginning the section, the viewer needs to be prepared for the heavy stuff that will follow regarding unit testing.

2
Installing and Using Jasmine
Simple unit tests are only good for simple problems and small codebases.
3
Test Driven Development

To make the most out of unit tests you need to incorporate them into your workflow.

4
Making the Tests Pass

After the red part of TDD you are ready to implement the functionality until all tests are passed.

Error Handling

1
Error Handling Best Practices
Error handling plays a very important part in software engineering.
2
Catching Errors from Promises

Promise rejections are much different than simple errors.

3
An Error Handler with Strategy

The error handler we built in a previous section was a nice start.

4
Logging
Error Management is not just about showing nice messages to the user.
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.2
4.2 out of 5
33 Ratings

Detailed Rating

Stars 5
11
Stars 4
15
Stars 3
3
Stars 2
3
Stars 1
1
43e2ccdcf1e9977dbc4837c4f029ce78
30-Day Money-Back Guarantee

Includes

5 hours on-demand video
Full lifetime access
Access on mobile and TV
Certificate of Completion